Skip to content

优化:强制最大上下文与目录能力展示 - #539

Closed
guyu233 wants to merge 2 commits into
caigee-cmd:mainfrom
guyu233:pr2/max-context
Closed

guyu233 wants to merge 2 commits into
caigee-cmd:mainfrom
guyu233:pr2/max-context

Conversation

@guyu233

@guyu233 guyu233 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This PR previously forced every chat request to the model's declared maximum context window. Updated based on review: cli2api no longer stipulates a request context window. Only a context window supplied by the client is forwarded upstream. Catalog context limits, including each model's maximum context window, are display-only metadata. Trae max mode is forwarded only when explicitly requested by the client. Validation: go build ./...; targeted Go tests for executor/api/control/qoder/qwenwork/trae; worker plaintext tests 23/23; frontend npm run sync; git diff --check.

@caigee-cmd

Copy link
Copy Markdown
Owner

感谢提交!推理档位显示的修复思路是对的,把 mergeDisplayReasoningOptions 拿掉让 catalog 只展示模型实际声明的档位,这个方向正确。有两个问题需要先解决:

必须修复

  1. 和 对齐 CC Switch:统一推理意图、协议转换与路由策略优先级 #541 的行为相反,需要先对齐
    本 PR 的最终状态(a967394)是"不再由网关注入上下文窗口,只透传客户端传的值"。但 对齐 CC Switch:统一推理意图、协议转换与路由策略优先级 #541 的最后一个提交 64f0c95 Revert-context-window-fix 又把 ForceMaxContextLength 加了回来,同时两个 PR 都在修改 changelog/unreleased/force-max-context-window.md,内容互相矛盾。先合哪个都会和另一个冲突。

    建议:先和 对齐 CC Switch:统一推理意图、协议转换与路由策略优先级 #541 的作者对齐,定下来到底要哪种行为——是"网关强制用模型声明的最大上下文"还是"只透传客户端传的值"——然后再推进合并。

  2. 标题和实际行为对不上,需要改
    PR 标题是"强制最大上下文",changelog 文件名是 force-max-context-window.md,但实际做的是"不再由网关选择上下文窗口",语义正好相反。标题、changelog 文件名和内容需要统一改成和"透传"一致的描述。

其他需要注意

  • 本 PR 把控制台存的上下文窗口设置和 Trae/Qoder 的 Max 模式开关都去掉了。已经设置过这些的用户升级后会悄悄失效,changelog 里需要明确写出来,给运维一个预期
  • 提交历史里有先强制、再撤回、再修编译的记录(d8f4e67 fix build: restore json import),合并时建议 squash 一下

等 #539 和 #541 对齐上下文窗口方向之后,这个 PR 修起来应该很快,期待更新 🙏

Rebuilt on current main. Migration is 031 (030 is reserved by the pending key aggregation PR). Display reasoning levels stay catalog-driven instead of merging the full gateway set, and local-only audit/vite changes are dropped. Changelog now notes probe quota cost and the priority-order default.
Chat requests no longer receive a gateway-chosen context window; only a client-supplied window is forwarded. Catalog maxima and Trae max mode are display/forward-only. The console per-model context setting and max-mode switches are dropped with a changelog note, and the changelog file now matches the passthrough semantics. Also aligns reasoning conversion with CC Switch (ultra tier, Anthropic thinking budgets).
@caigee-cmd

Copy link
Copy Markdown
Owner

感谢更新!上一轮的两个问题都修了:

  • 上下文窗口已统一为「只透传客户端传入的值」,ForceMaxContextLength 已删除,和 对齐 CC Switch:统一推理意图、协议转换与路由策略优先级 #541 不再矛盾
  • 标题和 changelog 已改为 context-window-passthrough.md,中英文都写明「控制台不再保存每个模型的上下文窗口,也不再提供 Trae/Qoder 最大档开关;已经设置过这些值的实例升级后不再生效」,和实际行为一致

还不能合,卡在 #538

本 PR 包含 #538 的全部提交,而 #538 现在和已合并的 #574 冲突:两边都新增了 030_api_key_model_aggregation.sql,而且是两套不同的「模型聚合」实现(详见 #538 的评论)。#538 定稿并重新编号 migration 之后,本 PR rebase 过来即可,本身没有新的阻断项。

@caigee-cmd

Copy link
Copy Markdown
Owner

#581–#584 已按顺序合并进 main(#581 34e5bb5、#582 b10ce19、#583 7e07545、#584 76e5229)。

本 PR 目前和 main 冲突,原因是它的第一个提交也新增了 031_aggregations.sql,和 #581 的迁移编号撞了,聚合功能本身也已被 #581 取代。

请基于最新 main rebase,并去掉已合并的聚合提交,只保留本 PR 自己的改动:客户端显式传入的上下文窗口透传上游,目录里的上下文上限只作为展示元数据,Trae max mode 仅在客户端显式请求时转发。rebase 后需要重新通过全部 required checks。

@guyu233

guyu233 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

按作者决定关闭:本 PR 不再强制最大上下文,只保留目录展示;强制上下文窗口的方案不合并。目录中的上下文上限展示继续由现有模型目录/详情能力承载,如后续还需要单独的展示改动,另开小 PR 跟踪。

@guyu233 guyu233 closed this Nov 23, 2026
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