Check for AI Refusal
This commit is contained in:
parent
7f936b58a3
commit
a2a4c15e3b
13 changed files with 149 additions and 10 deletions
|
|
@ -79,7 +79,7 @@ def handleCSV(filename, estimate):
|
|||
ESTIMATE = estimate
|
||||
|
||||
if not ESTIMATE:
|
||||
with open("translated/" + filename, "w+t", newline="", encoding=ENCODING) as writeFile:
|
||||
with open("translated/" + filename, "w+t", newline="", encoding=ENCODING, errors="xmlcharrefreplace") as writeFile:
|
||||
# Translate
|
||||
start = time.time()
|
||||
translatedData = openFiles(filename, writeFile)
|
||||
|
|
@ -113,7 +113,7 @@ def handleCSV(filename, estimate):
|
|||
|
||||
|
||||
def openFiles(filename, writeFile):
|
||||
with open("files/" + filename, "r", encoding="cp932", errors="ignore") as readFile, writeFile:
|
||||
with open("files/" + filename, "r", encoding=ENCODING) as readFile, writeFile:
|
||||
translatedData = parseCSV(readFile, writeFile, filename)
|
||||
|
||||
return translatedData
|
||||
|
|
@ -185,7 +185,7 @@ def parseCSV(readFile, writeFile, filename):
|
|||
|
||||
reader = csv.reader(readFile, delimiter=",")
|
||||
if not ESTIMATE:
|
||||
writer = csv.writer(writeFile, delimiter=",")
|
||||
writer = csv.writer(writeFile, delimiter=",", )
|
||||
else:
|
||||
writer = ""
|
||||
|
||||
|
|
@ -660,6 +660,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -525,6 +525,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -569,6 +569,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -584,6 +584,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -508,6 +508,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -2591,6 +2591,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ if "gpt-3.5" in MODEL:
|
|||
elif "gpt-4" in MODEL:
|
||||
INPUTAPICOST = 0.0025
|
||||
OUTPUTAPICOST = 0.01
|
||||
BATCHSIZE = 60
|
||||
BATCHSIZE = 30
|
||||
FREQUENCY_PENALTY = 0.05
|
||||
else:
|
||||
INPUTAPICOST = float(os.getenv("input_cost"))
|
||||
|
|
@ -77,10 +77,10 @@ LEAVE = False
|
|||
# Dialogue / Scroll / Choices (Main Codes)
|
||||
CODE401 = True
|
||||
CODE405 = True
|
||||
CODE102 = False
|
||||
CODE102 = True
|
||||
|
||||
# Optional
|
||||
CODE101 = True # Turn this one when names exist in 101
|
||||
CODE101 = False # Turn this one when names exist in 101
|
||||
CODE408 = False # Warning, translates comments and can inflate costs.
|
||||
|
||||
# Variables
|
||||
|
|
@ -2702,6 +2702,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -784,6 +784,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -497,6 +497,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -571,6 +571,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -2373,6 +2373,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
|
|
@ -536,6 +536,14 @@ def translateGPT(text, history, fullPromptFlag):
|
|||
|
||||
# Translating
|
||||
response = translateText(system, user, history, 0.05, format)
|
||||
|
||||
# AI Refused. Try Again
|
||||
if not response:
|
||||
response = translateText(system, user, history, 0.05, format, MODEL)
|
||||
if not response:
|
||||
continue
|
||||
|
||||
# Set Tokens
|
||||
translatedText = response.choices[0].message.content
|
||||
totalTokens[0] += response.usage.prompt_tokens
|
||||
totalTokens[1] += response.usage.completion_tokens
|
||||
|
|
|
|||
51
vocab.txt
51
vocab.txt
|
|
@ -1,10 +1,10 @@
|
|||
Here are some vocabulary and terms so that you know the proper spelling and translation.
|
||||
```
|
||||
# Game Characters
|
||||
ジョフ (Joff) - Male
|
||||
ミラ (Mira) - Female
|
||||
ルマ (Ruma) - Female
|
||||
チェーカ (Cheka) - Female
|
||||
イルミナ (Lumina) - Female
|
||||
セラ (Sera) - Female
|
||||
リアン (Lian) - Female
|
||||
イニス (Inis) - Female
|
||||
|
||||
# Lewd Terms
|
||||
マンコ (pussy)
|
||||
|
|
@ -99,4 +99,47 @@ w ((lol))
|
|||
# Locations
|
||||
サイノ河 (Saino River)
|
||||
オソレ峠 一幕 (Osore Pass Act One)
|
||||
|
||||
#Skills
|
||||
ヒール (Heal)
|
||||
ファイア (Fire)
|
||||
スパーク (Spark)
|
||||
アーマーブレイク (Armor Break)
|
||||
チートアタック (Cheat Attack)
|
||||
ゴブリン拘束攻撃 (Goblin Restraint Attack)
|
||||
ゴブリン拘束攻撃バックアップ (Goblin Restraint Attack Backup)
|
||||
■↓イルミナの技↓■ (■↓Lumina's Skills↓■)
|
||||
ホーリーインパクト (Holy Impact)
|
||||
セイントアロー (Saint Arrow)
|
||||
ホーリーインパクトII (Holy Impact II)
|
||||
セイントアローII (Saint Arrow II)
|
||||
ヒール (Heal)
|
||||
クリアウィンド (Clear Wind)
|
||||
エクスプロージョン (Explosion)
|
||||
アンチマジック (Anti-Magic)
|
||||
リザレクション (Resurrection)
|
||||
リジェネ (Regen)
|
||||
ルミナス・ゲイル (Luminous Gale)
|
||||
プロメテウスバースト (Prometheus Burst)
|
||||
コキュートス (Cocytus)
|
||||
ディエス・イラ (Dies Irae)
|
||||
■インフェリアード行動■ (■ Inferiard Actions ■)
|
||||
ブロッサムスラッシュ (Blossom Slash)
|
||||
ラッシュオブアイビー (Rush of Ivy)
|
||||
デバウアーブロッサム (Devour Blossom)
|
||||
■マクスウェル行動■ (■ Maxwell Actions ■)
|
||||
チャージ (Charge)
|
||||
サンダーフォース (Thunder Force)
|
||||
オーバードライブ・キャノン (Overdrive Cannon)
|
||||
マシンガン (Machine Gun)
|
||||
■ナイトメア (■ Nightmare)
|
||||
イントロイトゥス (Introitus)
|
||||
タルタロス・ハウル (Tartarus Howl)
|
||||
ユーディキウム (Eudicium)
|
||||
ソムニウム・シネフィーネ (Somnium Cinefine)
|
||||
ラクリモーサ (Lacrimosa)
|
||||
モルス・ウルティマ (Mors Ultima)
|
||||
リベラ・メ (Libera Me)
|
||||
ディエス・イレ (Dies Irae)
|
||||
乱舞 (Wild Dance)
|
||||
```
|
||||
Loading…
Reference in a new issue