From d6609d43029fe2494634f6a7a04185f42eb6d837 Mon Sep 17 00:00:00 2001 From: Dhravya Date: Sun, 14 Apr 2024 01:04:06 -0700 Subject: [PATCH] 6144 char limit --- apps/cf-ai-backend/src/routes/chat.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/cf-ai-backend/src/routes/chat.ts b/apps/cf-ai-backend/src/routes/chat.ts index 54676d70..77ee1fd9 100644 --- a/apps/cf-ai-backend/src/routes/chat.ts +++ b/apps/cf-ai-backend/src/routes/chat.ts @@ -122,8 +122,6 @@ export async function POST(request: Request, _: CloudflareVectorizeStore, embedd `You are an agent that summarizes a page based on the query. don't say 'based on the context'. I expect you to be like a 'Second Brain'. you will be provided with the context (old saved posts) and questions. Answer accordingly. Answer in markdown format` + `Context:\n${preparedContext ?? 'No context'}\n\nQuestion: ${query}\nAnswer:`; - console.log('Prompt', prompt); - // const output = await chat.sendMessageStream(prompt); // const response = new Response( @@ -145,7 +143,7 @@ export async function POST(request: Request, _: CloudflareVectorizeStore, embedd const ai = new Ai(env?.AI); // @ts-ignore const output: AiTextGenerationOutput = (await ai.run('@hf/mistralai/mistral-7b-instruct-v0.2', { - prompt, + prompt: prompt.slice(0, 6144), stream: true, })) as ReadableStream;