From e8842fcd996ea8a165fd7d4f18f41b7b74882416 Mon Sep 17 00:00:00 2001 From: test123456654321 <16307130148@fudan.edu.cn> Date: Sat, 26 Oct 2024 01:50:23 +0800 Subject: [PATCH] issues/1120 --- src/LunaTranslator/LunaTranslator.py | 10 +++++++++- src/LunaTranslator/translator/premt.py | 3 --- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/LunaTranslator/LunaTranslator.py b/src/LunaTranslator/LunaTranslator.py index bf743bb3..f3e672c1 100644 --- a/src/LunaTranslator/LunaTranslator.py +++ b/src/LunaTranslator/LunaTranslator.py @@ -379,7 +379,15 @@ class MAINUI: if "premt" in self.translators: try: - maybehaspremt = self.translators["premt"].translate(text_solved) + contentraw = text_solved + for _ in optimization_params: + if isinstance(_, dict): + _gpt_dict = _.get("gpt_dict", None) + if _gpt_dict is None: + continue + contentraw = _.get("gpt_dict_origin") + + maybehaspremt = self.translators["premt"].translate(contentraw) except: print_exc() other = list(set(maybehaspremt.keys()) - set(fix_rank)) diff --git a/src/LunaTranslator/translator/premt.py b/src/LunaTranslator/translator/premt.py index d6b364d8..e63237db 100644 --- a/src/LunaTranslator/translator/premt.py +++ b/src/LunaTranslator/translator/premt.py @@ -36,9 +36,6 @@ class TS(basetrans): ) def translate(self, content): - query = json.loads(content) - content = query["contentraw"] - self.checkfilechanged( self.unsafegetcurrentgameconfig(), self.config["sqlitefile"] )