feat(antigravity): 增强网关功能和 thinking 块处理
主要改进: - 优化 thinking blocks 过滤策略,支持 Auto 模式降级 - 将无效 thinking block 内容转为普通 text - 保留单个空白 text block,不过滤 - 重构配额刷新机制,统一与 Claude 一致 - 支持 cachedContentTokenCount 映射到 cache_read_input_tokens - Haiku 模型映射到 Sonnet - 添加 /antigravity/v1/models 端点支持 - countTokens 端点直接返回空值
This commit is contained in:
21
backend/internal/service/quota_fetcher.go
Normal file
21
backend/internal/service/quota_fetcher.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// QuotaFetcher 额度获取接口,各平台实现此接口
|
||||
type QuotaFetcher interface {
|
||||
// CanFetch 检查是否可以获取此账户的额度
|
||||
CanFetch(account *Account) bool
|
||||
// GetProxyURL 获取账户的代理 URL(如果没有代理则返回空字符串)
|
||||
GetProxyURL(ctx context.Context, account *Account) (string, error)
|
||||
// FetchQuota 获取账户额度信息
|
||||
FetchQuota(ctx context.Context, account *Account, proxyURL string) (*QuotaResult, error)
|
||||
}
|
||||
|
||||
// QuotaResult 额度获取结果
|
||||
type QuotaResult struct {
|
||||
UsageInfo *UsageInfo // 转换后的使用信息
|
||||
Raw map[string]any // 原始响应,可存入 account.Extra
|
||||
}
|
||||
Reference in New Issue
Block a user