diff --git a/modules/alice.py b/modules/alice.py index 184a9a9..5a814a1 100644 --- a/modules/alice.py +++ b/modules/alice.py @@ -558,12 +558,6 @@ def countTokens(characters, system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): totalTokens = [0, 0] @@ -616,8 +610,12 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation("\n".join(translatedTextList), False) tList[index] = extractedTranslations + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/anim.py b/modules/anim.py index f582c56..4c5d8ff 100644 --- a/modules/anim.py +++ b/modules/anim.py @@ -499,12 +499,6 @@ def countTokens(characters, system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): mismatch = False @@ -575,8 +569,12 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/csv.py b/modules/csv.py index 920756c..0fe6272 100644 --- a/modules/csv.py +++ b/modules/csv.py @@ -529,12 +529,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -625,8 +619,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/eushully.py b/modules/eushully.py index 8693e01..051051f 100644 --- a/modules/eushully.py +++ b/modules/eushully.py @@ -660,12 +660,6 @@ def countTokens(characters, system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR @@ -743,8 +737,12 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/images.py b/modules/images.py index a440b08..bf8037a 100644 --- a/modules/images.py +++ b/modules/images.py @@ -539,12 +539,6 @@ def countTokens(characters, system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR @@ -625,8 +619,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/irissoft.py b/modules/irissoft.py index a9119c6..5b473c8 100644 --- a/modules/irissoft.py +++ b/modules/irissoft.py @@ -682,12 +682,6 @@ def countTokens(characters, system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag, pbar, filename): mismatch = False @@ -759,8 +753,12 @@ def translateGPT(text, history, fullPromptFlag, pbar, filename): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/javascript.py b/modules/javascript.py index 2ecca25..576feb5 100644 --- a/modules/javascript.py +++ b/modules/javascript.py @@ -457,12 +457,6 @@ def countTokens(characters, system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag, pbar): mismatch = False @@ -533,8 +527,12 @@ def translateGPT(text, history, fullPromptFlag, pbar): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/json.py b/modules/json.py index b883aa1..42f2a0f 100644 --- a/modules/json.py +++ b/modules/json.py @@ -470,12 +470,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -566,8 +560,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/kansen.py b/modules/kansen.py index 0219ef9..eb14a4a 100644 --- a/modules/kansen.py +++ b/modules/kansen.py @@ -655,12 +655,6 @@ def countTokens(characters, system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): totalTokens = [0, 0] @@ -713,8 +707,12 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation("\n".join(translatedTextList), False) tList[index] = extractedTranslations + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/kirikiri.py b/modules/kirikiri.py index e3ca91a..66f2ab1 100644 --- a/modules/kirikiri.py +++ b/modules/kirikiri.py @@ -513,12 +513,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -609,8 +603,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/lune.py b/modules/lune.py index aac0cdc..6fe5804 100644 --- a/modules/lune.py +++ b/modules/lune.py @@ -505,12 +505,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -593,8 +587,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/nscript.py b/modules/nscript.py index 6a81f68..12a2d85 100644 --- a/modules/nscript.py +++ b/modules/nscript.py @@ -529,12 +529,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -625,8 +619,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/regex.py b/modules/regex.py index 9a1ec24..04662d4 100644 --- a/modules/regex.py +++ b/modules/regex.py @@ -529,12 +529,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -627,8 +621,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/renpy.py b/modules/renpy.py index af588d5..35e1b9a 100644 --- a/modules/renpy.py +++ b/modules/renpy.py @@ -453,12 +453,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -549,8 +543,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/rpgmakerace.py b/modules/rpgmakerace.py index 4e714f4..f807bd0 100644 --- a/modules/rpgmakerace.py +++ b/modules/rpgmakerace.py @@ -2585,12 +2585,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -2681,8 +2675,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index aefdd9b..3c5a676 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -2574,12 +2574,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -2670,8 +2664,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/rpgmakerplugin.py b/modules/rpgmakerplugin.py index aa18cc0..6cbf698 100644 --- a/modules/rpgmakerplugin.py +++ b/modules/rpgmakerplugin.py @@ -444,12 +444,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -540,8 +534,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/text.py b/modules/text.py index cba7b7e..8f4c84b 100644 --- a/modules/text.py +++ b/modules/text.py @@ -444,12 +444,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -540,8 +534,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/tyrano.py b/modules/tyrano.py index 1d5c702..e9ed2c9 100644 --- a/modules/tyrano.py +++ b/modules/tyrano.py @@ -520,12 +520,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -616,8 +610,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/unity.py b/modules/unity.py index 863a68f..5f9df23 100644 --- a/modules/unity.py +++ b/modules/unity.py @@ -466,12 +466,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -554,8 +548,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/wolf.py b/modules/wolf.py index fdc9a15..0f8b555 100644 --- a/modules/wolf.py +++ b/modules/wolf.py @@ -2382,12 +2382,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -2478,8 +2472,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens] diff --git a/modules/wolf2.py b/modules/wolf2.py index 7a0f323..ac93d66 100644 --- a/modules/wolf2.py +++ b/modules/wolf2.py @@ -487,12 +487,6 @@ def countTokens(system, user, history): return [inputTotalTokens, outputTotalTokens] -def combineList(tlist, text): - if isinstance(text, list): - return [t for sublist in tlist for t in sublist] - return tlist[0] - - @retry(exceptions=Exception, tries=5, delay=5) def translateGPT(text, history, fullPromptFlag): global PBAR, MISMATCH, FILENAME @@ -583,8 +577,12 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") + # Combine if multilist + if isinstance(tList[0], list): + tList = [t for sublist in tList for t in sublist] + + # Return if format == "json": - finalList = combineList(tList, text) - return [finalList, totalTokens] + return [tList, totalTokens] else: return [tList[0], totalTokens]