From 770fd469c73fb0db3fe7bdab60e22652e42ed390 Mon Sep 17 00:00:00 2001 From: fofolee Date: Sat, 15 Mar 2025 10:56:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=8D=87openai=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/lib/ai.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/lib/ai.js b/plugin/lib/ai.js index 46bbbd1..ad8879d 100644 --- a/plugin/lib/ai.js +++ b/plugin/lib/ai.js @@ -168,8 +168,8 @@ function parseModelsResponse(response, apiType) { // 处理 OpenAI 流式响应 async function handleOpenAIStreamResponse(line, onStream) { - if (line.startsWith("data: ")) { - const jsonStr = line.replace(/^data: /, ""); + if (line.startsWith("data:")) { + const jsonStr = line.replace(/^data:[ ]*/, ""); if (jsonStr === "[DONE]") { onStream("", true); return;