Merge branch 'feature/gemini-quota' (PR #113)

feat: Gemini 配额模拟和限流功能

主要变更:
- 新增 GeminiQuotaService 实现基于 Tier 的配额管理
- RateLimitService 增加 PreCheckUsage 预检查功能
- gemini_oauth_service 改进 tier_id 处理逻辑(向后兼容)
- 前端新增配额可视化组件 (AccountQuotaInfo.vue)
- 数据库迁移: 为现有 Code Assist 账号添加默认 tier_id

技术细节:
- 支持 LEGACY/PRO/ULTRA 三种配额等级
- 配额策略可通过配置文件或数据库设置覆盖
- fetchProjectID 返回值保留 tierID(即使 projectID 获取失败)
- 删除冗余类型别名 ClaudeCustomToolSpec
This commit is contained in:
shaw
2026-01-01 10:58:11 +08:00
30 changed files with 1802 additions and 105 deletions

View File

@@ -96,7 +96,7 @@ func TestBuildTools_CustomTypeTools(t *testing.T) {
{
Type: "custom",
Name: "mcp_tool",
Custom: &ClaudeCustomToolSpec{
Custom: &CustomToolSpec{
Description: "MCP tool description",
InputSchema: map[string]any{
"type": "object",
@@ -121,7 +121,7 @@ func TestBuildTools_CustomTypeTools(t *testing.T) {
{
Type: "custom",
Name: "custom_tool",
Custom: &ClaudeCustomToolSpec{
Custom: &CustomToolSpec{
Description: "Custom tool",
InputSchema: map[string]any{"type": "object"},
},
@@ -148,7 +148,7 @@ func TestBuildTools_CustomTypeTools(t *testing.T) {
{
Type: "custom",
Name: "invalid_custom",
Custom: &ClaudeCustomToolSpec{
Custom: &CustomToolSpec{
Description: "Invalid",
// InputSchema 为 nil
},