纯文本模型下对话历史含图片导致请求被拒,会话卡死在报错界面
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**客户端版本**: 0.1.33
**反馈类型**: bug
---
# 现象
会话使用不支持视觉输入的纯文本模型(如 deepseek-v4-flash)时,只要对话历史中某条消息包含图片(截图/粘贴图片/工具产生的图像),后续任意请求——哪怕当前只发纯文字——都会被上游模型网关以 HTTP 400 拒绝:
```
litellm.BadRequestError: DeepseekException - {"error":{"message":"Failed to deserialize the JSON body into the target type: messages[64]: unknown variant `image_url`, expected `text` at line 1 column 159534","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
```
## 复现步骤
1. 新建会话并选择纯文本模型(如 deepseek-v4-flash)。
2. 在对话历史中发送一张图片。
3. 继续发送任意纯文字消息。
4. 请求被上游拒收,整个会话卡死在报错界面,无法继续对话。
## 期望行为
1. 发送前拦截:不应把图片提交给不支持多模态的模型。应在 UI 或请求构造层按模型能力过滤多模态内容(文本模型下将 image_url 块降级为 [图片] 占位或阻止发送),并给出自然语言提示。
2. 优雅恢复:即使错误发生,也不应卡死在报错界面。应给出可理解的自然语言错误说明,并自动降级恢复(如忽略/替换图片块后重试),让对话可以继续。
## 实际行为
整段含图历史被原样回传,上游反序列化失败返回 400,会话卡死在报错界面,用户无法继续,也没有可理解的自然语言错误提示。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26100)
**界面语言**: zh-CN
Contributor guide
Research direction
Start by tracing the request-construction path and the error UI from the reproduction steps, then identify where model capabilities and conversation history are handled. Done means text-only model requests no longer send image blocks, users receive an understandable message, and the conversation remains usable after the error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, backend-api-design, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100