Skip to content

fix(web): scope CC Switch models to the selected API key - #589

Merged
LIghtJUNction merged 4 commits into
mainfrom
codex/quality-ccswitch-models-20261003
Oct 3, 2026
Merged

LIghtJUNction merged 4 commits into
mainfrom
codex/quality-ccswitch-models-20261003

Conversation

@LIghtJUNction

@LIghtJUNction LIghtJUNction commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

LMM API Pull Request

变更说明 / Summary

CCSwitch 原来使用账号模型目录,可能向只允许 allowed-model 的 Key 提供 denied-model。改为携带当前 Key 查询本实例 /v1/models,直接继承真实 TokenAuth 的普通/Auto 分组、模型限制、价格可见性、过期及停用规则。

换 Key、关闭或重新打开时重建选择与短期缓存;加载、刷新、错误及失效时阻止导出,点击时再次检查查询状态。模型查询固定使用本实例地址,禁止重定向,不携带 console cookie。请求限 15 秒,响应限 1 MiB/10,000 个模型/512 字符 ID;缓存仅保留模型 ID 和固定错误。Key 不进入查询键、持久化存储或错误内容。余额授权沿用现有独立操作。

与上游的关系 / Upstream relationship

  • LMM API 独有变更 / LMM API-specific change

上游参考 / Upstream reference: N/A。修复本仓库 CCSwitch 与 relay 授权目录不一致的问题;保留现有来源、版权及许可证信息。

关联 Issue / Related issue

Refs #380。这里只解决 CCSwitch 模型目录这一处问题;新用户接入、运营分析及真实客户端/数据库/部署验收的剩余项继续由该 issue 跟踪。

变更类型 / Type of change

  • Bug 修复 / Bug fix
  • 前端或交互 / Frontend or UX

验证 / Verification

原始修复提交 fbc74da956dbfc8176e8d2b8c3690fc1d029e599。

首次整合 head efdc1d52d7242ee6bff5e77b8dcc74a2b3ff0c0f 无冲突正常 merge main 565c99e5b;12 项直接 Web 回归、全 app typecheck、变更文件 lint/format、真实 router regular 再次通过。相关源码未变,race/vet 沿用下述原始源结果。

最终 immutable head 3d2497c79a70b2f2ac6e1dee45ed056343cd9e27 正常 merge #591 的 WS 失败限额释放修复;原六个 CCSwitch 文件 byte-identical,新增仅两个 WS 文件。完整 relay race/vet 再次通过。旧服务器验收唯一失败已确认为 main 既有 WS 竞态;此 head 的 CI、完整服务器资格、CodeQL 和 browser-review 均已通过,无失败或待执行项。依赖 #591 已合入。

  • 红绿 DOM 回归:旧代码实际列出当前 Key 禁止的模型;修复后只列出该 Key 的 relay 目录。轮换、迟到响应、无 ID 的一次性 Key、并行弹窗、刷新期间点击、撤销/过期及错误脱敏均通过。
  • pinned Bun 1.3.14:31 项相关 Web 测试、全量 typecheck、生产 build、变更文件 lint/format 通过。新增文案复用现有翻译键。
  • Go 仅增加真实 router 回归。普通分组、自定义 Auto 分组、模型限制、价格过滤、配置更新、过期/停用校验 regular/race/vet 均通过;查询前后余额、消费、请求次数不变。
  • 未执行真实 CCSwitch 客户端导入及付费请求验收,未部署。

截图或日志 / Screenshots or logs

回归使用原生组件 DOM 与真实 TokenAuth router;测试直接断言可见模型、Authorization 隔离、余额状态及缓存中不包含凭据。敏感值均为测试占位符。

提交检查 / Checklist

  • 我已搜索本仓库的 Issues 和 PRs,确认没有重复工作。
  • 此 PR 只包含与当前目标相关的改动,未混入格式化或其他无关变更。
  • 我已说明该变更对当前产品流程或兼容行为的影响,并保留必要的来源、版权和许可证信息。
  • 我已检查兼容性;如有破坏性变化,已在说明中明确列出迁移方式。
  • 我已补充或更新相关测试,并在上方记录实际验证结果;如未测试,已说明原因。
  • 我已更新受影响的文档、示例配置和多语言文案(如适用)。
  • 代码、日志、截图和提交记录中不包含 API Key、Cookie、Token、密码、DSN 或其他敏感信息。

Fetch the selected credential’s relay catalogue, isolate short-lived selectors, and block exports during loading or failed authorization. Cover DOM isolation and the real TokenAuth group, model-limit, pricing and expiry boundaries.

Refs #380.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-03T13:34:57.594665Z efdc1d5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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