From 1b640f008447d201f5cef582ffea02f4c77e6fcf Mon Sep 17 00:00:00 2001 From: wangwei Date: Wed, 20 May 2026 23:39:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=B3=95=E8=A7=84=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/services/llm/deepseek_client.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/app/services/llm/deepseek_client.py b/backend/app/services/llm/deepseek_client.py index 0e0a7f3..22ed427 100644 --- a/backend/app/services/llm/deepseek_client.py +++ b/backend/app/services/llm/deepseek_client.py @@ -116,14 +116,17 @@ class DeepSeekClient(BaseLLMClient): with self._client.stream("POST", "/chat/completions", json=payload) as response: response.raise_for_status() for line in response.iter_lines(): - if not line or line.startswith(b":"): + if not line: continue - line_str = line.decode("utf-8").strip() - if not line_str.startswith("data: "): + line = line.strip() + if line.startswith(":"): continue - data_str = line_str[6:] + if not line.startswith("data: "): + continue + + data_str = line[6:] if data_str == "[DONE]": break