fix: filter image_url content from API messages for DeepSeek compatibility#51
Merged
Conversation
…ility DeepSeek API does not support the image_url message content type, causing 400 errors when messages contain images from clipboard paste or Read tool. Filter out image_url parts before sending to the API. Fixes lessweb#50
Collaborator
|
我还需要接着改进2点:
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DeepSeek API 不支持
image_url消息内容类型,当消息中包含图片时(粘贴剪贴板图片、Read 工具读取图片文件)会报 400 错误。此修复在发送 API 请求前过滤掉image_url类型的内容部分,只保留文本。Changes
src/session.ts- 在构建 API 消息时跳过type === "image_url"的内容块Before
After
图片消息仍存储在本地会话中(UI 正常显示 📎),但不发送给 DeepSeek API。
Fixes #50