diff --git a/LunaTranslator/LunaTranslator/translator/basetranslator.py b/LunaTranslator/LunaTranslator/translator/basetranslator.py index 79a79ede..17993f67 100644 --- a/LunaTranslator/LunaTranslator/translator/basetranslator.py +++ b/LunaTranslator/LunaTranslator/translator/basetranslator.py @@ -342,12 +342,16 @@ class basetrans(commonbase): for _ in optimization_params: if isinstance(_, dict): _gpt_dict = _.get("gpt_dict", None) - if not _gpt_dict: + if _gpt_dict is None: continue gpt_dict = _gpt_dict contentsolved = json.dumps( - {"text": contentsolved, "gpt_dict": gpt_dict} + { + "text": contentsolved, + "gpt_dict": gpt_dict, + "contentraw": contentraw, + } ) func = functools.partial( diff --git a/LunaTranslator/LunaTranslator/translator/sakura.py b/LunaTranslator/LunaTranslator/translator/sakura.py index d860cc2f..bd5d57a4 100644 --- a/LunaTranslator/LunaTranslator/translator/sakura.py +++ b/LunaTranslator/LunaTranslator/translator/sakura.py @@ -194,7 +194,10 @@ class TS(basetrans): def translate(self, query): query = json.loads(query) gpt_dict = query["gpt_dict"] + contentraw = query["contentraw"] query = query["text"] + if gpt_dict is not None: + query = contentraw self.checkempty(["API接口地址"]) self.get_client(self.config["API接口地址"]) frequency_penalty = float(self.config["frequency_penalty"])