Evil0ctal / ChatGPT-Minecraft-Plugin-Translater

用于将Minecraft Java服务器插件的配置yml文件翻译成不同的语言并且保持插件或游戏的保留关键字,基于OpenAI的ChatGPT 3.5模型以及内置中文和英文两套提示词,开箱即用,准确率99%,支持大型文件的拆分以及合并,支持批量处理多个文件。
Apache License 2.0
12 stars 0 forks source link

翻译出现格式问题 #10

Open Teaftc opened 4 days ago

Teaftc commented 4 days ago
1部分翻译失败:Invalid line format: ```yaml
如果再次失败,请检查文件内容。
The 1 part of the translation failed: Invalid line format: ```yaml
If it fails again, please check the file content.
Traceback (most recent call last):
  File "e:\ChatGPT-Minecraft-Plugin-Translater-2.0\ChatGPT-Minecraft-Plugin-Translater-2.0\main.py", line 166, in process_file
    translated_content = parser.to_yaml(translated_part)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Teaftc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pkvpm\parser.py", line 214, in to_yaml
    path, value, value_type = self.process_translation_line(line)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Teaftc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pkvpm\parser.py", line 96, in process_translation_line
    raise ValueError(f"Invalid line format: {line}")
ValueError: Invalid line format: ```yaml

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "e:\ChatGPT-Minecraft-Plugin-Translater-2.0\ChatGPT-Minecraft-Plugin-Translater-2.0\main.py", line 276, in <module>
    main(_output_language=output_language,
  File "e:\ChatGPT-Minecraft-Plugin-Translater-2.0\ChatGPT-Minecraft-Plugin-Translater-2.0\main.py", line 236, in main
    translated_count = process_directory(_input_path, _model, _output_language, _max_tokens, _output_path, log_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\ChatGPT-Minecraft-Plugin-Translater-2.0\ChatGPT-Minecraft-Plugin-Translater-2.0\main.py", line 218, in process_directory
    process_file(file_path, _model, _output_language, _max_tokens, output_folder, log_path)
  File "e:\ChatGPT-Minecraft-Plugin-Translater-2.0\ChatGPT-Minecraft-Plugin-Translater-2.0\main.py", line 176, in process_file
    translated_content = parser.to_yaml(translated_part)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Teaftc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pkvpm\parser.py", line 214, in to_yaml
    path, value, value_type = self.process_translation_line(line)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Teaftc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pkvpm\parser.py", line 96, in process_translation_line
    raise ValueError(f"Invalid line format: {line}")
ValueError: Invalid line format: ``
[diversity.txt](https://github.com/user-attachments/files/17879623/diversity.txt)
`yaml
Teaftc commented 4 days ago

diversity.txt

Evil0ctal commented 1 day ago

看起来应该是格式转换的时候出现问题了,你可以上传一份yaml文件用于测试吗?

Teaftc commented 1 day ago

看起来应该是格式转换的时候出现问题了,你可以上传一份yaml文件用于测试吗?

上边有上传一份.txt改成.yml就好了,github好像不支持上传yml文件

Teaftc commented 1 day ago

看起来应该是格式转换的时候出现问题了,你可以上传一份yaml文件用于测试吗?

image 感谢你