Repository navigation
[功能] 裸模型名支持跨域回退(pool.cross_domain_fallback,默认关闭) - #232
Merged
linguo2625469 merged 1 commit intoOct 21, 2026
Merged
linguo2625469 merged 1 commit into
linguo2625469 merged 1 commit into
Conversation
zkmydgth
marked this pull request as ready for review
October 19, 2026 15:37
shinny-xionghongwei
added a commit
to shinny-xionghongwei/workbuddy2api-panel
that referenced
this pull request
Oct 20, 2026
maintell
added a commit
to maintell/workbuddy2api-panel
that referenced
this pull request
Oct 21, 2026
吸收的上游修复(均为 bug fix): - linguo2625469#233 国际版 11-128 通道校验分流 + 始终发送 X-Conversation-ID(取代本地 linguo2625469#190 旧实现;11-128 不再硬禁用账号) - linguo2625469#159 剥离 content 里的 reasoning_text 片段,修 Codex 转换后 11101 - linguo2625469#185 6021 queue.full 归为渠道级繁忙(不轮转、不罚号,503 upstream_busy) - linguo2625469#217 同账号 refresh 单飞,避免 RT 复用撞 12153 掉登录 - linguo2625469#162 识别企业切换会话 token_source=enterprise_switch - linguo2625469#199 缓存告警假阳性:miss 显式存在时对称反推 hit 另含 linguo2625469#138 linguo2625469#143 linguo2625469#144 linguo2625469#158 linguo2625469#178 linguo2625469#196 linguo2625469#205 linguo2625469#213 linguo2625469#220 linguo2625469#221 linguo2625469#223 linguo2625469#225 linguo2625469#230 linguo2625469#232 等功能更新。 本地改动:README 停维护声明改写为本 fork 口径;版本号 1.14.0-panel。
5 of 10 tasks
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.
背景
关联 issue #135。当前
internal/server/resolve_model.go把「模型名的域前缀」当作路由协议:不含:的裸模型名realm固定为cn,随后PickExcludingForRealm(tried, bare, realm)按域过滤账号。于是裸名实际等价于cn:<模型>——即使 global 账号能服务该模型,裸名请求也只会被送到 CN 号(典型表现:上游11102 service info not found),而很多 OpenAI 兼容客户端一条供应商记录只存一个模型名、无法按失败切换模型名。issue 里给了三种可选实现,本 PR 取第 1 种(新增开关、默认关闭),并额外覆盖第 3 种语义中的「另一域兜底」。
修改内容
pool.cross_domain_fallback(默认false,零回归):cmd/server/config.go加字段,main.go启动与配置热更新两处注入pool.SetCrossDomainFallback,config.example.json与 README 参数表同步说明。resolve_model.go新增resolveModelDetail返回realmExplicit;resolveModel/ResolveModel保持原有两返回值语义,既有调用方零改动。handler.go轮转循环里,裸名 + 开关开启时先看首选域是否有真正可服务的号(新增pool.ServableForModelRealm,口径与 pick 候选一致,但不含全冷却兜底),没有则改用另一域;该域也选不到时再退回一次,仍由MaxRotate封顶,不会两域之间无限往返。modelRate按实际服务域取值,账本与/status记的是真实域,而不是请求前缀声明的域。行为边界
cn:/global:前缀永不回退,写哪个域就只用哪个域。验证
go build ./...、go vet ./...通过。go test ./...全量 15 个包全绿(含internal/server、internal/pool、cmd/server)。internal/server/cross_domain_fallback_test.go:裸名 11102 后回退 global 成功;开关缺省关闭时保持 400model_unavailable且不跨域;显式cn:前缀零回退;首选域整域冷却时裸名回退另一域成功。cmd/server/cross_domain_fallback_config_test.go:默认false、配置文件覆盖为true生效。说明
/v1/models输出(不新增auto:之类别名),客户端无需改动即可受益。