- 完全重构前端管理界面,采用模块化架构 - 新增独立的 CSS 和 JS 模块(utils, auth, channels, tokens, pricing, api-test, database) - 实现统一的 loading 遮罩效果,所有 API 请求自动显示加载状态 - 添加现代化多选下拉框组件用于频道选择 - 实现模型部署映射的可视化表格编辑 - 修复页面高度自适应问题,管理页面占满全屏 - 优化侧边栏布局,添加 GitHub 链接和版本号 - 令牌管理页面隐藏敏感 key,添加复制功能 - 管理页面切换时自动重置为列表视图并重新加载数据 - 新增 Claude Proxy 提供商支持 - 统一所有 API 调用的错误处理和 loading 状态管理 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
82 lines
1.5 KiB
TypeScript
82 lines
1.5 KiB
TypeScript
type Variables = {
|
|
lang: string | undefined | null
|
|
}
|
|
|
|
type CloudflareBindings = {
|
|
DB: D1Database;
|
|
ASSETS: Fetcher;
|
|
ADMIN_TOKEN: string;
|
|
}
|
|
|
|
type HonoCustomType = {
|
|
"Bindings": CloudflareBindings;
|
|
"Variables": Variables;
|
|
}
|
|
|
|
// 数据库表行的基础结构
|
|
type BaseDbRow = {
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// channel_config 表的行结构
|
|
type ChannelConfigRow = BaseDbRow & {
|
|
key: string;
|
|
value: string; // JSON 字符串,解析后为 ChannelConfig 类型
|
|
}
|
|
|
|
// api_token 表的行结构
|
|
type ApiTokenRow = BaseDbRow & {
|
|
key: string;
|
|
value: string; // JSON 字符串,解析后为 ApiTokenData 类型
|
|
usage: number;
|
|
}
|
|
|
|
type ChannelType = "azure-openai" | "openai" | "claude" | undefined | null;
|
|
|
|
type ChannelConfig = {
|
|
name: string;
|
|
type: ChannelType;
|
|
endpoint: string;
|
|
api_key: string;
|
|
api_version?: string;
|
|
deployment_mapper: Record<string, string>;
|
|
model_pricing?: Record<string, ModelPricing>;
|
|
}
|
|
|
|
type ChannelConfigMap = {
|
|
[key: string]: ChannelConfig;
|
|
}
|
|
|
|
type OpenAIResponse = {
|
|
usage?: Usage
|
|
}
|
|
|
|
type Usage = {
|
|
prompt_tokens?: number,
|
|
completion_tokens?: number,
|
|
total_tokens?: number,
|
|
}
|
|
|
|
type AwslKeyPayload = {
|
|
channel_key: string;
|
|
multipler: number | undefined | null;
|
|
}
|
|
|
|
type CommonResponse = {
|
|
success?: boolean;
|
|
message?: string;
|
|
data?: any;
|
|
}
|
|
|
|
type ModelPricing = {
|
|
input: number;
|
|
output: number;
|
|
}
|
|
|
|
type ApiTokenData = {
|
|
name: string;
|
|
channel_keys: string[];
|
|
total_quota: number;
|
|
}
|