Fall back to 4.1 or 4o when refused

This commit is contained in:
dazedanon 2025-08-07 16:48:42 -05:00
parent 7391eaae59
commit 7d5f88d5ce
2 changed files with 3 additions and 4 deletions

View file

@ -218,8 +218,6 @@ def translateText(system, user, history, penalty, formatType, model):
# Content to TL
msg.append({"role": "user", "content": f"```\n{user}\n```"})
response = openai.chat.completions.create(
temperature=0,
frequency_penalty=penalty,
model=model,
response_format=responseFormat,
messages=msg,
@ -389,10 +387,10 @@ def translateAI(text, history, fullPromptFlag, config, filename=None, pbar=None,
translatedText = response.choices[0].message.content
# Retry if AI refused
if not translatedText:
if not translatedText or '"error":' in translatedText:
response = translateText(
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

View file

@ -5,6 +5,7 @@ Here are some vocabulary and terms so that you know the proper spelling and tran
ユキノ (Yukino) - Female
ツバサ (Tsubasa) - Female
ハルカ (Haruka) - Female
まゆ (Mayu) - Female
# Lewd Terms
マンコ (pussy)