feat: 更新 DeepSeek 适配器至 V4,新增 E2E 测试#92
Open
smartdddlab wants to merge 7 commits into
Open
Conversation
added 7 commits
April 24, 2026 18:58
DeepSeek 官网升级至 V4 版本,界面和模型均有变化: 适配器更新 (deepseek_text.js): - 模型从 v3.2 升级至 v4 (flash/pro 双模式) - 新增快速模式/专家模式切换 (Radio 按钮) - 支持中英文界面自动兼容 - 模型列表扩展至 8 个 (flash/pro × thinking/search 组合) E2E 测试: - 新增 API 层测试 (认证、模型列表、流式/非流式生成) - 新增浏览器交互测试 (模式切换、按钮、文本生成) - 使用 .env 配置测试参数
@ai-sdk/openai v5+ 默认使用 Responses API (/v1/responses) 而非 Chat Completions API (/v1/chat/completions)。添加适配器将 Responses API 请求转换为 Chat Completions 格式处理,支持流式和非流式响应。 主要变更: - 新增 src/server/api/openai/responses.js - Responses API 适配器 - 修改 src/server/api/openai/routes.js - 添加 /v1/responses 路由 支持的事件类型: - response.created / response.completed - response.output_item.added / response.output_item.done - response.content_part.added / response.content_part.done - response.output_text.delta / response.reasoning_text.delta
每次 API 调用都执行 gotoWithCheck 导航到首页会创建全新会话。 改为检测当前页面是否已在 chat.deepseek.com: - 已在页面:优先点击"新对话"按钮,避免全页面重载 - 不在页面:正常导航 - 按钮不可用:回退到全页面导航
新增 /v1/responses 端点的非流式和流式测试,验证: - 响应格式符合 OpenAI Responses API 规范 - 流式 SSE 事件包含 response.created / delta / response.completed
验证浏览器会话复用:连续多次 API 请求均成功返回, 包括 Chat Completions 和 Responses API 两种格式。
- 适配器检测页面 URL 判断是否在对话中 - 在对话中:直接输入新消息,保持上下文连续 - 在首页:开始新对话 - 不在 DeepSeek:导航到首页 - 新增上下文连续性 E2E 测试(验证模型记住之前的消息)
- 适配器:textarea 点击失败时自动点击"新对话"按钮重试 - 测试:新增上下文连续性验证(模型记住之前的消息)
Author
|
Author
我的测试测试到了,晚上修复下,问题不大,使用官方的保存方法保存起来。 |
Author
简单看了下, 目前的API设计对图像和视频类的与 openapi等实现的 标准不一致,后面可能需要重构一下,单独提供支持
|
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-v3.2升级至deepseek-v4-flash/deepseek-v4-pro(快速/专家双模式)适配器变更
src/backend/adapter/deepseek_text.js:switchMode()— 快速模式/专家模式 Radio 切换findByName()— 中英文兼容的元素查找toggleButton()/configureModel()适配中英文E2E 测试
e2e/deepseek.test.js— 浏览器交互测试(18 用例)e2e/api.test.js— HTTP API 测试(9 用例)playwright.config.js— 分离 chromium / api 两个 projecte2e/.env管理Test plan
npx playwright test --project=api— API 测试npx playwright test --project=chromium— 浏览器测试npx playwright test— 全量测试(27 用例)