From f373dde176e97f58c2b11c0700d324a05b7fe0d3 Mon Sep 17 00:00:00 2001 From: tbxark Date: Thu, 14 Nov 2024 23:21:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20NextChatAgent=20prompt=E6=8B=BC=E6=8E=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/lib/next/src/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/lib/next/src/index.ts b/packages/lib/next/src/index.ts index 24f47c12..29663c37 100644 --- a/packages/lib/next/src/index.ts +++ b/packages/lib/next/src/index.ts @@ -108,9 +108,14 @@ export class NextChatAgent implements ChatAgent { if (!model) { throw new Error('Model not found'); } + if (params.prompt) { + params.messages.unshift({ + role: 'assistant', + content: params.prompt, + }); + } return requestChatCompletionsV2({ model: this.providerCreator(context).languageModel(model), - prompt: params.prompt, messages: params.messages, }, onStream); };