Skip to content

feat(files-api): Support DeepSeek Files API - #250

Draft
dongbeiboy wants to merge 3 commits into
Vizards:mainfrom
dongbeiboy:feature-filesAPI
Draft

feat(files-api): Support DeepSeek Files API#250
dongbeiboy wants to merge 3 commits into
Vizards:mainfrom
dongbeiboy:feature-filesAPI

Conversation

@dongbeiboy

Copy link
Copy Markdown

我是小白,第一回用PR,而且还是deepseek写的代码,个人只是提供了一些思路,感觉代码质量应该不高,故只用了Draft PR

这个feature支持将图片上传到 DeepSeek Files API,并在对话中通过 file_id 引用,
而非嵌入 base64 data URL,降低请求体积与 token 消耗。

  • 通过 experimental.filesApi 开关启用,仅对 vision-exp 模型和官方端点生效
  • 图片按内容寻址本地缓存并去重,有效期内复用同一 file_id
  • 新增定期清理机制与清空云端缓存命令,避免缓存无限增长

I'm a beginner, this is my first PR, and the code was written by deepseek. I only provided some ideas, so I'm not confident about the code quality — that's why I used a Draft PR.

This feature allows uploading images to the DeepSeek Files API and referencing them in conversations via file_id, instead of embedding base64 data URLs, which reduces request size and token consumption.

Enabled via the experimental.filesApi flag, effective only for vision-exp models and the official endpoint
Images are content-addressed, locally cached and deduplicated; the same file_id is reused within its validity period
Added a periodic cleanup mechanism and a command to clear the cloud cache, preventing the cache from growing indefinitely

支持将图片上传到 DeepSeek Files API,并在对话中通过 file_id 引用,
而非嵌入 base64 data URL,降低请求体积与 token 消耗。

- 通过 experimental.filesApi 开关启用,仅对 vision-exp 模型和官方端点生效
- 图片按内容寻址本地缓存并去重,有效期内复用同一 file_id
- 新增定期清理机制与清空云端缓存命令,避免缓存无限增长
- 删除 filesApi.ts 中未使用的 imageFound 变量(oxlint 报错)
- 按 oxfmt 0.47 格式化 i18n.ts、request.ts、filesApi.ts、commands.ts
- 消除 CI 的 lint 与 format:check 失败
- 清空云端缓存后同步清空本地 image-cache,避免复用已删除的 file_id 导致 400
- await withProgress 使 try/catch 能真正捕获清空失败
- 上传链路透传 CancellationToken,支持按 Esc 中断; 修正 listener 泄漏
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant