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")