Skip to content

feat(config): 新增 cn.chat_base,修复海外出口下 CN 模型全部缺失 - #220

Merged
linguo2625469 merged 2 commits into
linguo2625469:mainfrom
zhiqiangme:fix/cn-chat-base
Oct 21, 2026
Merged

linguo2625469 merged 2 commits into
linguo2625469:mainfrom
zhiqiangme:fix/cn-chat-base

Conversation

@zhiqiangme

Copy link
Copy Markdown
Contributor

问题

出口在海外时(例如 Clash 全局模式 + TUN),/v1/models 里只剩 global: 模型,CN 模型一个都没有,而且没有任何报错。用 WorkBuddy 桌面端照样能正常用国内模型。

根因

内置的国内版上游 copilot.tencent.com 对海外出口的 TLS 握手直接复位(curl/schannel、Node/OpenSSL、Go 都一样),CN 模型目录和对话全部 EOF:

WARN: [upstream] warm model rates (cn): Get "https://copilot.tencent.com/console/enterprises/personal/models": EOF

官方 WorkBuddy 桌面端目前用的是 https://www.workbuddy.cn(日志里 endpoint: https://www.workbuddy.cn)。这个域名海外出口可以访问,接口也同构。用同一个 CN 账号、同一个海外出口实测:

CN chat base 模型目录 /v2/chat/completions
https://copilot.tencent.com EOF,0 个 EOF
https://www.workbuddy.cn 20 个 200,正常流式输出

另外,fetchDynamicModels 失败时只进负缓存、不留日志,所以排障时完全没有线索。

改动

  • feat(config):新增 cn.chat_base,写法照搬 global.chat_base。留空就回落内置默认(copilot.tencent.com),老配置不受影响。只在启动装配时生效,已加进面板保存后的「需重启字段」。
  • fix(server):/v1/models 拉取 CN 模型目录失败时记一行 WARN,附带上游错误。负缓存期内直接返回,不会刷屏。

默认值没改:国内出口用 copilot.tencent.com 一直正常,要不要切到 www.workbuddy.cn 交给维护者判断。海外出口的用户配一行就能用:

"cn": { "chat_base": "https://www.workbuddy.cn" }

验证

  • go test ./... 通过(新增 cmd/server/cn_chat_base_test.go、internal/server/models_fetch_log_test.go)。
  • TestModelsEndpoint 会真的去连 copilot.tencent.com,在海外出口下改动前后都失败,与本 PR 无关。
  • 本地 Windows 构建,海外出口下配置 cn.chat_base 后:/v1/models 返回 20 个 CN 模型 + 33 个 global 模型,cn:deepseek-v4.1-flash 对话正常,启动日志显示 warm model rates: cn ok。

未覆盖

面板登录(internal/panel/login.go)和 cmd/login 里的 upstreamBaseCN 仍写死 copilot.tencent.com,海外出口下新增 CN 账号大概率也会失败。登录链路涉及 Origin/Referer 和 OAuth 回调,本 PR 没有动,需要的话可以另开一个 PR。

copilot.tencent.com 对海外出口(如 Clash 全局 + TUN)的 TLS 握手直接复位,
CN 模型目录与对话全部 EOF,/v1/models 只剩 global 模型。官方 WorkBuddy 桌面端
已改用 https://www.workbuddy.cn,实测该域海外出口可达,模型目录与
/v2/chat/completions 均正常。

仿照 global.chat_base:空 = 回落内置默认,老配置零影响;只在装配期生效,
已列入面板保存后的需重启字段。
此前失败只进负缓存、不留日志,CN 域不可达时网关只列 global 模型却毫无线索。
负缓存期内直接返回,不会刷屏。
jin66god pushed a commit to jin66god/workbuddy2api-panel that referenced this pull request Oct 19, 2026
…inguo2625469#225/linguo2625469#221/linguo2625469#212/linguo2625469#158 + 面板配置入口与 README 重构)

- linguo2625469#223 出站 Transport 读取 HTTP(S)_PROXY 环境变量
- linguo2625469#220 新增 cn.chat_base,修复海外出口 CN 模型全部缺失;models 拉取失败记 WARN
- linguo2625469#225 models.hidden 模型黑名单:列表过滤 + 点名 400,热生效
- linguo2625469#221 11158 区分账号类型无权限;模型锁按 realm 隔离;全池无权限返回 400
- linguo2625469#212 到期提醒快照与「检查」同口径:按日聚合批次、DeductionEndTime 优先
- linguo2625469#158 按地区独立调度:加权随机 / 轮询 / 顺序耗尽 + 账号顺序,热生效
- 面板「上游与高级」补 CN 上游地址与模型黑名单入口(含前端回归测试)
- README 精简重构:能力/配置/部署以本仓库为准,删除开发向流水账
- 新增 GitHub Issue 模板:Bug / 功能 / 其他
jin66god added a commit to jin66god/workbuddy2api-panel that referenced this pull request Oct 19, 2026
…inguo2625469#225/linguo2625469#221/linguo2625469#212/linguo2625469#158 + 面板配置入口与 README 重构)

- linguo2625469#223 出站 Transport 读取 HTTP(S)_PROXY 环境变量
- linguo2625469#220 新增 cn.chat_base,修复海外出口 CN 模型全部缺失;models 拉取失败记 WARN
- linguo2625469#225 models.hidden 模型黑名单:列表过滤 + 点名 400,热生效
- linguo2625469#221 11158 区分账号类型无权限;模型锁按 realm 隔离;全池无权限返回 400
- linguo2625469#212 到期提醒快照与「检查」同口径:按日聚合批次、DeductionEndTime 优先
- linguo2625469#158 按地区独立调度:加权随机 / 轮询 / 顺序耗尽 + 账号顺序,热生效
- 面板「上游与高级」补 CN 上游地址与模型黑名单入口(含前端回归测试)
- README 精简重构:能力/配置/部署以本仓库为准,删除开发向流水账
- 新增 GitHub Issue 模板:Bug / 功能 / 其他
pardSun added a commit to pardSun/workbuddy2api-panel that referenced this pull request Oct 20, 2026
shinny-xionghongwei added a commit to shinny-xionghongwei/workbuddy2api-panel that referenced this pull request Oct 20, 2026
WilliamLuuu added a commit to WilliamLuuu/workbuddy2api-panel that referenced this pull request Oct 20, 2026
@linguo2625469
linguo2625469 merged commit 7c30d43 into linguo2625469:main Oct 21, 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。
qcgzxw added a commit to qcgzxw/workbuddy2api-panel that referenced this pull request Oct 21, 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