From 378d2b67128854be2f38f1806e91d01d57dc444e Mon Sep 17 00:00:00 2001 From: onlyjackfrost Date: Fri, 28 Mar 2025 14:39:25 +0800 Subject: [PATCH] fix(wren-ui): fix generate instruction request payload --- .../apollo/server/adaptors/wrenAIAdaptor.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts b/wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts index f81449223e..44810a503f 100644 --- a/wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts +++ b/wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts @@ -542,19 +542,19 @@ export class WrenAIAdaptor implements IWrenAIAdaptor { public async generateInstruction( input: GenerateInstructionInput[], ): Promise { - const body = input.map((item) => ({ - id: item.id.toString(), - instruction: item.instruction, - questions: item.questions, - is_default: item.isDefault, - project_id: item.projectId?.toString(), - })); + const body = { + instructions: input.map((item) => ({ + id: item.id.toString(), + instruction: item.instruction, + questions: item.questions, + is_default: item.isDefault, + })), + project_id: input[0]?.projectId.toString(), + }; try { const res = await axios.post( `${this.wrenAIBaseEndpoint}/v1/instructions`, - { - instructions: body, - }, + body, ); return { queryId: res.data.event_id }; } catch (err: any) {