#3816 Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=4096, prompt_tokens

183.239* Posted at: 2 hours ago 👁5

Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=4096, prompt_tokens=2541, total_tokens=6637, completion_tokens_details=None, prompt_tokens_details=None)


=
system:Windows-10-10.0.26200-SP0
version:v3.96
frozen:True
language:zh
root_dir:D:/pyvideotrans

1 Replies

这是由于 OpenAI API 的响应内容过长,超出了模型的最大输出令牌限制(4096个令牌)导致的。

解决方案:

  1. 降低翻译请求的上下文长度:在软件主界面,取消勾选“发送完整字幕”选项。这将改为逐行或小批量发送字幕进行翻译,避免一次性发送过长的上下文。
  2. 调整高级设置:点击 菜单 -> 工具 -> 高级选项,在“字幕翻译调整”区域进行以下修改:

    • AI翻译渠道每批字幕行数:将此值调小,例如从默认的100改为20或10。
    • AI翻译附带完整原字幕:确保此项未勾选
  3. 检查并优化提示词:如果使用了自定义的AI翻译提示词(位于 prompts 目录),请确保提示词本身不会导致模型生成过长的回复。可以尝试使用更简洁的提示词。
  4. 考虑更换翻译模型:如果当前使用的是上下文窗口较小的模型(如某些本地7B模型),建议更换为支持更长上下文的在线大模型,如 DeepSeek-V3、GPT-4o 或 Claude 3.5。

请查阅相关文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Related resource

Similar issues already exist