This commit is contained in:
恍兮惚兮 2024-08-01 19:41:47 +08:00
parent f2d9473ffe
commit eb1f499ce4
2 changed files with 9 additions and 2 deletions

View File

@ -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(

View File

@ -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"])