Repository navigation
feat(vertex): 支持按渠道切换 v1beta1 端点(#171) - #180
Merged
Merged
Conversation
Port upstream 94b5216 (QuantumNous#8179) onto the fork while preserving existing channel behavior. Closes #171
This was referenced Nov 5, 2026
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.
🔗 关联任务 / Related Issue
Closes #171
上游:
94b521664599d416fead8e57d8318717c0e29058(QuantumNous#8179)。仅向 fork main 提交。🚀 变更类型 / Type of change
📝 变更描述 / Description
Vertex 渠道可切换 Gemini/Imagen 请求到 v1beta1;默认仍为 v1。后端限制版本值,前端支持保存、回读和七语言文案,并复用现有 FormField/Switch。Claude 与开源模型的端点、fork 的项目 ID/区域行为保持不变。
原始移植修改授权的 13 个文件,稳定 patch-id 与上游一致:
69cf0d32dce40b6036971b8c306815b1cb9a8d56;以下独立审查返修另改 URL builder 与其既有测试文件,原 13 文件内容保持不变。本移植由 Codex AI 辅助完成,等待独立审查;未代替维护者作人工确认。📸 运行证明 / Proof of Work
原始候选
ec97b85233a88c497f8a7d5cadf96e33d1d47143的验证如下(本次返修未重跑前端/全量检查)。原始命令使用GOMAXPROCS=2 RAYON_NUM_THREADS=2。工具根T=/home/box/.parallel-project-orchestrator/programs/new-api-cherry-20261022/runtime/R0209W171/g4-R0209W171-94b521664-01/tools。GOWORK=off go test -p=2 -overlay=$T/go-overlay.json ./controller ./relay/channel/vertex -run 'TestR0209Vertex|TestGetRequestURLWithAPIKey|TestBuild.*URL' -count=1 -v通过。覆盖版本校验、两种凭据模式、Gemini/Imagen、流式、默认版本,以及 Claude/开源模型保持原行为。relaykit/:GOWORK=off go test -p=2 ./dto -count=1 -v与GOWORK=off go build -p=2 ./...均通过。web/:bun run test --config $T/vitest.config.ts --maxWorkers=1,6 个新用例通过;bun run test src/features/channels/lib/__tests__/vertex-channel.test.ts src/features/channels/components/__tests__/provider-selection.test.tsx --maxWorkers=1,39 个既有用例通过。web/:bun run typecheck、bun run build通过;./node_modules/.bin/oxlint --threads=2 -c .oxlintrc.json检查改动的三个 TS/TSX 文件通过;./node_modules/.bin/oxfmt --threads=2 --check检查上述文件及七个 locale 文件通过。node $T/browser-check.mjs:真实 ChannelMutateDrawer 配合隔离 API fixture;中文开关回读为开启,点击后关闭,无浏览器异常。已检查 1280px 与 390px 截图,分别为证据目录的vertex-beta-desktop.png、vertex-v1-mobile.png。证据目录:
/home/box/.parallel-project-orchestrator/programs/new-api-cherry-20261022/evidence/R0209W171/g4-R0209W171-94b521664-01(包含截图、原始日志、测试输入及 SHA-256 清单)。受源码所有权限制,新定向测试保存在独立工具/证据目录,通过 Go overlay 与外部 Vitest 配置执行,未新增仓库测试文件。限制:全库
bun run format:check报告 25 个未改动文件的既有格式问题,改动文件检查通过。未运行全量测试、真实供应商请求或生产部署;本次不改数据库、计费或鉴权逻辑,不涉及三数据库矩阵。独立审查 R171-1 返修(
1c582ca8edb0d9a9102ea686fc493bcfa4ac96bc):自定义 base 尾部/v1与/v1beta1随所选版本替换,避免双版本路径;保留自定义前缀、项目/区域/express 与 Claude/开源模型的固定版本路由。GOMAXPROCS=2 GOWORK=off go test -p=2 ./relay/channel/vertex/ -run 'TestGoogleModelURLVersionTransitions|TestNonGoogleModelURLsIgnoreGoogleAPIVersion' -count=1 -v复现双版本路径失败。GOMAXPROCS=2 GOWORK=off go test -p=2 ./relay/channel/vertex/ -count=1 -v通过;覆盖 API-key express/project、service-account 双向切换、默认/匹配版本与固定版本路由。gofmt、git diff --check通过。证据:/home/box/.parallel-project-orchestrator/programs/new-api-cherry-20261022/evidence/R0209W171R1/g4-R0209W171R1-vertex-version-transition-01。未运行真实供应商、数据库矩阵或部署;待独立复审。✅ 提交前检查项 / Checklist