[错误报告] 使用自定义引擎时遇到响应解析错误,DeepSeek API 无法正常返回结果 #364
Unanswered
cksdxz1007
asked this question in
Q&A
Replies: 1 comment 1 reply
-
应该把解析相应的代码 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
基础信息
描述错误
描述
在使用 Ebook-Translator-Calibre-Plugin 的自定义引擎功能时,我尝试使用 DeepSeek API 进行代码翻译,但遇到了响应解析错误。错误信息显示插件无法解析 DeepSeek 返回的 JSON 响应。我怀疑问题可能出在插件的
_parse
函数中,未能正确提取响应中的choices[0].message.content
数据。复现步骤
在自定义引擎中配置 DeepSeek 的 API 请求,结构如下:
执行代码翻译请求时,遇到以下错误:
问题描述
从错误信息看,DeepSeek API 返回的数据格式如下:
错误提示插件在
calibre_plugins.ebook_translator.engines.custom
文件的_parse
函数中,未能正确提取choices[0].message.content
数据,导致解析失败。期望的行为
希望插件能够识别并解析 DeepSeek API 的响应格式,将
choices[0].message.content
的内容返回为翻译结果。其他信息
由于插件的自定义引擎没有提供直接输入 API 密钥的地方,我只能在自定义引擎 JSON 配置中通过
Authorization
字段传入 API key。希望可以帮助解决这个解析问题!
Beta Was this translation helpful? Give feedback.
All reactions