Files
claude-code-router/ui/src/types.ts
2025-09-02 12:13:54 +08:00

71 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export interface ProviderTransformer {
use: (string | (string | Record<string, unknown> | { max_tokens: number })[])[];
[key: string]: any; // Allow for model-specific transformers
}
export interface Provider {
name: string;
api_base_url: string;
api_key: string;
models: string[];
transformer?: ProviderTransformer;
}
export interface RouterConfig {
default: string;
background: string;
think: string;
longContext: string;
longContextThreshold: number;
webSearch: string;
image: string;
custom?: any;
}
export interface Transformer {
name?: string;
path: string;
options?: Record<string, any>;
}
export interface StatusLineModuleConfig {
type: string;
icon?: string;
text: string;
color?: string;
background?: string;
scriptPath?: string; // 用于script类型的模块指定要执行的Node.js脚本文件路径
}
export interface StatusLineThemeConfig {
modules: StatusLineModuleConfig[];
}
export interface StatusLineConfig {
enabled: boolean;
currentStyle: string;
default: StatusLineThemeConfig;
powerline: StatusLineThemeConfig;
fontFamily?: string;
}
export interface Config {
Providers: Provider[];
Router: RouterConfig;
transformers: Transformer[];
StatusLine?: StatusLineConfig;
forceUseImageAgent?: boolean;
// Top-level settings
LOG: boolean;
LOG_LEVEL: string;
CLAUDE_PATH: string;
HOST: string;
PORT: number;
APIKEY: string;
API_TIMEOUT_MS: string;
PROXY_URL: string;
CUSTOM_ROUTER_PATH?: string;
}
export type AccessLevel = 'restricted' | 'full';