Fall back to 4.1 or 4o when refused
This commit is contained in:
parent
7391eaae59
commit
7d5f88d5ce
2 changed files with 3 additions and 4 deletions
|
|
@ -218,8 +218,6 @@ def translateText(system, user, history, penalty, formatType, model):
|
||||||
# Content to TL
|
# Content to TL
|
||||||
msg.append({"role": "user", "content": f"```\n{user}\n```"})
|
msg.append({"role": "user", "content": f"```\n{user}\n```"})
|
||||||
response = openai.chat.completions.create(
|
response = openai.chat.completions.create(
|
||||||
temperature=0,
|
|
||||||
frequency_penalty=penalty,
|
|
||||||
model=model,
|
model=model,
|
||||||
response_format=responseFormat,
|
response_format=responseFormat,
|
||||||
messages=msg,
|
messages=msg,
|
||||||
|
|
@ -389,10 +387,10 @@ def translateAI(text, history, fullPromptFlag, config, filename=None, pbar=None,
|
||||||
translatedText = response.choices[0].message.content
|
translatedText = response.choices[0].message.content
|
||||||
|
|
||||||
# Retry if AI refused
|
# Retry if AI refused
|
||||||
if not translatedText:
|
if not translatedText or '"error":' in translatedText:
|
||||||
response = translateText(
|
response = translateText(
|
||||||
f"{system}\n You translate ALL content.",
|
f"{system}\n You translate ALL content.",
|
||||||
user, history, 0.1, formatType, "gpt-4o"
|
user, history, 0.1, formatType, "gpt-4.1" if config.model == "gpt-5" else "gpt-4o"
|
||||||
)
|
)
|
||||||
translatedText = response.choices[0].message.content
|
translatedText = response.choices[0].message.content
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ Here are some vocabulary and terms so that you know the proper spelling and tran
|
||||||
ユキノ (Yukino) - Female
|
ユキノ (Yukino) - Female
|
||||||
ツバサ (Tsubasa) - Female
|
ツバサ (Tsubasa) - Female
|
||||||
ハルカ (Haruka) - Female
|
ハルカ (Haruka) - Female
|
||||||
|
まゆ (Mayu) - Female
|
||||||
|
|
||||||
# Lewd Terms
|
# Lewd Terms
|
||||||
マンコ (pussy)
|
マンコ (pussy)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue