sususu98
d21d70a5cf
fix: include Gemini thoughtsTokenCount in output token billing
...
Gemini 2.5 Pro/Flash thinking models return thoughtsTokenCount separately
from candidatesTokenCount in usageMetadata, but this field was not parsed
or included in billing calculations, causing thinking tokens to be
unbilled.
- Add ThoughtsTokenCount field to GeminiUsageMetadata struct
- Include thoughtsTokenCount in OutputTokens across all 3 Gemini usage
parsing paths (non-streaming, streaming, compat layer)
- Add tests covering thinking token scenarios
Closes #554
2026-02-11 15:41:54 +08:00
erio
6d90fb0bc3
feat: detect client disconnect during streaming and continue draining upstream for billing
2026-02-09 07:06:26 +08:00
erio
5e98445b22
feat(antigravity): comprehensive enhancements - model mapping, rate limiting, scheduling & ops
...
Key changes:
- Upgrade model mapping: Opus 4.5 → Opus 4.6-thinking with precise matching
- Unified rate limiting: scope-level → model-level with Redis snapshot sync
- Load-balanced scheduling by call count with smart retry mechanism
- Force cache billing support
- Model identity injection in prompts with leak prevention
- Thinking mode auto-handling (max_tokens/budget_tokens fix)
- Frontend: whitelist mode toggle, model mapping validation, status indicators
- Gemini session fallback with Redis Trie O(L) matching
- Ops: enhanced concurrency monitoring, account availability, retry logic
- Migration scripts: 049-051 for model mapping unification
2026-02-07 12:31:10 +08:00
song
2220fd18ca
merge upstream main
2026-02-03 15:36:17 +08:00
song
f761afb1ef
antigravity: 区分切换后重试次数
2026-01-28 00:01:03 +08:00
song
fd0370c07a
Add invalid-request fallback routing
2026-01-23 22:24:46 +08:00
IanShaw027
06216aad53
fix(backend): 修复 CI 失败问题
...
修复内容:
1. 修复 6 个 golangci-lint 错误
- 3 个 errcheck 错误:在 gateway_request_test.go 中添加类型断言检查
- 3 个 gofmt 格式化问题:修复代码格式
2. 修复 API 契约测试失败
- 在测试中添加缺失的字段:enable_identity_patch 和 identity_patch_prompt
所有测试和 linter 检查现已通过。
2026-01-05 00:56:48 +08:00
IanShaw027
87426e5dda
fix(backend): 改进 thinking/tool block 签名处理和重试策略
...
主要改动:
- request_transformer: thinking block 缺少签名时降级为文本而非丢弃,保留内容并在上层禁用 thinking mode
- antigravity_gateway_service: 新增两阶段降级策略,先处理 thinking blocks,如仍失败且涉及 tool 签名错误则进一步降级 tool blocks
- gateway_request: 新增 FilterSignatureSensitiveBlocksForRetry 函数,支持将 tool_use/tool_result 降级为文本
- gateway_request: 改进 FilterThinkingBlocksForRetry,禁用顶层 thinking 配置以避免结构约束冲突
- gateway_service: 实现保守的两阶段重试逻辑,优先保留内容,仅在必要时降级工具调用
- 新增 antigravity_gateway_service_test.go 测试签名块剥离逻辑
- 更新相关测试用例以验证降级行为
此修复解决了跨平台/账户切换时历史消息签名失效导致的请求失败问题。
2026-01-04 22:32:36 +08:00