处理表格问题和数据不一致的问题
This commit is contained in:
parent
8ca4a424f8
commit
aa4e05f539
@ -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}) # 翻译结果不匹配
|
||||
|
||||
@ -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 _:
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
<div class="demo-split-pane no-padding" style="margin-top: 10px ; margin-left: 10px; margin-right: 10px">
|
||||
<Card style="height: 95vh;">
|
||||
<template #title>翻译数据</template>
|
||||
<Table size="small" border stripe :columns="table_column" :data="translate_data">
|
||||
<Table :height="table_height" size="small" border stripe :columns="table_column" :data="translate_data">
|
||||
<template #name="{ row }">
|
||||
<strong>
|
||||
<Text :delete="!row.active">{{ row.source }}</Text>
|
||||
@ -126,6 +126,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
html_split: 0.45,
|
||||
table_height: 0,
|
||||
disclaimers_placeholder: "该项目仅供学习使用,请勿用于商业用途和非法用途",
|
||||
input_textarea_placeholder: "请输入Tag文本, 以中文符号或英文符号[,]为分隔符",
|
||||
input_translate_text: "1girl,solo, long hair, looking at viewer, white hair",
|
||||
@ -148,7 +149,18 @@ export default {
|
||||
],
|
||||
translate_data: []
|
||||
}
|
||||
}, methods: {
|
||||
},
|
||||
mounted() {
|
||||
this.update_page_height();
|
||||
window.addEventListener('resize', this.update_page_height);
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.update_page_height);
|
||||
},
|
||||
methods: {
|
||||
update_page_height() {
|
||||
this.table_height = window.innerHeight * 0.8;
|
||||
},
|
||||
on_click_reset_all_message() {
|
||||
this.readonly_result_text = '';
|
||||
this.readonly_result_text_translate = '';
|
||||
@ -190,6 +202,7 @@ export default {
|
||||
this.is_network_loading = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
network_on_call_server_rewrite(index) {
|
||||
if (!this.local_on_network_is_loading()) {
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user