本帖最后由 stanley 于 2026-8-10 19:32 编辑
证据链(我在你源码里逐行验证)1. 错误是"思考回传"未启用的典型症状[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]Hermes 源码里处理这个错误的专有代码(agent/agent_runtime_helpers.py:3135-3145),注释原文直接对应你的报错: DeepSeek / Kimi thinking mode: all assistant messages need reasoning_content. Inject a single space to satisfy the provider's requirement... Space (not "") because DeepSeek V4 Pro tightened validation and rejects empty string with HTTP 400 ("The reasoning content in the thinking mode must be passed back to the API"). Refs #17341.
[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]Hermes 早就为同款模型修过这个 bug,补丁正是"给历史 assistant 消息补一个 reasoning_content 空格"。 2. 但这个补丁只对特定 provider 生效[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]run_agent.py:6262-6291 的判定函数,靠 provider 名 / 模型名含关键词 / base_url 域名 三重识别,只有三个家族命中: [color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]触发条件 覆盖
_needs_deepseek_tool_reasoning()provider=deepseek / 模型名含 "deepseek" / 域名 api.deepseek.com
_needs_kimi_tool_reasoning()kimi-coding / api.kimi.com / moonshot
_needs_mimo_tool_reasoning()xiaomi / mimo / xiaomimimo
[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]你的 qwen3.5 + noteexpress 端点完全不匹配这三条 → _needs_thinking_reasoning_pad() 返回 False → 补丁不执行 → 报错。 3. 根因是你自建的 noteexpress provider 插件缺了这个方法[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]plugins/model-providers/noteexpress/__init__.py 里,NoteExpressProfile 没有重写 build_api_kwargs_extras()(DeepSeek/Kimi 插件都有),所以 Hermes 不知道这是个思考模型端点,无法启用回传补丁。
解决方案(保留思考能力,3 选 1)✅ 方案 A(推荐,改动最小):给端点域名"认领"回传机制[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]在 Hermes 源码 run_agent.py 的 _needs_thinking_reasoning_pad() 或 _needs_deepseek_tool_reasoning() 里,把你的端点 113.108.154.211:8009(或 gateway.inoteexpress.com)加进宿主匹配。这样 qwen 思考模式会被正确回传。 [color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]优点:一处改动,全局生效,保留思考。缺点:改了核心源码,hermes update 会被 git 覆盖(需 stash 或重新打补丁)。 ✅ 方案 B(最规范):给你的 noteexpress 插件加 build_api_kwargs_extras[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]照 DeepSeek 插件的写法,在 NoteExpressProfile 里重写此方法,当模型是思考型时输出 {"reasoning_effort": "..."} 并让 Hermes 走回传逻辑。 优点:最符合 Hermes 的插件架构,hermes update 不冲突。缺点:要写代码,且要确认 GPUStack 后端接受哪种 wire shape。 ⚠️ 方案 C(绕过,但需权衡):回到上一轮你说的"关闭 thinking mode"[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]把 reasoning_effort 设为 none 或关掉 thinking,彻底绕开回传要求。但你说要保留思考能力,所以这个先放一边。
[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]我的建议:走方案 B——它最干净,不污染核心源码,且你的 noteexpress 插件本来就是公司自研的,加个 thinking 支持顺理成章。而且我在上一轮已经摸清了 DeepSeek 插件的参考模板。 [color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]要我现在动手吗?如果做,我会: - 先 curl 你的 qwen 端点,确认它走的是 thinking 字段还是 reasoning_effort(GPUStack 的 wire shape)
- 照模板给 noteexpress 插件加上回传支持
- 用一次真实多轮对话验证
[color=color(srgb 0.145098 0.14902 0.160784 / 0.99)][backcolor=color(srgb 0.996235 0.996235 0.996235)][size=16.875px]在动你源码前我想先确认——是你希望我直接改(方案 B),还是你已经在别处有官方/更新的 noteexpress 插件版本不想让我动? |