From aa4e05f53997c8edbd8d6d0e101dd2418153cfa0 Mon Sep 17 00:00:00 2001 From: mnjnhuang <1090031856@qq.com> Date: Thu, 15 Jan 2026 02:27:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=A1=A8=E6=A0=BC=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=92=8C=E6=95=B0=E6=8D=AE=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/model/TencentCloud.py | 6 ++++-- python/routers/translate_with_ai.py | 2 +- .../src/views/TableVersion.vue | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/python/model/TencentCloud.py b/python/model/TencentCloud.py index ebf666c..279fc61 100644 --- a/python/model/TencentCloud.py +++ b/python/model/TencentCloud.py @@ -15,10 +15,12 @@ class TencentCloud(TranslateParent): def translate_text_with_ai(self, goto_translate_map: dict, target_language: str = "zh") -> dict: # AI大模型翻译 return_false_code = {"status": False, "code": 10500} + if len(goto_translate_map) == 0: + return {"status": True, "translate_map": {}} use_model = "hunyuan-translation" rebuild_text = "" rebuild_list = [] - use_field = "AI/SD generated image prompt" + use_field = "AI/SD generated image prompt, Do not reduce or increase any punctuation" for one_prompt in goto_translate_map.keys(): rebuild_list.append(one_prompt) rebuild_text += f"{one_prompt}, " @@ -49,7 +51,7 @@ class TencentCloud(TranslateParent): return return_false_code else: if len(translate_prompt_list) != len(goto_translate_map): - print("翻译结果不匹配") + print("翻译结果不匹配: ", len(translate_prompt_list), len(goto_translate_map)) print("source", list(goto_translate_map.keys())) print("translate", translate_prompt_list) return_false_code.update({"code": 10502}) # 翻译结果不匹配 diff --git a/python/routers/translate_with_ai.py b/python/routers/translate_with_ai.py index 70a0b7d..c0a44d0 100644 --- a/python/routers/translate_with_ai.py +++ b/python/routers/translate_with_ai.py @@ -86,7 +86,7 @@ class OverwriteServerHandler(ServerHandler): match request_handler.translate_model: case "TencentModelAI": - tencent_cloud: TranslateParent = TencentCloud() + tencent_cloud: TencentCloud = TencentCloud() response_dict: dict = tencent_cloud.translate_text_with_ai(goto_translate_map=goto_ai_translate_map) translate_network_map: dict = response_dict["translate_map"] case _: diff --git a/view-ui-project-vite-main/src/views/TableVersion.vue b/view-ui-project-vite-main/src/views/TableVersion.vue index 0539d58..81a79e4 100644 --- a/view-ui-project-vite-main/src/views/TableVersion.vue +++ b/view-ui-project-vite-main/src/views/TableVersion.vue @@ -71,7 +71,7 @@
- +