迁移 DeepSeek 集成到 V4 模型#219
Conversation
Reviewer's GuideMigrates the DeepSeek translation integration to the V4 model family with explicit thinking mode handling, tightens DeepSeek response sanitization, and fixes TypeScript/build issues by adding Chrome types and aligning Vite versions, plus updates docs to recommend the new models. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
deepseekMsgTemplateandextractDeepSeekContent, consider replacing theanypayload/response types with a minimal typed interface for the DeepSeek request/response shape so that future changes to the API are caught at compile time rather than runtime. - The comments that reference specific future dates (e.g., DeepSeek docs checked on 2026-06-20 and deprecation scheduled for 2026-07-24) may age quickly; it would be more maintainable to either reference the relevant documentation URL or describe behavior in a timeless way and leave deprecation timing to release notes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `deepseekMsgTemplate` and `extractDeepSeekContent`, consider replacing the `any` payload/response types with a minimal typed interface for the DeepSeek request/response shape so that future changes to the API are caught at compile time rather than runtime.
- The comments that reference specific future dates (e.g., DeepSeek docs checked on 2026-06-20 and deprecation scheduled for 2026-07-24) may age quickly; it would be more maintainable to either reference the relevant documentation URL or describe behavior in a timeless way and leave deprecation timing to release notes.
## Individual Comments
### Comment 1
<location path="entrypoints/utils/check.ts" line_range="101-102" />
<code_context>
- return content;
-}
\ No newline at end of file
+ // Never render model reasoning tags in translated page content.
+ return text.replace(/<think>[\s\S]*?<\/think>/gi, "").trim();
+}
</code_context>
<issue_to_address>
**suggestion (bug_risk):** The added `trim()` may unintentionally alter intentional leading/trailing whitespace or layout.
The previous handler only removed the `<think>...</think>` block and preserved surrounding whitespace. Now you both globally replace and call `trim()`. The global replace seems fine, but `trim()` changes output semantics (e.g., stripping final newlines or leading spaces important for markdown/preformatted text). If that formatting is user-visible, consider dropping `trim()` or limiting whitespace cleanup to the reasoning tags only.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| // Never render model reasoning tags in translated page content. | ||
| return text.replace(/<think>[\s\S]*?<\/think>/gi, "").trim(); |
There was a problem hiding this comment.
suggestion (bug_risk): The added trim() may unintentionally alter intentional leading/trailing whitespace or layout.
The previous handler only removed the <think>...</think> block and preserved surrounding whitespace. Now you both globally replace and call trim(). The global replace seems fine, but trim() changes output semantics (e.g., stripping final newlines or leading spaces important for markdown/preformatted text). If that formatting is user-visible, consider dropping trim() or limiting whitespace cleanup to the reasoning tags only.
概要
本 PR 将 DeepSeek 翻译集成迁移到 DeepSeek V4 模型命名,并修复当前仓库的 TypeScript 编译问题,便于后续手动测试与发布验证。
变更内容
deepseek-v4-flash、deepseek-v4-pro,保留自定义模型支持。deepseek-chat->deepseek-v4-flash+ 关闭 thinkingdeepseek-reasoner->deepseek-v4-pro+ 开启 thinkingthinking: { type: "enabled" | "disabled" }。choices[0].message.content,忽略reasoning_content等推理字段。<think>...</think>内容,避免推理过程泄露到网页。@types/chrome,修复chrome全局类型缺失。vite对齐到5.4.19,与 WXT 使用的 Vite 版本一致,修复wxt.config.ts插件类型不匹配。验证
corepack pnpm compile:通过corepack pnpm build:通过,生成 Chrome MV3 扩展,WXT 报告总大小约 1.97 MBcorepack pnpm lint:未通过,原因是仓库当前没有定义lintscript,也没有可执行的lint命令;本 PR 未新增或修改 lint 配置Manifest 检查
manifest_version为 3storage、contextMenus、offscreenhost_permissions兼容性说明
旧的 DeepSeek 模型名仅保留在迁移兼容逻辑中。新配置入口使用 V4 模型名,并继续支持自定义模型,避免未来 DeepSeek 新模型发布时阻塞用户配置。
Summary by Sourcery
Migrate the DeepSeek translation integration to the V4 chat/thinking model API while aligning build tooling and documentation.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation: