From 1f60dc8879a184e932594773e526af64f2322213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A8=9C?= Date: Mon, 31 Mar 2025 16:56:34 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Ajson=E5=88=A4=E6=96=AD=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/conversation.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/conversation.ts b/src/store/conversation.ts index e29a7539..38c637eb 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -261,8 +261,8 @@ export const useSessionStore = defineStore('conversation', () => { .filter((line) => line.startsWith('data: {')); // 获取最后一个 const lastLine = lines[lines.length - 1] || {}; - if (!judgeJson(lastLine.toString())) { - addItem = lastLine.toString(); + if (!judgeJson(JSON.stringify(lastLine))) { + addItem = JSON.stringify(lastLine); lines.splice(lines.length - 1, 1); } else { addItem = ''; @@ -839,7 +839,7 @@ export const useSessionStore = defineStore('conversation', () => { } const str3 = str.substr(6, str.length - 1); try { - const obj = JSON.parse(str3); + const obj = JSON.parse('"' + str3); if (typeof obj === 'object' && obj) { return true; } else { -- Gitee