diff --git a/modules/alice.py b/modules/alice.py
index d4629c6..a880cb0 100644
--- a/modules/alice.py
+++ b/modules/alice.py
@@ -459,10 +459,10 @@ def cleanTranslatedText(translatedText, varResponse):
translatedText = translatedText.replace(target, replacement)
translatedText = resubVars(translatedText, varResponse[1])
- return [line for line in translatedText.split('\n') if line]
+ return [line for line in translatedText.split('\\n') if line]
def extractTranslation(translatedTextList, is_list):
- pattern = r'(.*)'
+ pattern = r'[\\]*`?(.*?)[\\]*?`?'
# If it's a batch (i.e., list), extract with tags; otherwise, return the single item.
if is_list:
return [re.findall(pattern, line)[0][1] for line in translatedTextList if re.search(pattern, line)]
@@ -506,7 +506,7 @@ def translateGPT(text, history, fullPromptFlag):
for index, tItem in enumerate(tList):
# Before sending to translation, if we have a list of items, add the formatting
if isinstance(tItem, list):
- payload = '\n'.join([f'{item}' for i, item in enumerate(tItem)])
+ payload = '\\n'.join([f'\`{item}\`' for i, item in enumerate(tItem)])
varResponse = subVars(payload)
subbedT = varResponse[0]
else:
@@ -538,10 +538,12 @@ def translateGPT(text, history, fullPromptFlag):
if isinstance(tItem, list):
extractedTranslations = extractTranslation(translatedTextList, True)
tList[index] = extractedTranslations
+ if len(tList[index]) != len(translatedTextList):
+ print('Test')
history = extractedTranslations[-10:] # Update history if we have a list
else:
# Ensure we're passing a single string to extractTranslation
- extractedTranslations = extractTranslation('\n'.join(translatedTextList), False)
+ extractedTranslations = extractTranslation('\\n'.join(translatedTextList), False)
tList[index] = extractedTranslations
finalList = combineList(tList, text)
diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py
index 8b5c9bd..f97cbf1 100644
--- a/modules/rpgmakermvmz.py
+++ b/modules/rpgmakermvmz.py
@@ -1868,6 +1868,9 @@ def translateText(characters, system, user, history):
# Prompt
msg = [{"role": "system", "content": system + characters}]
+ # Characters
+ msg.append({"role": "system", "content": characters})
+
# History
if isinstance(history, list):
msg.extend([{"role": "assistant", "content": h} for h in history])
@@ -1897,10 +1900,10 @@ def cleanTranslatedText(translatedText, varResponse):
translatedText = translatedText.replace(target, replacement)
translatedText = resubVars(translatedText, varResponse[1])
- return [line for line in translatedText.split('\n') if line]
+ return [line for line in translatedText.split('\\n') if line]
def extractTranslation(translatedTextList, is_list):
- pattern = r'?(.*)'
+ pattern = r'[\\]*`?(.*?)[\\]*?`?'
# If it's a batch (i.e., list), extract with tags; otherwise, return the single item.
if is_list:
return [re.findall(pattern, line)[0][1] for line in translatedTextList if re.search(pattern, line)]
@@ -1944,7 +1947,7 @@ def translateGPT(text, history, fullPromptFlag):
for index, tItem in enumerate(tList):
# Before sending to translation, if we have a list of items, add the formatting
if isinstance(tItem, list):
- payload = '\n'.join([f'{item}' for i, item in enumerate(tItem)])
+ payload = '\\n'.join([f'\`{item}\`' for i, item in enumerate(tItem)])
varResponse = subVars(payload)
subbedT = varResponse[0]
else:
@@ -1981,7 +1984,7 @@ def translateGPT(text, history, fullPromptFlag):
history = extractedTranslations[-10:] # Update history if we have a list
else:
# Ensure we're passing a single string to extractTranslation
- extractedTranslations = extractTranslation('\n'.join(translatedTextList), False)
+ extractedTranslations = extractTranslation('\\n'.join(translatedTextList), False)
tList[index] = extractedTranslations
finalList = combineList(tList, text)