Skip to content

feat: 更新 DeepSeek 模型并支持 Responses API - #228

Open
RayySummers wants to merge 3 commits into
Bistutu:mainfrom
RayySummers:feat/deepseek-v4-responses-api
Open

feat: 更新 DeepSeek 模型并支持 Responses API#228
RayySummers wants to merge 3 commits into
Bistutu:mainfrom
RayySummers:feat/deepseek-v4-responses-api

Conversation

@RayySummers

@RayySummers RayySummers commented Aug 5, 2026

Copy link
Copy Markdown
  • 模型列表更新:deepseek-chat / deepseek-reasoner(已于 2026-07-24 弃用)→ deepseek-v4-flash / deepseek-v4-pro
  • DeepSeek 服务新增"API 格式"设置(自动 / Responses API / Chat Completion):
  • 自动:deepseek-v4-flash 走官方 Responses API(/responsesinstructions + input 格式),deepseek-v4-pro 及自定义模型走 Chat Completion
  • 可手动强制任一种格式,兼容仅支持 OpenAI 格式的第三方代理
  • 两种格式均已实测翻译通过
  • 参考:https://api-docs.deepseek.com/guides/responses_api/(DeepSeek V4 Pro 支持 Responses API 后可再更新)

Summary by Sourcery

Update DeepSeek integration to use the new v4 models and support both Responses and chat completion APIs with configurable selection.

New Features:

  • Add support for DeepSeek Responses API for deepseek-v4-* models with appropriate request and response handling.
  • Introduce a configurable DeepSeek API format option (auto / Responses API / Chat Completion) in the UI and config.
  • Provide a shared helper to resolve the current DeepSeek model name without localized suffixes.

Enhancements:

  • Refresh DeepSeek model list to use deepseek-v4-flash and deepseek-v4-pro instead of deprecated models.
  • Adjust DeepSeek endpoint selection logic to automatically route v4-flash through Responses API while keeping other models on chat completions for stability.

Documentation:

  • Update DeepSeek translation engine documentation to recommend the deepseek-v4-flash model by default.

Copilot AI lite review requested due to automatic review settings August 5, 2026 13:29
@sourcery-ai

sourcery-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates DeepSeek integration to default to V4 models and to support both the official Responses API and OpenAI-compatible chat completions, with a configurable API format option in settings and corresponding docs/UI/config updates.

File-Level Changes

Change Details Files
Route DeepSeek requests to either the official Responses API or chat completions based on model and a new deepseekApiType setting, and normalize model selection.
  • Add useResponsesApi helper to choose Responses vs chat endpoints using deepseekApiType and current model
  • Switch DeepSeek endpoint from a fixed chat completions URL to a conditional /responses or /chat/completions URL
  • Use deepseekResponsesMsgTemplate or deepseekMsgTemplate depending on the selected API type
  • Parse Responses API output_text or message content array, with error handling when no text is returned
  • Introduce getCurrentModel to resolve the active model (including custom) and strip Chinese annotation suffixes
entrypoints/service/deepseek.ts
entrypoints/utils/template.ts
Add DeepSeek Responses API request template and adjust existing chat completion template to use shared model resolution.
  • Implement deepseekResponsesMsgTemplate to send model, instructions, and input as required by POST /responses
  • Refactor deepseekMsgTemplate to reuse getCurrentModel for consistent model naming
  • Document the Responses API request shape in comments for maintainability
entrypoints/utils/template.ts
Expose a new DeepSeek API format configuration option in UI and config, controlling 'auto'/'responses'/'chat' behavior.
  • Add deepseekApiType field with default 'auto' to Config model
  • Add options.deepseekApiType list for the three selectable API format modes
  • Render a DeepSeek API format selector in Main.vue, shown only when DeepSeek is the active service, with explanatory tooltip
entrypoints/utils/model.ts
entrypoints/utils/option.ts
components/Main.vue
Update DeepSeek model list and user-facing docs to use V4 models instead of deprecated ones and clean up unused imports.
  • Replace deepseek-chat/deepseek-reasoner with deepseek-v4-flash/deepseek-v4-pro in the DeepSeek model options
  • Update translation-engines docs to recommend deepseek-v4-flash as the example model
  • Remove unused deepseekMsgTemplate import from newapi.ts
entrypoints/utils/option.ts
docs/config/translation-engines.md
entrypoints/service/newapi.ts

Possibly linked issues

  • #ds命名: PR把 deepseek-chat/reasoner 替换为 deepseek-v4-*,解决 issue 提到的模型命名弃用问题。

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In useResponsesApi/URL construction, relying on endpoint.replace(/\/chat\/completions\/?... assumes a specific path shape; consider more robust handling (e.g., appending /responses only when needed and avoiding mismatched payload/endpoint combinations for custom proxies).
  • deepseekResponsesMsgTemplate currently hardcodes temperature: 0.7 and omits other configurable parameters; it would be cleaner to reuse the existing config-driven settings (e.g., temperature) so behavior stays consistent across DeepSeek API formats.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `useResponsesApi`/URL construction, relying on `endpoint.replace(/\/chat\/completions\/?...` assumes a specific path shape; consider more robust handling (e.g., appending `/responses` only when needed and avoiding mismatched payload/endpoint combinations for custom proxies).
- `deepseekResponsesMsgTemplate` currently hardcodes `temperature: 0.7` and omits other configurable parameters; it would be cleaner to reuse the existing config-driven settings (e.g., temperature) so behavior stays consistent across DeepSeek API formats.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本 PR 更新了 DeepSeek 的模型与请求格式适配,新增可配置的 API 格式选择,以便在官方 Responses API 与 OpenAI 风格 Chat Completions 之间按模型/设置切换,提升对 DeepSeek v4 系列与第三方代理的兼容性。

Changes:

  • DeepSeek 模型列表更新为 deepseek-v4-flash / deepseek-v4-pro,并在文档中推荐默认使用 v4-flash。
  • 新增 DeepSeek API 格式选项(auto / Responses / Chat),并在 DeepSeek 服务请求侧实现端点与返回解析的分支逻辑。
  • 抽取 getCurrentModel() 用于解析当前实际模型名(去掉中文括号后缀)。

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
entrypoints/utils/template.ts 新增当前模型解析与 DeepSeek Responses API 请求体模板;保留 chat completions 模板
entrypoints/utils/option.ts 更新 DeepSeek 模型列表;新增 deepseekApiType 下拉选项数据
entrypoints/utils/model.ts Config 增加 deepseekApiType 字段并提供默认值 auto
entrypoints/service/newapi.ts 清理未使用的 deepseekMsgTemplate 引用(保持 NewAPI 使用通用模板)
entrypoints/service/deepseek.ts 根据 deepseekApiType/模型选择 Responses 或 Chat;调整请求端点与响应解析
docs/config/translation-engines.md 文档推荐模型从 deepseek-chat 更新为 deepseek-v4-flash
components/Main.vue DeepSeek 服务下新增“API 格式”配置项,并绑定到 config.deepseekApiType

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread entrypoints/service/deepseek.ts Outdated
Comment on lines +24 to +31
const model = getCurrentModel();
const endpoint = config.proxy[config.service] || urls[config.service];

// Responses API 与 chat completions 的端点不同,把 /chat/completions 路径替换为 /responses
const isResponses = useResponsesApi(model);
const url = isResponses
? endpoint.replace(/\/chat\/completions\/?$/, '/responses')
: endpoint;
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.

2 participants