mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-21 21:20:19 +09:00
Create Index.js
This commit is contained in:
parent
93f694ef1c
commit
3315c3cac0
27
Index.js
Normal file
27
Index.js
Normal file
@ -0,0 +1,27 @@
|
||||
export default {
|
||||
async fetch(request, env) {
|
||||
const tasks = [];
|
||||
|
||||
|
||||
// prompt - simple completion style input
|
||||
let simple = {
|
||||
prompt: 'Tell me a joke about Cloudflare'
|
||||
};
|
||||
let response = await env.AI.run('@cf/meta/llama-3-8b-instruct', simple);
|
||||
tasks.push({ inputs: simple, response });
|
||||
|
||||
|
||||
// messages - chat style input
|
||||
let chat = {
|
||||
messages: [
|
||||
{ role: 'system', content: 'You are a helpful assistant.' },
|
||||
{ role: 'user', content: 'Who won the world series in 2020?' }
|
||||
]
|
||||
};
|
||||
response = await env.AI.run('@cf/meta/llama-3-8b-instruct', chat);
|
||||
tasks.push({ inputs: chat, response });
|
||||
|
||||
|
||||
return Response.json(tasks);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user