Hopefully solve some consistency issues with tags
This commit is contained in:
parent
2488cf5933
commit
dd841891d4
1 changed files with 5 additions and 5 deletions
|
|
@ -1965,7 +1965,7 @@ Output ONLY the {LANGUAGE} translation in the following format: `Translation: <{
|
||||||
user = f'{subbedT}'
|
user = f'{subbedT}'
|
||||||
return characters, system, user
|
return characters, system, user
|
||||||
|
|
||||||
def translateText(characters, system, user, history):
|
def translateText(characters, system, user, history, penalty):
|
||||||
# Prompt
|
# Prompt
|
||||||
msg = [{"role": "system", "content": system + characters}]
|
msg = [{"role": "system", "content": system + characters}]
|
||||||
|
|
||||||
|
|
@ -1981,8 +1981,8 @@ def translateText(characters, system, user, history):
|
||||||
# Content to TL
|
# Content to TL
|
||||||
msg.append({"role": "user", "content": f'{user}'})
|
msg.append({"role": "user", "content": f'{user}'})
|
||||||
response = openai.chat.completions.create(
|
response = openai.chat.completions.create(
|
||||||
temperature=0.1,
|
temperature=0,
|
||||||
frequency_penalty=0.1,
|
frequency_penalty=penalty,
|
||||||
model=MODEL,
|
model=MODEL,
|
||||||
messages=msg,
|
messages=msg,
|
||||||
)
|
)
|
||||||
|
|
@ -2091,7 +2091,7 @@ def translateGPT(text, history, fullPromptFlag):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Translating
|
# Translating
|
||||||
response = translateText(characters, system, user, history)
|
response = translateText(characters, system, user, history, 0)
|
||||||
translatedText = response.choices[0].message.content
|
translatedText = response.choices[0].message.content
|
||||||
totalTokens[0] += response.usage.prompt_tokens
|
totalTokens[0] += response.usage.prompt_tokens
|
||||||
totalTokens[1] += response.usage.completion_tokens
|
totalTokens[1] += response.usage.completion_tokens
|
||||||
|
|
@ -2103,7 +2103,7 @@ def translateGPT(text, history, fullPromptFlag):
|
||||||
tList[index] = extractedTranslations
|
tList[index] = extractedTranslations
|
||||||
if len(tItem) != len(extractedTranslations):
|
if len(tItem) != len(extractedTranslations):
|
||||||
# Mismatch. Try Again
|
# Mismatch. Try Again
|
||||||
response = translateText(characters, system, user, history)
|
response = translateText(characters, system, user, history, 0.05)
|
||||||
translatedText = response.choices[0].message.content
|
translatedText = response.choices[0].message.content
|
||||||
totalTokens[0] += response.usage.prompt_tokens
|
totalTokens[0] += response.usage.prompt_tokens
|
||||||
totalTokens[1] += response.usage.completion_tokens
|
totalTokens[1] += response.usage.completion_tokens
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue