Agent Skills
返回列表
DeepSeek V4 Thinking 400 修复方案

DeepSeek V4 Thinking 400 修复方案

开发编程 更新于 2026.08.29

将以下提示词粘贴到你的 AI 对话框中:

请根据 https://skillhub.cn/install/skillhub.md,安装 @user_930668a2/deepseek-thinking-fix。

技能介绍

问题

DeepSeek V4 Flash/Pro 在开启 thinking mode 后,多轮对话中 agent 调用工具时容易返回 400。这不是 Hermes 单独的问题,Cursor、Continue.dev、RooCode、LangChain、OpenCode 等也会出现。根因通常是 DeepSeek 在 OpenAI 兼容协议中加入了私有字段 reasoning_content,框架在消息 round-trip、工具调用、持久化恢复和跨模型切换时没有稳定处理这个字段。

工作方式

本技能在消息发给 DeepSeek API 前做几件事:

  • 回填 reasoning_content:assistant 消息统一携带该字段,有内容保留,无内容填空字符串。
  • 深度拷贝:避免多个函数共享同一 dict 引用导致状态被覆盖。
  • 字段清理:切到非 thinking 模型时移除 reasoning_content,防止字段泄漏。
  • 持久化修复:保存时同时保留 reasoning 与 reasoning_content,加载时自动补全。
  • 显式 thinking 参数:thinking=off 时传 disabled 语义,避免 DeepSeek 默认开启 thinking。

适用边界

适合 Hermes Agent + DeepSeek V4 Flash/Pro 的多轮 tool-call、Cron 辅助路径、Session 持久化恢复等场景。它不替代模型能力,也不解决网络、权限或 API 配额问题;如果上游协议继续变化,需要重新验证字段兼容性。

使用场景

  • Hermes 接 DeepSeek V4 Pro 做多轮搜索工具调用,排查 400 与 reasoning_content 缺失。
  • LangChain 调 DeepSeek thinking 工具连续 400 时,检查 assistant 消息是否缺少 reasoning_content。
  • Cron 定时任务用 DeepSeek thinking 辅助路径间歇报错,需要在发送前统一补全字段。
  • 恢复 Hermes 会话继续对话时,避免旧 reasoning 与新 reasoning_content 字段污染。

适合人员

  • 维护 Hermes Agent 的工程,要让 DeepSeek V4 工具调用不再 400。
  • 用 LangChain 做 agentic workflow,要处理 thinking 字段 round-trip。
  • 写 Cron 辅助任务的工程师,要稳定恢复 DeepSeek 会话状态。
  • 排查 Continue.dev 上游补丁的开发者,要确认字段泄漏是否被覆盖。