CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

Tool RPGM DazedMTLTool - A tool that provides quality MTL translations using ChatGPT

dazedanon

Engaged Member
Modder
Uploader
Donor
Jul 24, 2017
2,534
28,600
Ah I got that error too on the last pubilcly released version of Python 3.11 (Python 3.11.9 which released last month or so I believe), so it seems f-strings now support single quotes when they use single quotes too huh? Nice nice!

For me, I simply edited the code by changing the ' into " for name.
Another line I had to remove the f-string unfortunately...I'll look into upgrading Python alright!

Are you using Python 12 or the newly released Python 13 dazedanon ?
I'm still on 12.
 

mario6714

Member
Jun 22, 2020
392
231
Ah I like to share this since I just started using your tool dazedanon some days ago!
There's a project called gpt4free which has chatgpt-4o API for free which I've been using!
They have multiple models (not just 4o) and it works really well!

However you'll have to edit the "extractTranslation" part of the dazedanon's dazedMTL modules code because sometimes the
response from the api has this in it's response:
Code:
 json {
"Line1": "Kisaragi Merrie\n\"This place\nlooks like some kind of shop~♡\"",
"Line2": "Kisaragi Merrie\n\"If I had money, maybe I could buy something~♡\""
}
The issue being that "json" is the first line in the response (instead of starting with Line1), you'll get this error " extractTranslation Error: Expecting value: line 1 column 1 (char 0) on String" if you don't edit and add this code that I made!


Here's this code to make it work with extracting translations with that json as the first line, add it within the "extractTranslation" function:

Code:
        # Ensure that the string starts with '{' and ends with '}', if not, attempt to find the JSON part
        if not translatedTextList.strip().startswith("{") or not translatedTextList.strip().endswith("}"):
            # Attempt to extract JSON-like content within the curly braces
            PBAR.write(f"Attempting to extract valid JSON from: {translatedTextList}")
            json_start = translatedTextList.find("{")
            json_end = translatedTextList.rfind("}") + 1
            if json_start != -1 and json_end != -1:
                translatedTextList = translatedTextList[json_start:json_end]
            else:
                raise ValueError("No valid JSON content found")
If you're confused on where to add it, don't worry as I'll help ya out!
When you download the dazedMTL project, within the folder is called "modules".
Each module is made to translate various different games and formats!

So let's say you want to translate an RPGMaker MV/MZ game? Then you'll have to open the
"rpgmakermvmz.py" in a text editor like notepad++ (or notepad if you want), VSCode, etc and
then search for this text: "extractTranslation".

Once you find it, you'll have to insert the code I provided above within! Here's an example of my
edit of the currently updated rpgmakermvmz.py (as of writing this) function, and what it's supposed to look like:


Code:
def extractTranslation(translatedTextList, is_list):
    try:
        # Apply regex modifications as before
        translatedTextList = re.sub(r'\\"+\"([^,\n}])', r'\\"\1', translatedTextList)
        translatedTextList = re.sub(r"(?<![\\])\"+(?!\n)", r'"', translatedTextList)

        # Ensure that the string starts with '{' and ends with '}', if not, attempt to find the JSON part
        if not translatedTextList.strip().startswith("{") or not translatedTextList.strip().endswith("}"):
            # Attempt to extract JSON-like content within the curly braces
            PBAR.write(f"Attempting to extract valid JSON from: {translatedTextList}")
            json_start = translatedTextList.find("{")
            json_end = translatedTextList.rfind("}") + 1
            if json_start != -1 and json_end != -1:
                translatedTextList = translatedTextList[json_start:json_end]
            else:
                raise ValueError("No valid JSON content found")

        # Load the JSON response
        line_dict = json.loads(translatedTextList)
        # If it's a batch (i.e., list), extract with tags; otherwise, return the single item.

        # Extract the values
        string_list = list(line_dict.values())

        # Only print the raw response and detected translations when successful
        PBAR.write(f"Successfully detected translation: {string_list}")

        if is_list:
            return string_list
        else:
            return string_list[0]

    except Exception as e:
        # In case of an error, this block will already print out the raw input
        PBAR.write(f"extractTranslation Error: {e} on String {translatedTextList}")
        return None
Once this is added, you'll be able to use gpt4free's api with no issue!
Now I've tested translating an RPGMaker MZ game and the translation works great!
I had to edit some text when I was translating just the system.json file though (sometimes
the api doesn't simply translate and instead explains what the japanese line means in english.)

But for everything else, it's works wonders!

Okay if you want to try gpt4free if you don't want to pay for chatgpt-4o, here's my instructions on how to run it below!

Project Link:


Make sure to have python 3.11+ (3.10+ for just gpt4free, but 3.11+ needed for dazedanon's tool) installed!

If you want to install it and test it right now, simply type this in a terminal/console window:
"pip install gpt4free[api]"

This will install the api only of gpt4free, if you want everything else that gpt4free has (web ui, etc)
then check the project page above for further instructions on that!

Anyways once that's done, edit your .env and put this in for the api url:
"http://localhost:1337/v1/"

and as for API Key, just type in any number in it (it can't be empty otherwise nothing will work when using the api).
#API key
key="1111"


Next, as for what to type in model, you can use chatgpt-4o with this:
Code:
model="gpt-4o"
and if you want to try other models (o1 and o1-mini is currently not working, but in the future it may work as gpt4free is updated so you can switch to that once chatgpt o1 becomes more available.)

Here's a direct link with the list of models to try out, they're all openai compatible but I haven't tested them all:


Now run "g4f api" in your terminal/console and api should be up and running hopefully!
Then run dazedanon's tool and translate away!
Can you help me?

I have this errors:

docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f:latest

1730583856442.png


1
| | 0/? [00:00<?, ?it/s] Traceback (most recent call last):
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 1076, in searchCodes
response = getSpeaker(speaker)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2544, in getSpeaker
response = translateGPT(
f"{speaker}",
"Reply with the " + LANGUAGE + " translation of the NPC name.",
True,
)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\retry\api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
logger)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2807, in translateGPT
response = translateText(system, user, history, 0.05, format)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2654, in translateText
response = openai.chat.completions.create(
temperature=0,
...<3 lines>...
messages=msg,
)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_utils\_utils.py", line 303, in wrapper
return func(*args, **kwargs)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\resources\chat\completions.py", line 598, in create
return self._post(
~~~~~~~~~~^
"/chat/completions",
^^^^^^^^^^^^^^^^^^^^
...<28 lines>...
stream_cls=Stream[ChatCompletionChunk],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_base_client.py", line 1086, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_base_client.py", line 846, in request
return self._request(
~~~~~~~~~~~~~^
cast_to=cast_to,
^^^^^^^^^^^^^^^^
...<3 lines>...
remaining_retries=remaining_retries,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_base_client.py", line 898, in _request
raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'detail': 'Not Found'}
Traceback (most recent call last):
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 289, in parseMap
totalTokensFuture = future.result()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 401, in __get_result
raise self._exception
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2267, in searchCodes
raise Exception(str(e) + "Failed to translate: " + oldjaString) from None
Exception: Error code: 404 - {'detail': 'Not Found'}Failed to translate: \N<父>…そんな訳でしばらく家を空けることになった。
Traceback (most recent call last):
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 221, in getResultString
raise translatedData[2]
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 289, in parseMap
totalTokensFuture = future.result()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 401, in __get_result
raise self._exception
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2267, in searchCodes
raise Exception(str(e) + "Failed to translate: " + oldjaString) from None
Exception: Error code: 404 - {'detail': 'Not Found'}Failed to translate: \N<父>…そんな訳でしばらく家を空けることになった。
Map001.json: [Input: 0][Output: 0][Cost: $0.0000][20.9s] ✗ Error code: 404 - {'detail': 'Not Found'}Failed to translate: \N<父>…そんな訳でしばらく家を空けることになった。
TOTAL: [Input: 0][Output: 0][Cost: $0.0000][20.9s] ✓
 
  • Like
Reactions: Cutefunniness

Cutefunniness

Newbie
Jan 19, 2023
83
137
Can you help me?

I have this errors:

docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f:latest

View attachment 4194601


1
| | 0/? [00:00<?, ?it/s] Traceback (most recent call last):
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 1076, in searchCodes
response = getSpeaker(speaker)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2544, in getSpeaker
response = translateGPT(
f"{speaker}",
"Reply with the " + LANGUAGE + " translation of the NPC name.",
True,
)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\retry\api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
logger)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2807, in translateGPT
response = translateText(system, user, history, 0.05, format)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2654, in translateText
response = openai.chat.completions.create(
temperature=0,
...<3 lines>...
messages=msg,
)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_utils\_utils.py", line 303, in wrapper
return func(*args, **kwargs)
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\resources\chat\completions.py", line 598, in create
return self._post(
~~~~~~~~~~^
"/chat/completions",
^^^^^^^^^^^^^^^^^^^^
...<28 lines>...
stream_cls=Stream[ChatCompletionChunk],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_base_client.py", line 1086, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_base_client.py", line 846, in request
return self._request(
~~~~~~~~~~~~~^
cast_to=cast_to,
^^^^^^^^^^^^^^^^
...<3 lines>...
remaining_retries=remaining_retries,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\mario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\openai\_base_client.py", line 898, in _request
raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'detail': 'Not Found'}
Traceback (most recent call last):
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 289, in parseMap
totalTokensFuture = future.result()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 401, in __get_result
raise self._exception
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2267, in searchCodes
raise Exception(str(e) + "Failed to translate: " + oldjaString) from None
Exception: Error code: 404 - {'detail': 'Not Found'}Failed to translate: \N<父>…そんな訳でしばらく家を空けることになった。
Traceback (most recent call last):
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 221, in getResultString
raise translatedData[2]
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 289, in parseMap
totalTokensFuture = future.result()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\_base.py", line 401, in __get_result
raise self._exception
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.240.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\mario\Downloads\DazedMTLTool-main\modules\rpgmakermvmz.py", line 2267, in searchCodes
raise Exception(str(e) + "Failed to translate: " + oldjaString) from None
Exception: Error code: 404 - {'detail': 'Not Found'}Failed to translate: \N<父>…そんな訳でしばらく家を空けることになった。
Map001.json: [Input: 0][Output: 0][Cost: $0.0000][20.9s] ✗ Error code: 404 - {'detail': 'Not Found'}Failed to translate: \N<父>…そんな訳でしばらく家を空けることになった。
TOTAL: [Input: 0][Output: 0][Cost: $0.0000][20.9s] ✓
Ah...looking at the errors you shared, it seems this is the error:
openai.NotFoundError: Error code: 404 - {'detail': 'Not Found'}

I presume this is because of how the api url is written in your .env file but I'm unsure...
Ah you're using g4f through docker but it seems to be working fine so that's not the issue.

It's most likely...AH I JUST REMEMBERED!
I believe you have to also fill in the "Organization Key" which is probably why the api is returning 404...I think.
Fill the organization field in the .env file like in this example:
"org-CuteandFunny"
(You can replace "CuteandFunny" with anything you want by the way)

and it should work well I hope!
If it works, I'll edit my previous post with these details!
 
  • Like
Reactions: mario6714

Sasuto2k5

Newbie
Mar 29, 2023
17
2
I really want to translate this game using your tool, but it seems this tool isn't friendly to guys that has no experience about coding lol. (I tried install DazedMTL add-on in Translator++, but there is a problem in the software)
 

mario6714

Member
Jun 22, 2020
392
231
Ah...looking at the errors you shared, it seems this is the error:
openai.NotFoundError: Error code: 404 - {'detail': 'Not Found'}

I presume this is because of how the api url is written in your .env file but I'm unsure...
Ah you're using g4f through docker but it seems to be working fine so that's not the issue.

It's most likely...AH I JUST REMEMBERED!
I believe you have to also fill in the "Organization Key" which is probably why the api is returning 404...I think.
Fill the organization field in the .env file like in this example:

(You can replace "CuteandFunny" with anything you want by the way)

and it should work well I hope!
If it works, I'll edit my previous post with these details!
Still the same error


#API link, leave blank to use OpenAI API
api=" "

#API key
key="1111"

#Oranization key, make something up for self hosted or other API
organization="org-CuteandFunny"

#LLM model name, use gpt-3.5-turbo-1106 or gpt-3.5-turbo or gpt-4-1106-preview for OpenAI API
#For text generation webui use gpt-3.5-turbo, for other API's consult their documentation
model="gpt-4o"

#The language to translate TO, Don't forget to change the prompt
language="English"

#The timeout before disconnect error, 30 to 120 recommended
timeout="120"

#The number of files to translate at the same time, 1 recommended for free or self hosted API or gpt-4
fileThreads="1"

#The number of threads per file, 1 recommended for free or self hosted API or gpt-4
threads="1"

#The wordwrap of dialogue text
width="60"

#The wordwap of items and help text
listWidth="100"

#The wordwap of items and help text
noteWidth="75"



1731085307706.png



1731085389786.png
 
Last edited:

mario6714

Member
Jun 22, 2020
392
231
Ah...looking at the errors you shared, it seems this is the error:
openai.NotFoundError: Error code: 404 - {'detail': 'Not Found'}

I presume this is because of how the api url is written in your .env file but I'm unsure...
Ah you're using g4f through docker but it seems to be working fine so that's not the issue.

It's most likely...AH I JUST REMEMBERED!
I believe you have to also fill in the "Organization Key" which is probably why the api is returning 404...I think.
Fill the organization field in the .env file like in this example:

(You can replace "CuteandFunny" with anything you want by the way)

and it should work well I hope!
If it works, I'll edit my previous post with these details!
Can you tech me how to run local? and can you share your files for translate? thanks
 

jaden_yuki

Active Member
Jul 11, 2017
931
708
I have a dumb question: given the humongous context window of modern models, why not just give hundreds of lines in one request?
 

dazedanon

Engaged Member
Modder
Uploader
Donor
Jul 24, 2017
2,534
28,600
I have a dumb question: given the humongous context window of modern models, why not just give hundreds of lines in one request?
Most AI models struggle and will start hallucinating or messing up after a certain number of lines.
 
  • Like
Reactions: jaden_yuki
Oct 21, 2022
50
5
only if your API has the same format I think
Here is it
JavaScript:
/**
*
* Used to run translation with Sangtacviet if there's an error with Gemini translating Chinese characters
* @param {string} text
* @returns {string} the translated text (converted) into Chinese
*/
async translateWithBackupSTV(text) {
  if (text.length == 0) {
    throw new Error("Cannot convert null string!");
  }

  const transUrl = new URL("https://sangtacviet.app/index.php");
  transUrl.searchParams.set("langhint", "chinese");

  let formData = new FormData();
  formData.append("sajax", "trans");
  formData.append("content", text);

  const response = await fetch(transUrl, { body: formData, method: "POST" });
  const translated = await response.text();
  return translated;
}
Do you think it work ?
 

Cutefunniness

Newbie
Jan 19, 2023
83
137
Still the same error


#API link, leave blank to use OpenAI API
api=" "

#API key
key="1111"

#Oranization key, make something up for self hosted or other API
organization="org-CuteandFunny"

#LLM model name, use gpt-3.5-turbo-1106 or gpt-3.5-turbo or gpt-4-1106-preview for OpenAI API
#For text generation webui use gpt-3.5-turbo, for other API's consult their documentation
model="gpt-4o"

#The language to translate TO, Don't forget to change the prompt
language="English"

#The timeout before disconnect error, 30 to 120 recommended
timeout="120"

#The number of files to translate at the same time, 1 recommended for free or self hosted API or gpt-4
fileThreads="1"

#The number of threads per file, 1 recommended for free or self hosted API or gpt-4
threads="1"

#The wordwrap of dialogue text
width="60"

#The wordwap of items and help text
listWidth="100"

#The wordwap of items and help text
noteWidth="75"



View attachment 4212422



View attachment 4212429
Oh...you forgot to leave a backslash at the end of the api link...
It should look like this!
Code:
http://localhost:1337/v1/
Because there's no backslash at the end of the url in your .env file, the url that dazedMTL sends out
to it becomes malformed aka broken.

So simply add that / at the end and I believe everything should work!
 
Last edited:

mario6714

Member
Jun 22, 2020
392
231
Oh...your forgot to leave a backslash at the end of the api link...
It should look like this!
Code:
http://localhost:1337/v1/
Because there's no backslash at the end of the url in your .env file, the url that dazedMTL sends out
to it becomes malformed aka broken.

So simply add that / at the end and I believe everything should work!
Thanks
 
  • Like
Reactions: Cutefunniness

jaden_yuki

Active Member
Jul 11, 2017
931
708
Here is it
JavaScript:
/**
*
* Used to run translation with Sangtacviet if there's an error with Gemini translating Chinese characters
* @param {string} text
* @returns {string} the translated text (converted) into Chinese
*/
async translateWithBackupSTV(text) {
  if (text.length == 0) {
    throw new Error("Cannot convert null string!");
  }

  const transUrl = new URL("https://sangtacviet.app/index.php");
  transUrl.searchParams.set("langhint", "chinese");

  let formData = new FormData();
  formData.append("sajax", "trans");
  formData.append("content", text);

  const response = await fetch(transUrl, { body: formData, method: "POST" });
  const translated = await response.text();
  return translated;
}
Do you think it work ?
this is a fetcher written in JS. if you are running a local nodeJS server, its API needs to be compatible with openai REST api
 
Last edited: