Skip to content

fix(adapter): preserve discovered context windows#917

Merged
dingyi222666 merged 1 commit into
v1-devfrom
fix/ds-context-window-2
Jun 15, 2026
Merged

fix(adapter): preserve discovered context windows#917
dingyi222666 merged 1 commit into
v1-devfrom
fix/ds-context-window-2

Conversation

@dingyi222666

Copy link
Copy Markdown
Member

This pr preserves discovered model context windows for DeepSeek and Doubao chat models.

Bug Fixes

  • Pass discovered DeepSeek model max context sizes into the chat model constructor.
  • Pass discovered Doubao model max context sizes into the chat model constructor.
  • Raise the shared DeepSeek fallback context window to match the current adapter default.

Validation

  • yarn lint-fix (0 errors, existing max-len warnings in packages/extension-agent/src/sub-agent/builtin.ts only)

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1315a034-73cc-4171-83e1-741a7114d060

📥 Commits

Reviewing files that changed from the base of the PR and between 073b6c0 and a32df72.

📒 Files selected for processing (3)
  • packages/adapter-deepseek/src/client.ts
  • packages/adapter-doubao/src/client.ts
  • packages/shared-adapter/src/client.ts

Walkthrough

在 DeepSeek 和 DouBao 适配器的 _createModel 方法中,创建 ChatLunaChatModel 时新增 modelMaxContextSize 参数,取值自 info.maxTokens。同时,共享适配器中 DeepSeek 的默认最大上下文容量从 128000 更新为 1_000_000

Changes

模型最大上下文大小修正

Layer / File(s) Summary
更新共享适配器 DeepSeek 默认上下文容量
packages/shared-adapter/src/client.ts
modelMaxContextSizeTabledeepseek 的默认最大上下文容量常量由 128000 改为 1_000_000
DeepSeek 与 DouBao 适配器传入 modelMaxContextSize
packages/adapter-deepseek/src/client.ts, packages/adapter-doubao/src/client.ts
两个适配器的 _createModel 方法在构造 ChatLunaChatModel 时,新增 modelMaxContextSize 字段并赋值为 info.maxTokens

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • ChatLunaLab/chatluna#915:同样修改 DeepSeek 适配器的 _createModel,将 modelMaxContextSizeinfo.maxTokens 传入,与本 PR 的 DeepSeek 上下文处理直接相关。
  • ChatLunaLab/chatluna#905:在 packages/adapter-deepseek/src/client.ts 中调整了 DeepSeek 模型上下文大小的选取逻辑,与本 PR 的修改高度相关。
  • ChatLunaLab/chatluna#903:在 adapter-doubao 模型列表中新增了 DeepSeek V4 模型及其 maxTokens 配置,直接影响本 PR 中 DouBao 适配器读取 info.maxTokens 的行为。

Poem

🐇 兔子轻轻改一行,
上下文从十二万跳到百万场,
DeepSeek 与豆包齐传参,
maxTokens 不再默默藏。
代码虽短,意义悠长~ ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰明确地反映了PR的主要目的:在适配器中保留发现的上下文窗口大小。
Description check ✅ Passed 描述详细关联到变更集的所有方面,包括对DeepSeek和Doubao模型最大上下文大小的修复和验证步骤。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ds-context-window-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds modelMaxContextSize to the Deepseek and Doubao clients, and increases the fallback context size for Deepseek to 1,000,000 in the shared adapter. The reviewer recommends keeping the Deepseek fallback at 128,000 to avoid API errors with standard models, and suggests adding fallback values for modelMaxContextSize in both the Deepseek and Doubao clients to handle cases where info.maxTokens is undefined.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/shared-adapter/src/client.ts
Comment thread packages/adapter-doubao/src/client.ts
Comment thread packages/adapter-deepseek/src/client.ts
@dingyi222666 dingyi222666 merged commit f1741c8 into v1-dev Jun 15, 2026
4 of 5 checks passed
@dingyi222666 dingyi222666 deleted the fix/ds-context-window-2 branch June 15, 2026 17:26
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