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