fix(deepseek): back-fill reasoning_content for all assistant turns

This commit is contained in:
zhayujie
2026-04-24 16:39:48 +08:00
parent fd88828abd
commit 31820f56e7
14 changed files with 188 additions and 42 deletions

View File

@@ -14,12 +14,41 @@ description: DeepSeek 模型配置
| 参数 | 说明 |
| --- | --- |
| `model` | `deepseek-v4-pro`V4 Pro思考模式 + 工具调用Agent 推荐)、`deepseek-v4-flash`V4 Flash思考模式 + 工具调用)、`deepseek-chat`DeepSeek-V3.2,非思考模式)、`deepseek-reasoner`DeepSeek-R1思考模式 |
| `model` | 支持 `deepseek-v4-pro`、`deepseek-v4-flash` |
| `deepseek_api_key` | 在 [DeepSeek 平台](https://platform.deepseek.com/api_keys) 创建 |
| `deepseek_api_base` | 可选,默认为 `https://api.deepseek.com/v1`,可修改为第三方代理地址 |
## 模型选择
| 模型 | 适用场景 |
| --- | --- |
| `deepseek-v4-pro` | 复杂任务效果最佳 |
| `deepseek-v4-flash` | 速度更快、成本更低 |
## 思考模式
V4 系列(`deepseek-v4-pro` / `deepseek-v4-flash`)支持显式的"思考模式":模型在输出最终回答前,先输出一段思维链(`reasoning_content`),从而提升答案质量。
### 开关
通过全局配置 `enable_thinking` 控制:
```json
{
"enable_thinking": true
}
```
- `true`所有渠道下模型都会先思考再作答。Web 控制台会展示思考过程IM 渠道(微信 / 企微 / 钉钉 / 飞书)虽不展示但同样获得更好答案。
- `false`:关闭思考,响应更快,首字延迟更低。
### 行为说明
- **采样参数**:思考模式下 `temperature`、`top_p`、`presence_penalty`、`frequency_penalty` 会被服务端忽略不会报错CowAgent 会自动跳过传入。
- **多轮工具调用**当历史中包含工具调用时DeepSeek 要求所有 assistant 消息必须回传 `reasoning_content`。CowAgent 会自动处理回传逻辑,跨轮次切换思考开关也不会出错。
<Tip>
V4 系列模型(`deepseek-v4-pro``deepseek-v4-flash`)支持思考模式与工具调用,可在 Agent 模式下进行多轮思考与工具协同。思考开关由全局 `enable_thinking` 配置控制,工具调用轮次的 `reasoning_content` 会自动回传给 API
复杂任务推荐使用 `deepseek-v4-pro`,低延迟和低成本需求可选 `deepseek-v4-flash`,需要深度思考可开启 `enable_thinking`
</Tip>
方式二OpenAI 兼容方式接入: