From cf9ced3931ff4abd51733869a81e88eb44baa4fd 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: Fri, 2 Aug 2024 23:56:07 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/translator/sakura.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LunaTranslator/LunaTranslator/translator/sakura.py b/LunaTranslator/LunaTranslator/translator/sakura.py index e7b9b428..cd5cb327 100644 --- a/LunaTranslator/LunaTranslator/translator/sakura.py +++ b/LunaTranslator/LunaTranslator/translator/sakura.py @@ -292,7 +292,7 @@ class TS(basetrans): output_text = "" for o in output: if o["choices"][0]["finish_reason"] == None: - text_partial = o["choices"][0]["delta"]["content"] + text_partial = o["choices"][0]["delta"].get("content", "") output_text += text_partial yield text_partial completion_tokens += 1