From b03d00d30d9b1b411977463dcaf0f7ca5ea8ba38 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: Wed, 4 Sep 2024 10:21:27 +0800 Subject: [PATCH] sakura --- LunaTranslator/LunaTranslator/translator/sakura.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LunaTranslator/LunaTranslator/translator/sakura.py b/LunaTranslator/LunaTranslator/translator/sakura.py index bd41a557..fcccbce9 100644 --- a/LunaTranslator/LunaTranslator/translator/sakura.py +++ b/LunaTranslator/LunaTranslator/translator/sakura.py @@ -192,6 +192,8 @@ class TS(basetrans): if not output.headers["Content-Type"].startswith("text/event-stream"): raise Exception(output.text) for o in output.iter_lines(): + if o == b"data: [DONE]": + break try: res = o.decode("utf-8").strip()[6:] # .replace("data: ", "") # print(res)