This commit is contained in:
恍兮惚兮 2024-08-01 19:28:41 +08:00
parent 4b2cb0e2e4
commit f2d9473ffe

View File

@ -1,6 +1,6 @@
from translator.basetranslator import basetrans from translator.basetranslator import basetrans
import requests import requests
import json import json, zhconv
# OpenAI # OpenAI
# from openai import OpenAI # from openai import OpenAI
@ -106,6 +106,8 @@ class TS(basetrans):
content = "" content = ""
gpt_dict_raw_text = self.make_gpt_dict_text(gpt_dict) gpt_dict_raw_text = self.make_gpt_dict_text(gpt_dict)
if self.needzhconv:
gpt_dict_raw_text = zhconv.convert(gpt_dict_raw_text, "zh-tw")
content += "根据以下术语表(可以为空):\n" + gpt_dict_raw_text + "\n\n" content += "根据以下术语表(可以为空):\n" + gpt_dict_raw_text + "\n\n"
content += ( content += (