From f4ea3bf2ff114a3fd3428f3d58d4b4089e864225 Mon Sep 17 00:00:00 2001 From: "huangzhelong.byte" Date: Sat, 5 Apr 2025 18:53:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E5=90=8E=E7=AB=AF=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=20openai=20=E9=80=9A=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/components/main-panel/chat/index.vue | 218 +++++++++++++++++-- test/src/controller/llm.ts | 20 +- test/tabs.json | 20 +- 3 files changed, 219 insertions(+), 39 deletions(-) diff --git a/app/src/components/main-panel/chat/index.vue b/app/src/components/main-panel/chat/index.vue index aa0e8fb..ea0ec9f 100644 --- a/app/src/components/main-panel/chat/index.vue +++ b/app/src/components/main-panel/chat/index.vue @@ -1,27 +1,219 @@ \ No newline at end of file diff --git a/test/src/controller/llm.ts b/test/src/controller/llm.ts index eb59285..d7b17c6 100644 --- a/test/src/controller/llm.ts +++ b/test/src/controller/llm.ts @@ -30,14 +30,18 @@ export async function chatCompletionHandler(client: MCPClient | undefined, data: for await (const chunk of stream) { const content = chunk.choices[0]?.delta?.content || ''; if (content) { + const chunkResult = { + code: 200, + msg: { + content, + finish_reason: chunk.choices[0]?.finish_reason || null + } + }; + webview.postMessage({ command: 'llm/chat/completions/chunk', - data: { - code: 200, - content, - finish_reason: chunk.choices[0]?.finish_reason || null - } - }); + data: chunkResult + }); } } @@ -46,7 +50,9 @@ export async function chatCompletionHandler(client: MCPClient | undefined, data: command: 'llm/chat/completions/done', data: { code: 200, - success: true + msg: { + success: true + } } }); diff --git a/test/tabs.json b/test/tabs.json index ab2564c..2a00242 100644 --- a/test/tabs.json +++ b/test/tabs.json @@ -1,24 +1,6 @@ { - "currentIndex": 2, + "currentIndex": 0, "tabs": [ - { - "name": "资源", - "icon": "icon-file", - "type": "blank", - "componentIndex": 0, - "storage": { - "currentResourceName": "greeting" - } - }, - { - "name": "提词", - "icon": "icon-chat", - "type": "blank", - "componentIndex": 1, - "storage": { - "currentPromptName": "translate" - } - }, { "name": "交互测试", "icon": "icon-robot",