feat(groups): add Claude Code client restriction and session isolation

- Add claude_code_only field to restrict groups to Claude Code clients only
- Add fallback_group_id for non-Claude Code requests to use alternate group
- Implement ClaudeCodeValidator for User-Agent detection
- Add group-level session binding isolation (groupID in Redis key)
- Prevent cross-group sticky session pollution
- Update frontend with Claude Code restriction controls
This commit is contained in:
Edric Li
2026-01-08 23:07:00 +08:00
parent 958ffe7a8a
commit a42105881f
31 changed files with 1284 additions and 50 deletions

View File

@@ -263,6 +263,9 @@ export interface Group {
image_price_1k: number | null
image_price_2k: number | null
image_price_4k: number | null
// Claude Code 客户端限制
claude_code_only: boolean
fallback_group_id: number | null
account_count?: number
created_at: string
updated_at: string
@@ -298,6 +301,15 @@ export interface CreateGroupRequest {
platform?: GroupPlatform
rate_multiplier?: number
is_exclusive?: boolean
subscription_type?: SubscriptionType
daily_limit_usd?: number | null
weekly_limit_usd?: number | null
monthly_limit_usd?: number | null
image_price_1k?: number | null
image_price_2k?: number | null
image_price_4k?: number | null
claude_code_only?: boolean
fallback_group_id?: number | null
}
export interface UpdateGroupRequest {
@@ -307,6 +319,15 @@ export interface UpdateGroupRequest {
rate_multiplier?: number
is_exclusive?: boolean
status?: 'active' | 'inactive'
subscription_type?: SubscriptionType
daily_limit_usd?: number | null
weekly_limit_usd?: number | null
monthly_limit_usd?: number | null
image_price_1k?: number | null
image_price_2k?: number | null
image_price_4k?: number | null
claude_code_only?: boolean
fallback_group_id?: number | null
}
// ==================== Account & Proxy Types ====================