storage/mod.rs (2957 -> 1834 行): - 抽出 tests.rs: 17 个测试函数 - 抽出 row_mapping.rs: 8 个 row<->record 映射与单记录查询函数 - 抽出 migrations.rs: 7 个 schema 迁移函数 (ensure_*_schema, has_column, add_column_if_missing) ConfigPage.tsx (1568 -> 1235 行): - 抽出 types.ts: 所有接口/类型定义 - 抽出 constants.ts: TABS, inputCls, selectCls, TIMEZONE_OPTIONS - 抽出 ui.tsx: Field, Toggle, TagEditor, SectionCard, SourceEditor, MapEntryHeader - 抽出 api/expert.ts: getSelectedExpert, selectExpert (经 ConfigPage 再导出保持兼容) 验证: cargo build, cargo test --lib storage:: 17/17, npm run build 对抗性检查: 8/8 通过 (无丢失/重复函数, 无循环依赖, 无未使用导入)
51 lines
3.0 KiB
TypeScript
51 lines
3.0 KiB
TypeScript
// Config-related constants extracted from ConfigPage.tsx
|
|
import {
|
|
Settings, Cpu, Bot, Clock, Calendar, Wrench, Brain, Image,
|
|
Plug, Radio, Wifi, Server, Users, UserCheck,
|
|
} from 'lucide-react'
|
|
import type { TabId } from './types'
|
|
|
|
export const TABS: { id: TabId; label: string; icon: typeof Settings }[] = [
|
|
{ id: 'providers', label: '服务商', icon: Cpu },
|
|
{ id: 'models', label: '模型', icon: Brain },
|
|
{ id: 'agents', label: '代理', icon: Bot },
|
|
{ id: 'mcp', label: 'MCP 服务器', icon: Plug },
|
|
{ id: 'skills', label: '技能', icon: Wrench },
|
|
{ id: 'subagents', label: '子代理', icon: Bot },
|
|
{ id: 'experts', label: '专家', icon: UserCheck },
|
|
{ id: 'channels', label: '渠道', icon: Radio },
|
|
{ id: 'tools', label: '工具', icon: Settings },
|
|
{ id: 'memory', label: '记忆维护', icon: Users },
|
|
{ id: 'scheduler', label: '调度器', icon: Calendar },
|
|
{ id: 'image', label: '图片上下文', icon: Image },
|
|
{ id: 'time', label: '时间', icon: Clock },
|
|
{ id: 'connection', label: '连接', icon: Wifi },
|
|
{ id: 'gateway', label: '网关', icon: Server },
|
|
]
|
|
|
|
export const inputCls = "w-full px-3 py-2 rounded-lg bg-[var(--bg-tertiary)] border border-[var(--border-color)] text-[var(--text-primary)] text-sm placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent-cyan)] focus:ring-1 focus:ring-[var(--focus-ring)] transition-colors"
|
|
export const selectCls = inputCls
|
|
|
|
export const TIMEZONE_OPTIONS: { value: string; label: string }[] = [
|
|
{ value: 'Asia/Shanghai', label: 'Asia/Shanghai (中国标准时间, UTC+8)' },
|
|
{ value: 'Asia/Tokyo', label: 'Asia/Tokyo (日本标准时间, UTC+9)' },
|
|
{ value: 'Asia/Seoul', label: 'Asia/Seoul (韩国标准时间, UTC+9)' },
|
|
{ value: 'Asia/Singapore', label: 'Asia/Singapore (新加坡时间, UTC+8)' },
|
|
{ value: 'Asia/Hong_Kong', label: 'Asia/Hong_Kong (香港时间, UTC+8)' },
|
|
{ value: 'Asia/Taipei', label: 'Asia/Taipei (台北时间, UTC+8)' },
|
|
{ value: 'Asia/Bangkok', label: 'Asia/Bangkok (曼谷时间, UTC+7)' },
|
|
{ value: 'Asia/Kolkata', label: 'Asia/Kolkata (印度标准时间, UTC+5:30)' },
|
|
{ value: 'Asia/Dubai', label: 'Asia/Dubai (海湾标准时间, UTC+4)' },
|
|
{ value: 'Europe/London', label: 'Europe/London (格林威治时间, UTC+0)' },
|
|
{ value: 'Europe/Paris', label: 'Europe/Paris (中欧时间, UTC+1)' },
|
|
{ value: 'Europe/Berlin', label: 'Europe/Berlin (中欧时间, UTC+1)' },
|
|
{ value: 'Europe/Moscow', label: 'Europe/Moscow (莫斯科时间, UTC+3)' },
|
|
{ value: 'America/New_York', label: 'America/New_York (美东时间, UTC-5)' },
|
|
{ value: 'America/Chicago', label: 'America/Chicago (美中时间, UTC-6)' },
|
|
{ value: 'America/Denver', label: 'America/Denver (美山地时间, UTC-7)' },
|
|
{ value: 'America/Los_Angeles', label: 'America/Los_Angeles (美太平洋时间, UTC-8)' },
|
|
{ value: 'Pacific/Auckland', label: 'Pacific/Auckland (新西兰时间, UTC+12)' },
|
|
{ value: 'Australia/Sydney', label: 'Australia/Sydney (澳东时间, UTC+10)' },
|
|
{ value: 'UTC', label: 'UTC (协调世界时)' },
|
|
]
|