From 300a7fbfd666a9ea3a3aaeffd51ff0d0875b75ec Mon Sep 17 00:00:00 2001 From: taylorxie Date: Mon, 9 Mar 2026 22:53:24 +0800 Subject: [PATCH] add --- maubot_llmplus/thrid_platform.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maubot_llmplus/thrid_platform.py b/maubot_llmplus/thrid_platform.py index 7f0bddd..3aa74ac 100644 --- a/maubot_llmplus/thrid_platform.py +++ b/maubot_llmplus/thrid_platform.py @@ -184,15 +184,15 @@ class Anthropic(Platform): async with self.http.post(endpoint, headers=headers, data=json.dumps(req_body)) as response: if response.status != 200: raise ValueError(f"Error: {await response.text()}") - async for line_bytes in response.content: + async for line_bytes in response.content.iter_lines(): line = line_bytes.decode("utf-8").strip() if not line.startswith("data: "): continue data_str = line[6:] - if data_str == "[DONE]": - break try: data = json.loads(data_str) + if data.get("type") == "message_stop": + break if data.get("type") == "content_block_delta": delta = data.get("delta", {}) if delta.get("type") == "text_delta":