bookfere / Ebook-Translator-Calibre-Plugin

A Calibre plugin to translate ebook into a specified language.
https://translator.bookfere.com
GNU General Public License v3.0
1.74k stars 116 forks source link

求助:添加chapgpt 3.5,不成功 #305

Closed brookechuo closed 6 months ago

brookechuo commented 6 months ago

添加chapgpt 3.5,提示错误,如下所示:

Traceback (most recent call last):
  File "calibre_plugins.ebook_translator.components.engine", line 67, in translate_text
    translation = self.translator.translate(text)
  File "calibre_plugins.ebook_translator.engines.openai", line 92, in translate
    return self.get_result(
  File "calibre_plugins.ebook_translator.engines.base", line 210, in get_result
    raise Exception(
Exception: 无法解析返回的响应。原始数据:

Traceback (most recent call last):
  File "calibre_plugins.ebook_translator.engines.base", line 197, in get_result
    br.open(request)
  File "mechanize/_mechanize.py", line 257, in open
  File "mechanize/_mechanize.py", line 287, in _mech_open
  File "mechanize/_opener.py", line 193, in open
  File "mechanize/_urllib2_fork.py", line 425, in _open
  File "mechanize/_urllib2_fork.py", line 414, in _call_chain
  File "mechanize/_urllib2_fork.py", line 1283, in https_open
  File "mechanize/_urllib2_fork.py", line 1240, in do_open
urllib.error.URLError: <urlopen error timed out

密钥在其他软件中正常使用。

自定义部分的设定如下所示:

{
    "name": "New Engine - 59d9c",
    "languages": {
        "source": {
            "Source Language": "code"
        },
        "target": {
            "Target Language": "code"
        }
    },
    "request": {
        "url": "https://api.chatanywhere.com.cn/v1/chat/completions",
        "method": "POST",
        "headers": {
            "Content-Type": "application/json"
        },
        "data": {
            "source": "<source>",
            "target": "<target>",
            "text": "<text>"
        }
    },
    "response": "response"
}