Repository navigation
Conversation
|
All contributors have signed the CLA. ✅ |
- 并入上游已合 PR:Wei-Shaw#8381 Wei-Shaw#8566 Wei-Shaw#8631 Wei-Shaw#8637 Wei-Shaw#8161 Wei-Shaw#8346 Wei-Shaw#8642 Wei-Shaw#8367 Wei-Shaw#8357 Wei-Shaw#8622,Wei-Shaw#8621 仅并测试 - 并入上游开放 PR:Wei-Shaw#8627 单请求最多冷却一个账号、Wei-Shaw#8619 Gemini 兼容下发思考、Wei-Shaw#8596 Wei-Shaw#8597 Wei-Shaw#8598 测试同步 - 新增迁移 249_add_usage_logs_api_key_cost_index_notx,与现有 249 迁移并存 - 后端 unit 测试、golangci-lint、前端 lint/typecheck/全部 vitest 通过;repository 集成测试未跑
I have read the CLA Document and I hereby sign the CLA |
…tible endpoints The Antigravity compat path (/v1/chat/completions, /v1/responses) converted the Anthropic-shaped intermediate request to Gemini with convertClaudeMessagesToGeminiGenerateContent, which drops thinking / output_config.effort. No generationConfig.thinkingConfig reached v1internal, and Antigravity does not enable thinking from the -high/-low model-name suffix alone, so reasoning_effort / reasoning.effort had no effect and no reasoning content was returned. Write thinkingLevel (Gemini 3+) or thinkingBudget (2.5) plus includeThoughts from the client intent, including tier-suffixed models. Requests without a thinking intent are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
5d8db69 to
2b2f64a
Compare
|
recheck |
|
I have read the CLA Document and I hereby sign the CLA |
- 带入上游 11-16 已合的 55 个 PR,同步基准更新为 9cd1a1e;用量汇总改为非阻塞建表(Wei-Shaw#8693),被动用量换窗清理与 Fable 限额恢复采用上游实现(Wei-Shaw#8723 Wei-Shaw#8779)。 - Codex 独立上下文改用上游 Wei-Shaw#8769 的 user 文本归一化,撤回 fork 的 Wei-Shaw#8680 并补回 proposed_plan、guardian、cloud_threads 等类型;Gemini 思考等级改用 Wei-Shaw#8673,撤回 fork 的 Wei-Shaw#8619。 - 合入 24 个开放 PR,Wei-Shaw#8781 与 Wei-Shaw#8705 部分合入;Wei-Shaw#8856、Wei-Shaw#8858 与已有实现重复,未合入。 - 修复转义的 1h TTL 被快速路径漏判,并按 fork 的构造参数与模型目录调整上游测试。 - 后端全量 unit、golangci-lint、前端 vitest、迁移空库回放与 CI 集成测试通过;go.sum 未整理。
背景 / Background
在 Antigravity 账号上通过 OpenAI 兼容端点(
/v1/chat/completions、/v1/responses)调用gemini-*模型时,即使请求了思考(reasoning_effort/reasoning.effort),模型也不会思考,也不返回reasoning_content。Gemini models on Antigravity accounts never think through the OpenAI-compatible endpoints, even when the client asks for reasoning.
根因 / Root cause:
buildAntigravityCompatGeminiBody对gemini-模型调用convertClaudeMessagesToGeminiGenerateContent,其中convertClaudeGenerationConfig只复制max_tokens/temperature/top_p/stop_sequences。中间 Anthropic 请求里的thinking/output_config.effort被丢弃,generationConfig.thinkingConfig从未发给 v1internal。v0.2.19 中代码相同,不是近期回归。上游实测 / Observed upstream behaviour(Antigravity,
gemini-4-argon-high,经原生/antigravity/v1beta/models/...:generateContent透传 generationConfig):thoughtsTokenCount),尽管模型名带-highthinkingLevel: "high"thinkingLevel: "low"(简单提示)thinkingBudget: -1thinkingBudget: 8192+includeThoughtsincludeThoughts: truethought=trueparts修复前:Chat Completions
reasoning_effort: "high"+gemini-4-argon-high→completion_tokens8,无reasoning_content。所以 Antigravity 不会仅凭模型名后缀启用思考,必须显式下发 thinkingConfig。
改动 / Changes
applyAntigravityCompatGeminiThinkingConfig,在 Antigravity 兼容路径的 Gemini 分支中调用:thinking非 enabled/adaptive 且无output_config.effort)时不改请求体,保持原有行为。thinkingLevel,复用geminiThinkingLevelFor;无法从意图得出时取模型名后缀档位,最后回退high。带-high/-medium/-low后缀的模型同样显式下发。thinkingBudget(geminiThinkingBudgetFor,否则-1动态)。includeThoughts: true,使 thought parts 经现有的流/非流转换器变成reasoning_content/ reasoning 输出;minimal或 budget0时不写。applyGeminiCompatThinkingConfig未改动:它对带档位后缀的模型跳过thinkingLevel,上面的实测只针对 Antigravity,没有证据表明 Gemini 平台也需要改。未改动 / Intentionally unchanged
getMappedModelForThinkingLevel)与计费reasoning_effort保持原样;测试中断言了UpstreamModel与ReasoningEffort。/v1/messages走antigravity.TransformClaudeToGeminiWithOptions,下发的是thinkingBudget(-1或budget_tokens)。按上表,固定预算(如 8192)在gemini-4-argon-high上可能不思考,这可能是另一个问题,本 PR 不涉及。测试 / Tests
新增
antigravity_gateway_compat_thinking_test.go:applyAntigravityCompatGeminiThinkingConfig单元表(17 例):3.x 裸模型 / 带后缀模型 / flash / 2.5 budget / 无意图 / disabled / minimal / 非 gemini 等。ForwardAsChatCompletions、ForwardAsResponses检查包装后的 v1internal 请求体request.generationConfig.thinkingConfig,覆盖gemini-4-argon-high、gemini-3.5-flash、gemini-2.5-flash、未请求思考的情况。去掉修复后这些用例失败。thoughtparts 映射为reasoning_content。验证(Go 1.27.3,macOS arm64):
go test ./internal/service/... ./internal/pkg/... -count=1通过go vet ./internal/service/通过golangci-lint run ./internal/service/...(v2.14.0)0 issues