From eb75096b5123dc329da28cae956c178bea2c9cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 30 Jul 2024 20:54:06 +0800 Subject: [PATCH] . --- LunaTranslator/LunaTranslator/translator/gptcommon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LunaTranslator/LunaTranslator/translator/gptcommon.py b/LunaTranslator/LunaTranslator/translator/gptcommon.py index 8ef1d2bb..6c7f3d3b 100644 --- a/LunaTranslator/LunaTranslator/translator/gptcommon.py +++ b/LunaTranslator/LunaTranslator/translator/gptcommon.py @@ -84,6 +84,8 @@ class gptcommon(basetrans): response_data = chunk.decode("utf-8").strip() if not response_data: continue + if response_data == "data: [DONE]": + break try: json_data = json.loads(response_data[6:]) rs = json_data["choices"][0].get("finish_reason")