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

官网api调用报错,以及不知道第三方中转的api是否支持 #316

Closed hanxiao28 closed 6 months ago

hanxiao28 commented 6 months ago

最开始买了第三方中转的open ai api报错内容是:

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

Traceback (most recent call last): File "calibre_plugins.ebook_translator.engines.base", line 197, in get_result 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:

和报错2: Traceback (most recent call last): File "calibre_plugins.ebook_translator.components.engine", line 67, in translate_text File "calibre_plugins.ebook_translator.engines.openai", line 92, in translate File "calibre_plugins.ebook_translator.engines.base", line 210, in get_result Exception: 无法解析返回的响应。原始数据:

Traceback (most recent call last): File "calibre_plugins.ebook_translator.engines.base", line 197, in get_result File "mechanize_mechanize.py", line 257, in open File "mechanize_mechanize.py", line 313, in _mech_open mechanize._response.get_seek_wrapper_class..httperror_seek_wrapper: HTTP Error 404: Not Found

{"error":{"message":"Invalid URL (POST /v1chat/completions)","type":"invalid_request_error","param":"","code":""}}

后面找了一个官网的api,然后报错是: Traceback (most recent call last): File "calibre_plugins.ebook_translator.components.engine", line 67, in translate_text File "calibre_plugins.ebook_translator.engines.openai", line 92, in translate File "calibre_plugins.ebook_translator.engines.base", line 210, in get_result Exception: 无法解析返回的响应。原始数据:

Traceback (most recent call last): File "calibre_plugins.ebook_translator.engines.base", line 197, in get_result File "mechanize_mechanize.py", line 257, in open File "mechanize_mechanize.py", line 313, in _mech_open mechanize._response.get_seek_wrapper_class..httperror_seek_wrapper: HTTP Error 405: Method Not Allowed

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

Traceback (most recent call last): File "calibre_plugins.ebook_translator.engines.base", line 197, in get_result File "mechanize_mechanize.py", line 257, in open File "mechanize_mechanize.py", line 313, in _mech_open mechanize._response.get_seek_wrapper_class..httperror_seek_wrapper: HTTP Error 403: Forbidden

<!DOCTYPE html>Just a moment...

bookfere commented 6 months ago

应该是设置的 API 端点有误导致的,参考 #123 检查一下。

hanxiao28 commented 6 months ago

已设置成功,感谢老大!