File size: 6,167 Bytes
a21c316 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | export interface UpstreamProxyConfig {
enabled: boolean;
url: string;
}
export interface ProxyConfig {
enabled: boolean;
allow_lan_access?: boolean;
auth_mode?: 'off' | 'strict' | 'all_except_health' | 'auto';
port: number;
api_key: string;
admin_password?: string;
auto_start: boolean;
custom_mapping?: Record<string, string>;
request_timeout: number;
enable_logging: boolean;
debug_logging?: DebugLoggingConfig;
upstream_proxy: UpstreamProxyConfig;
zai?: ZaiConfig;
scheduling?: StickySessionConfig;
experimental?: ExperimentalConfig;
user_agent_override?: string;
saved_user_agent?: string;
thinking_budget?: ThinkingBudgetConfig;
global_system_prompt?: GlobalSystemPromptConfig;
image_thinking_mode?: 'enabled' | 'disabled'; // [NEW] 图像思维模式开关
proxy_pool?: ProxyPoolConfig;
}
// ============================================================================
// Thinking Budget 配置 (控制 AI 深度思考时的 Token 预算)
// ============================================================================
/** Thinking Budget 处理模式 */
export type ThinkingBudgetMode = 'auto' | 'passthrough' | 'custom' | 'adaptive'; // [NEW] 支持自适应模式
/** Thinking Effort 等级 (仅 adaptive 模式) */
export type ThinkingEffort = 'low' | 'medium' | 'high';
/** Thinking Budget 配置 */
export interface ThinkingBudgetConfig {
/** 模式选择 */
mode: ThinkingBudgetMode;
/** 自定义固定值(仅在 mode=custom 时生效),范围 1024-65536 */
custom_value: number;
/** 思考强度 (仅在 mode=adaptive 时生效) */
effort?: ThinkingEffort;
}
// ============================================================================
// 全局系统提示词配置
// ============================================================================
/** 全局系统提示词配置 */
export interface GlobalSystemPromptConfig {
/** 是否启用 */
enabled: boolean;
/** 提示词内容 */
content: string;
}
export interface DebugLoggingConfig {
enabled: boolean;
output_dir?: string;
}
export type SchedulingMode = 'CacheFirst' | 'Balance' | 'PerformanceFirst';
export interface StickySessionConfig {
mode: SchedulingMode;
max_wait_seconds: number;
}
export type ZaiDispatchMode = 'off' | 'exclusive' | 'pooled' | 'fallback';
export interface ZaiMcpConfig {
enabled: boolean;
web_search_enabled: boolean;
web_reader_enabled: boolean;
vision_enabled: boolean;
}
export interface ZaiModelDefaults {
opus: string;
sonnet: string;
haiku: string;
}
export interface ZaiConfig {
enabled: boolean;
base_url: string;
api_key: string;
dispatch_mode: ZaiDispatchMode;
model_mapping?: Record<string, string>;
models: ZaiModelDefaults;
mcp: ZaiMcpConfig;
}
export interface ScheduledWarmupConfig {
enabled: boolean;
monitored_models: string[];
}
export interface QuotaProtectionConfig {
enabled: boolean;
threshold_percentage: number; // 1-99
monitored_models: string[];
}
export interface PinnedQuotaModelsConfig {
models: string[];
}
export interface ExperimentalConfig {
enable_usage_scaling: boolean;
context_compression_threshold_l1?: number;
context_compression_threshold_l2?: number;
context_compression_threshold_l3?: number;
}
export interface CircuitBreakerConfig {
enabled: boolean;
backoff_steps: number[];
}
export interface AppConfig {
language: string;
theme: string;
auto_refresh: boolean;
refresh_interval: number;
auto_sync: boolean;
sync_interval: number;
default_export_path?: string;
antigravity_executable?: string; // [NEW] 手动指定的反重力程序路径
antigravity_args?: string[]; // [NEW] Antigravity 启动参数
auto_launch?: boolean; // 开机自动启动
auto_check_update?: boolean; // 自动检查更新
update_check_interval?: number; // 更新检查间隔(小时)
accounts_page_size?: number; // 账号列表每页显示数量,默认 0 表示自动计算
hidden_menu_items?: string[]; // 隐藏的菜单项路径列表
scheduled_warmup: ScheduledWarmupConfig;
quota_protection: QuotaProtectionConfig; // [NEW] 配额保护配置
pinned_quota_models: PinnedQuotaModelsConfig; // [NEW] 配额关注列表
circuit_breaker: CircuitBreakerConfig; // [NEW] 熔断器配置
proxy: ProxyConfig;
cloudflared: CloudflaredConfig; // [NEW] Cloudflared 配置
}
// ============================================================================
// Cloudflared (CF隧道) 类型定义
// ============================================================================
export type TunnelMode = 'quick' | 'auth';
export interface CloudflaredConfig {
enabled: boolean;
mode: TunnelMode;
port: number;
token?: string;
use_http2: boolean;
}
export interface CloudflaredStatus {
installed: boolean;
version?: string;
running: boolean;
url?: string;
error?: string;
}
// ============================================================================
// 代理池类型定义
// ============================================================================
export interface ProxyAuth {
username: string;
password?: string;
}
export interface ProxyEntry {
id: string;
name: string;
url: string;
auth?: ProxyAuth;
enabled: boolean;
priority: number;
tags: string[];
max_accounts?: number;
health_check_url?: string;
last_check_time?: number;
is_healthy: boolean;
latency?: number; // [NEW] 延迟 (毫秒)
}
// export type ProxyPoolMode = 'global' | 'per_account' | 'hybrid'; // [REMOVED]
export type ProxySelectionStrategy = 'round_robin' | 'random' | 'priority' | 'least_connections' | 'weighted_round_robin';
export interface ProxyPoolConfig {
enabled: boolean;
// mode: ProxyPoolMode; // [REMOVED]
proxies: ProxyEntry[];
health_check_interval: number;
auto_failover: boolean;
strategy: ProxySelectionStrategy;
account_bindings?: Record<string, string>;
}
|