Fix bug that caused blank lines
This commit is contained in:
parent
bb1f50e4e5
commit
dcc788d66c
1 changed files with 9 additions and 6 deletions
|
|
@ -796,7 +796,7 @@ def searchCodes(page, pbar, fillList, filename):
|
||||||
break
|
break
|
||||||
|
|
||||||
## Event Code: 401 Show Text
|
## Event Code: 401 Show Text
|
||||||
if codeList[i]['code'] in [401, 405] and (CODE401 or CODE405):
|
if codeList[i]['code'] in [401, 405, -1] and (CODE401 or CODE405):
|
||||||
# Save Code and starting index (j)
|
# Save Code and starting index (j)
|
||||||
code = codeList[i]['code']
|
code = codeList[i]['code']
|
||||||
j = i
|
j = i
|
||||||
|
|
@ -836,6 +836,9 @@ def searchCodes(page, pbar, fillList, filename):
|
||||||
if finalJAString == '':
|
if finalJAString == '':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Set Back
|
||||||
|
codeList[i]['parameters'] = [finalJAString]
|
||||||
|
|
||||||
# Check for speakers in String
|
# Check for speakers in String
|
||||||
# \\n<Speaker>
|
# \\n<Speaker>
|
||||||
nCase = None
|
nCase = None
|
||||||
|
|
@ -1075,8 +1078,8 @@ def searchCodes(page, pbar, fillList, filename):
|
||||||
|
|
||||||
## Event Code: 357 [Picture Text] [Optional]
|
## Event Code: 357 [Picture Text] [Optional]
|
||||||
if codeList[i]['code'] == 357 and CODE357 is True:
|
if codeList[i]['code'] == 357 and CODE357 is True:
|
||||||
if 'message' in codeList[i]['parameters'][3]:
|
if 'text' in codeList[i]['parameters'][3]:
|
||||||
jaString = codeList[i]['parameters'][3]['message']
|
jaString = codeList[i]['parameters'][3]['text']
|
||||||
if not isinstance(jaString, str):
|
if not isinstance(jaString, str):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
@ -1101,7 +1104,7 @@ def searchCodes(page, pbar, fillList, filename):
|
||||||
finalJAString = re.sub(r'\n', ' ', finalJAString)
|
finalJAString = re.sub(r'\n', ' ', finalJAString)
|
||||||
|
|
||||||
# Translate
|
# Translate
|
||||||
response = translateGPT(finalJAString, '', True)
|
response = translateGPT(finalJAString, '', False)
|
||||||
totalTokens[0] += response[1][0]
|
totalTokens[0] += response[1][0]
|
||||||
totalTokens[1] += response[1][1]
|
totalTokens[1] += response[1][1]
|
||||||
translatedText = response[0]
|
translatedText = response[0]
|
||||||
|
|
@ -2127,9 +2130,9 @@ def translateText(characters, system, user, history):
|
||||||
|
|
||||||
# History
|
# History
|
||||||
if isinstance(history, list):
|
if isinstance(history, list):
|
||||||
msg.extend([{"role": "assistant", "content": h} for h in history])
|
msg.extend([{"role": "system", "content": h} for h in history])
|
||||||
else:
|
else:
|
||||||
msg.append({"role": "assistant", "content": history})
|
msg.append({"role": "system", "content": history})
|
||||||
|
|
||||||
# Content to TL
|
# Content to TL
|
||||||
msg.append({"role": "user", "content": f'{user}'})
|
msg.append({"role": "user", "content": f'{user}'})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue