Skip to content

refactor(endpoints): 精简为国内与海外两条线路#33

Merged
krisxia0506 merged 2 commits into
mainfrom
refactor/simplify-api-endpoints
Jul 13, 2026
Merged

refactor(endpoints): 精简为国内与海外两条线路#33
krisxia0506 merged 2 commits into
mainfrom
refactor/simplify-api-endpoints

Conversation

@krisxia0506

Copy link
Copy Markdown
Collaborator

变更类型

类型:refactor

影响范围

模块:其他

变更描述

将 API 线路从 4 条精简为 2 条:国内 api.qnaigc.com、海外 api.modelink.ai,并同步更新文案与测试。

动机和背景

统一接入点配置,移除不再使用的 openai.qiniu.comopenai.sufy.com 线路,降低用户选择成本。

具体改动

  • 移除 qiniumodelink 独立线路及原 international(sufy)配置
  • 保留 china(国内)与 international(海外,指向 api.modelink.ai
  • 默认线路从 qiniu 改回 china
  • 更新中英文文案、CLAUDE.md 及 Hermes 相关测试

测试情况

  • pnpm build 通过
  • node --test tests/*.test.mjs 全部 36 项测试通过

移除 qiniu 与 sufy 线路,默认线路改回 china,海外线路统一使用 api.modelink.ai。

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

本拉取请求(PR)主要对 API 线路进行了清理和整合。具体修改包括:删除了已废弃的 qiniu (openai.qiniu.com) 和 sufy (openai.sufy.com) 线路;将默认线路(DEFAULT_ENDPOINT)变更为 china (api.qnaigc.com);将 international 线路的地址更新为 api.modelink.ai。同时,PR 同步更新了 CLAUDE.md 文档、中英文语言包(zh_CN.jsonen_US.json)以及相关的测试用例(tests/hermes-tool.test.mjs)。受影响的模块包括端点配置、国际化语言包、文档和测试。该改动在配置、本地化和测试中保持了一致性,可以安全合并。置信度评分为 5/5。目前没有发现任何问题,无进一步反馈。

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.

@fennoai fennoai Bot 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.

Review findings:

  • README.md:30, README.md:211: The user-facing README still documents the removed openai.qiniu.com, openai.sufy.com, and separate Modelink routes, and its examples still show the old default endpoint. After this PR, new users reading the published README will see a four-route setup that the CLI no longer offers. Please update the README endpoint list and sample generated configs to match the two supported routes.

Findings without inline locations

  • src/lib/endpoints.ts:28: Existing users can already have endpoint: modelink in ~/.coding-helper/config.yaml from the previous release. With modelink removed from ENDPOINT_DEFINITIONS, getBaseUrl('modelink') now falls through to DEFAULT_ENDPOINT, which this PR changes to the China route. That silently moves those users from https://api.modelink.ai to https://api.qnaigc.com on the next auth reload, doctor, or model fetch. Please add a compatibility mapping or migration so the old modelink ID resolves to the new international route instead of the default.

@github-actions

Copy link
Copy Markdown
Contributor

Codex 评审

结论:需要关注

发现的问题

  1. src/lib/endpoints.ts:25:旧配置中的 endpoint: modelink 会被静默回退到默认国内线路 https://api.qnaigc.com。PR 将 modelink id 删除,但新的海外线路实际仍是 https://api.modelink.ai,因此已选择 Modelink 的老用户升级后执行 doctorauth、模型选择或各工具的“配置装载”时,会把 Claude/Codex/CodeBuddy/WorkBuddy/Hermes 写成国内线路,而不是原来的 Modelink。建议为旧 id 做兼容映射,例如 modelink -> international,并补充配置迁移/回退测试。

  2. src/lib/wizard/ui/ui-renderer.ts:34:旧配置中的 endpoint: qiniuendpoint: modelink 在顶部配置面板会显示为“未设置”,但实际 configManager.baseUrl 又会回退到默认国内线路。这会造成交互体验不一致:用户看到线路未配置,却可能继续向真实工具配置写入默认线路。建议渲染层和配置读取层使用同一套规范化逻辑,或在读取旧 endpoint 时迁移保存为新 id。

  3. README 仍保留 4 条旧线路和 openai.qiniu.com / openai.sufy.com 示例,例如 README.md:30README.md:211README.md:223README.md:244README.md:268README.md:303。虽然运行时代码已改为两条线路,但用户文档会继续指导用户理解为 4 条线路,并展示已移除端点,建议同步更新中英文 README。

验证说明

已按要求读取 codex-unit-test.logcodex-interactive-test.logcodex-interactive-report.md。日志显示 pnpm test: success,36 项单元测试通过;pnpm test:interactive: success,主菜单、工具选择器以及 Claude Code、Codex、CodeBuddy、WorkBuddy、Hermes Agent 菜单键盘导航均通过。交互报告未显示菜单闪烁超阈值、方向键失效、回车失效、卡住或退出失败;脚本也使用临时 HOME 目录隔离测试配置。

@github-actions github-actions Bot added the codex: needs attention Codex PR review found issues that need attention label Jul 13, 2026
精简线路后,老用户 config.yaml 中残留的 modelink / qiniu id
会命中不到定义表而回退到默认国内线路,导致原 Modelink 海外
用户被静默切到 api.qnaigc.com。

- 新增 normalizeEndpointId 与旧 id 映射(modelink→international、
  qiniu→china),getBaseUrl 与 getEndpoint 读取时规范化
- 渲染层经规范化后正确显示线路,不再显示"未设置"
- 同步更新中英文 README 线路文案与工具配置示例
- 新增 endpoints 迁移测试覆盖旧 id 映射与未知 id 回退
@github-actions

Copy link
Copy Markdown
Contributor

Codex 评审

结论:通过

发现的问题

未发现本 PR 引入的阻断性问题。

本次变更影响的主要路径是 API 线路定义、默认线路、旧线路 ID 兼容、线路选择向导、状态栏线路展示,以及 authdoctor、模型拉取和各工具适配器写入配置时使用的 configManager.baseUrl。代码中旧 modelink 会规范化到 international 并继续使用 https://api.modelink.ai,旧 qiniu 会规范化到 china 并使用新的国内线路 https://api.qnaigc.com;线路选择菜单只暴露国内/海外两项,未看到会导致错误地址、缺失 i18n key 或工具配置写入异常的路径。

交互风险检查

codex-interactive-report.md 显示主菜单、工具选择器,以及 Claude Code、Codex、CodeBuddy、WorkBuddy、Hermes Agent 工具菜单均通过真实伪终端场景。未发现菜单持续闪烁、重复刷新超阈值、方向键无法选择、回车无法确认、菜单无法退出或终端输出不可读的问题。

交互脚本使用临时 HOME/USERPROFILE 并在结束后清理,未看到测试污染真实 HOME 的迹象。

测试/验证

已读取验证文件作为证据:

  • pnpm test: success,codex-unit-test.log 显示 41 项通过。
  • pnpm test:interactive: success,codex-interactive-report.md 中所有交互场景均 passed。

@github-actions github-actions Bot removed the codex: needs attention Codex PR review found issues that need attention label Jul 13, 2026
@krisxia0506 krisxia0506 merged commit dd89af8 into main Jul 13, 2026
6 checks passed
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