feat(antigravity): 添加专用路由,支持仅使用 antigravity 账户

添加 /antigravity/v1/* 和 /antigravity/v1beta/* 路由:
- 通过 ForcePlatform 中间件强制使用 antigravity 平台
- 跳过混合调度逻辑,仅调度 antigravity 账户
- 支持按分组优先查找,找不到时回退查询全部 antigravity 账户

修复 context key 类型不匹配问题:
- middleware 和 service 统一使用字符串常量 "ctx_force_platform"
- 解决 Go context.Value() 类型+值匹配导致的读取失败

其他改动:
- 嵌入式前端中间件白名单添加 /antigravity/ 路径
- e2e 测试 Gemini 端点 URL 添加 endpointPrefix 支持
This commit is contained in:
song
2025-12-29 16:52:55 +08:00
parent 1ad29032d3
commit b31bfd53ab
8 changed files with 129 additions and 16 deletions

View File

@@ -231,7 +231,7 @@ func testGeminiGenerate(t *testing.T, model string, stream bool) {
if stream {
action = "streamGenerateContent"
}
url := fmt.Sprintf("%s/v1beta/models/%s:%s", baseURL, model, action)
url := fmt.Sprintf("%s%s/v1beta/models/%s:%s", baseURL, endpointPrefix, model, action)
if stream {
url += "?alt=sse"
}