/** * 全量 Mock 数据 * 为前端开发提供不依赖后端的模拟数据 */ import type { FineTuneTask, ModelItem, TrainedModel, DatasetItem, CompareTask, EvalTask, Dimension, SystemInfo, HealthMetrics, LogFile, TrainingLogFile, LogContent, } from '@/types' // ============ 认证 ============ export const mockLoginOk = { code: 0, message: 'ok', data: { token: 'mock-token' } } // ============ 系统监控 ============ export const mockHealth: HealthMetrics = { cpu_percent: 32, memory_percent: 58, disk_percent: 45, } export const mockSystemInfo: SystemInfo = { cpu: { percent: 32, cores: 8, percents: [25, 38, 42, 30, 28, 36, 40, 18], }, memory: { used_gb: 9.2, total_gb: 16, percent: 58, available_gb: 6.8, cached_gb: 2.3, }, disk: { used_gb: 230, total_gb: 512, percent: 45, }, gpu: [ { name: 'NVIDIA A800', gpu_percent: 0, memory_used_gb: 0.0, memory_total_gb: 80, temperature: 32, power_w: 38, fan_speed: 0, clock_mhz: 1410, driver_version: '535.86.10' }, { name: 'NVIDIA A800', gpu_percent: 28, memory_used_gb: 22.5, memory_total_gb: 80, temperature: 52, power_w: 165, fan_speed: 32, clock_mhz: 1410, driver_version: '535.86.10' }, { name: 'NVIDIA A800', gpu_percent: 73, memory_used_gb: 58.7, memory_total_gb: 80, temperature: 68, power_w: 320, fan_speed: 58, clock_mhz: 1410, driver_version: '535.86.10' }, { name: 'NVIDIA A800', gpu_percent: 0, memory_used_gb: 0.0, memory_total_gb: 80, temperature: 34, power_w: 42, fan_speed: 0, clock_mhz: 1410, driver_version: '535.86.10' }, { name: 'NVIDIA A800', gpu_percent: 46, memory_used_gb: 36.8, memory_total_gb: 80, temperature: 60, power_w: 210, fan_speed: 42, clock_mhz: 1410, driver_version: '535.86.10' }, { name: 'NVIDIA A800', gpu_percent: 0, memory_used_gb: 0.0, memory_total_gb: 80, temperature: 33, power_w: 40, fan_speed: 0, clock_mhz: 1410, driver_version: '535.86.10' }, { name: 'NVIDIA A800', gpu_percent: 85, memory_used_gb: 68.2, memory_total_gb: 80, temperature: 73, power_w: 365, fan_speed: 62, clock_mhz: 1410, driver_version: '535.86.10' }, { name: 'NVIDIA A800', gpu_percent: 15, memory_used_gb: 12.0, memory_total_gb: 80, temperature: 45, power_w: 95, fan_speed: 22, clock_mhz: 1410, driver_version: '535.86.10' }, ], network: { download_mb: 1024, upload_mb: 256, }, system: { uptime_seconds: 86400 * 3 + 3600 * 7 + 1800, process_count: 256, os: 'Ubuntu 22.04 LTS', }, } // ============ 模型管理 ============ export const mockModels: ModelItem[] = [ { id: 1, name: 'Qwen2.5-7B-Instruct', type: 'LLM', purpose: 'training', model_source: 'local', description: 'Qwen2.5 7B 指令微调基座', path: '/data/models/qwen2.5-7b', create_time: '2025-12-10T08:30:00Z' }, { id: 2, name: 'Qwen2.5-14B-Instruct', type: 'LLM', purpose: 'training', model_source: 'local', description: 'Qwen2.5 14B 指令微调基座', path: '/data/models/qwen2.5-14b', create_time: '2025-12-12T10:15:00Z' }, { id: 3, name: 'Llama3-8B-Instruct', type: 'LLM', purpose: 'inference', model_source: 'local', description: 'Llama3 8B 推理模型', path: '/data/models/llama3-8b', create_time: '2025-12-15T14:20:00Z' }, { id: 4, name: 'DeepSeek-V2-Lite', type: 'LLM', purpose: 'inference', model_source: 'local', description: 'DeepSeek V2 Lite', path: '/data/models/deepseek-v2-lite', create_time: '2026-01-05T09:00:00Z' }, { id: 5, name: 'GPT-4o', type: 'LLM', purpose: 'evaluation', model_source: 'api', description: 'OpenAI GPT-4o 在线模型', api_url: 'https://api.openai.com/v1', api_key: 'sk-***', online_model_name: 'gpt-4o', create_time: '2026-01-08T11:30:00Z' }, { id: 6, name: 'Claude-3.5-Sonnet', type: 'LLM', purpose: 'evaluation', model_source: 'api', description: 'Anthropic Claude 3.5 Sonnet', api_url: 'https://api.anthropic.com', api_key: 'sk-***', online_model_name: 'claude-3-5-sonnet-20241022', create_time: '2026-01-10T16:45:00Z' }, { id: 7, name: 'BGE-large-zh', type: 'Embedding', purpose: 'inference', model_source: 'local', description: '中文 embedding 模型', path: '/data/models/bge-large-zh', create_time: '2026-01-12T13:00:00Z' }, ] export const mockTrainedModels: { models: TrainedModel[] } = { models: [ { id: 1, name: 'qwen-ft-finance-001', train_methods: [{ name: 'lora' }], base_model_path: '/data/models/qwen2.5-7b', merged: true, merging: false, merged_path: '/data/saves/qwen-ft-finance-001-merged', create_time: '2026-01-15T10:30:00Z' }, { id: 2, name: 'qwen-ft-legal-002', train_methods: [{ name: 'lora' }], base_model_path: '/data/models/qwen2.5-7b', merged: false, merging: true, create_time: '2026-01-18T14:20:00Z' }, { id: 3, name: 'llama3-ft-customer-service', train_methods: [{ name: 'qlora' }], base_model_path: '/data/models/llama3-8b', merged: true, merging: false, merged_path: '/data/saves/llama3-ft-customer-service-merged', create_time: '2026-01-22T09:45:00Z' }, { id: 4, name: 'qwen-ft-medical-003', train_methods: [{ name: 'lora' }], base_model_path: '/data/models/qwen2.5-14b', merged: false, merging: false, create_time: '2026-02-01T16:10:00Z' }, ], } export const mockLocalModels = { models: [ { path: '/data/models/qwen2.5-7b', name: 'Qwen2.5-7B-Instruct' }, { path: '/data/models/qwen2.5-14b', name: 'Qwen2.5-14B-Instruct' }, { path: '/data/models/llama3-8b', name: 'Llama3-8B-Instruct' }, { path: '/data/models/deepseek-v2-lite', name: 'DeepSeek-V2-Lite' }, { path: '/data/models/bge-large-zh', name: 'BGE-large-zh' }, ], } // ============ 数据集 ============ export const mockDatasets: DatasetItem[] = [ { id: 1, name: '金融问答-训练集', type: 'train', storage_type: 'local', source: 'upload', size: '128 MB', count: 8560, description: '面向金融领域问答场景的高质量指令微调数据集', create_time: '2025-12-20T08:00:00Z', files: [ { id: 'finance-train-jsonl', name: 'finance_train.jsonl', size: '86.4 MB' }, { id: 'finance-validation-jsonl', name: 'finance_validation.jsonl', size: '21.8 MB' }, { id: 'dataset-readme', name: 'README.md', size: '4.2 KB' }, ], }, { id: 2, name: '法律文书-训练集', type: 'train', storage_type: 'local', source: 'upload', size: '256 MB', count: 15230, description: '法律文书数据集', create_time: '2025-12-25T10:30:00Z' }, { id: 3, name: '客服对话-训练集', type: 'train', storage_type: 'minio', source: 'upload', size: '512 MB', count: 24500, description: '客服对话记录', create_time: '2026-01-05T14:20:00Z' }, { id: 4, name: '金融评测集', type: 'eval', storage_type: 'local', source: 'upload', size: '32 MB', count: 1200, description: '金融领域评测', create_time: '2026-01-10T09:15:00Z' }, { id: 5, name: '通用能力评测', type: 'eval', storage_type: 'local', source: 'upload', size: '64 MB', count: 3500, description: '通用能力评测数据集', create_time: '2026-01-12T11:30:00Z' }, { id: 6, name: '医疗问答-训练集', type: 'train', storage_type: 'local', source: 'upload', size: '180 MB', count: 9800, description: '医疗问答对', create_time: '2026-02-01T15:00:00Z' }, { id: 7, name: '客服对话清洗集', type: 'train', storage_type: 'minio', source: 'task', size: '96 MB', count: 18240, description: '由客服问答数据清洗任务生成', create_time: '2026-07-08T06:28:00Z' }, { id: 8, name: '通用指令构造集', type: 'train', storage_type: 'local', source: 'task', size: '148 MB', count: 12600, description: '由指令微调数据构造任务生成', create_time: '2026-07-09T01:42:00Z' }, { id: 9, name: '用户反馈脱敏集', type: 'test', storage_type: 'minio', source: 'task', size: '72 MB', count: 9340, description: '由敏感信息脱敏任务生成', create_time: '2026-07-09T09:18:00Z' }, { id: 10, name: '多轮对话增强集', type: 'eval', storage_type: 'local', source: 'task', size: '41 MB', count: 2780, description: '由多轮对话拼接任务生成', create_time: '2026-07-10T02:06:00Z' }, ].map((dataset) => ({ ...dataset, files: dataset.files?.length ? dataset.files : [ { id: `dataset-${dataset.id}-samples`, name: 'dataset_samples.jsonl', size: dataset.size || '12.8 MB' }, { id: `dataset-${dataset.id}-readme`, name: 'README.md', size: '3.8 KB' }, ], })) export const mockDatasetPreviews: Record = { 'finance-train-jsonl': [ '{"instruction":"什么是净资产收益率?","input":"","output":"净资产收益率(ROE)用于衡量企业运用自有资本获得收益的能力。"}', '{"instruction":"解释市盈率的含义","input":"某公司股价为 36 元,每股收益为 3 元。","output":"市盈率为股价除以每股收益,本例中市盈率为 12 倍。"}', '{"instruction":"央行降准通常会带来什么影响?","input":"","output":"降准通常会释放银行体系流动性,降低资金成本,并增强信贷投放能力。"}', '{"instruction":"如何理解债券久期?","input":"","output":"久期衡量债券价格对利率变化的敏感程度,久期越长,价格波动通常越大。"}', '{"instruction":"基金定投适合怎样的投资者?","input":"","output":"基金定投适合希望分散择时风险、进行中长期纪律性投资的投资者。"}', '{"instruction":"资产负债率过高意味着什么?","input":"","output":"可能意味着企业偿债压力较大、财务风险较高,但仍需结合行业特点判断。"}', '{"instruction":"通货膨胀如何影响实际收益率?","input":"","output":"实际收益率约等于名义收益率减去通货膨胀率。"}', '{"instruction":"什么是流动比率?","input":"","output":"流动比率等于流动资产除以流动负债,用于衡量短期偿债能力。"}', '{"instruction":"股票分红是否等于投资者获得额外收益?","input":"","output":"不完全等同,除息后股价通常会相应调整,应结合总回报判断。"}', '{"instruction":"如何区分系统性风险与非系统性风险?","input":"","output":"系统性风险影响整个市场,非系统性风险主要与单个公司或行业有关。"}', '{"instruction":"什么是复利?","input":"","output":"复利是将本金和此前产生的收益一并计入下一期收益计算。"}', '{"instruction":"现金流量表主要反映什么?","input":"","output":"现金流量表反映企业经营、投资和筹资活动产生的现金流入与流出。"}', ].join('\n'), 'finance-validation-jsonl': [ '{"instruction":"计算简单收益率","input":"买入价 100 元,卖出价 108 元,不考虑费用。","output":"简单收益率为 8%。"}', '{"instruction":"什么是信用利差?","input":"","output":"信用利差是信用债收益率相对无风险基准收益率的差额。"}', '{"instruction":"解释最大回撤","input":"","output":"最大回撤描述资产净值从历史高点到随后低点的最大跌幅。"}', '{"instruction":"什么是风险溢价?","input":"","output":"风险溢价是投资者因承担额外风险而要求的超额预期收益。"}', ].join('\n'), 'dataset-readme': [ '# 金融问答训练集', '', '本数据集用于金融领域指令微调与基础能力评测。', '', '## 文件说明', '', '- `finance_train.jsonl`:训练样本', '- `finance_validation.jsonl`:验证样本', '', '文本编码:UTF-8', ].join('\n'), 'mock-jsonl': [ '{"instruction":"请概括以下文本的核心观点","input":"人工智能正在提升企业的数据处理效率。","output":"人工智能能够帮助企业提升数据处理效率。"}', '{"instruction":"将用户问题改写为更清晰的表达","input":"这个功能咋用?","output":"请说明该功能的具体使用步骤。"}', '{"instruction":"判断文本情感倾向","input":"这次服务响应很及时,问题也解决了。","output":"正向"}', '{"instruction":"提取文本中的关键实体","input":"远光软件于周一发布了新的模型管理平台。","output":["远光软件","周一","模型管理平台"]}', '{"instruction":"生成简短回复","input":"您好,我想了解数据集上传支持哪些格式?","output":"您好,目前支持 JSON、JSONL、CSV、TXT 等常见格式。"}', '{"instruction":"对以下内容进行分类","input":"如何重置账户密码?","output":"账户与安全"}', '{"instruction":"找出句子中的时间信息","input":"系统将在 7 月 15 日凌晨 2 点进行升级。","output":"7 月 15 日凌晨 2 点"}', '{"instruction":"补全客服回复","input":"用户反馈页面加载缓慢。","output":"已收到您的反馈,我们正在排查页面加载问题,请稍后重试。"}', ].join('\n'), 'mock-readme': [ '# 数据集说明', '', '当前内容为前端 Mock 数据,用于预览页面布局与交互效果。', '', '## 文件结构', '', '- `dataset_samples.jsonl`:模拟的数据样本', '- `README.md`:数据集使用说明', '', '文本编码:UTF-8', ].join('\n'), } // ============ 训练任务 ============ export const mockFineTuneList: FineTuneTask[] = [ { id: 103942, name: 'finance-sft-001', description: '金融领域 SFT 训练', status: 'completed', train_type: 'SFT', train_method: 'lora', template: 'qwen', base_model: 1, train_dataset_id: 1, gpus: [0], progress: 100, train_duration: '2小时18分钟', create_time: '2026-01-15T08:00:00Z' }, { id: 349102, name: 'legal-sft-002', description: '法律文书 SFT', status: 'completed', train_type: 'SFT', train_method: 'lora', template: 'qwen', base_model: 1, train_dataset_id: 2, gpus: [1], progress: 100, train_duration: '1小时46分钟', create_time: '2026-01-18T10:00:00Z' }, { id: 849301, name: 'medical-cpt-001', description: '医疗领域继续预训练', status: 'running', train_type: 'CPT', train_method: 'lora', template: 'qwen2_5', base_model: 2, train_dataset_id: 6, gpus: [0, 1], progress: 64, train_duration: '36分钟', create_time: '2026-02-05T09:00:00Z' }, { id: 593021, name: 'service-dpo-001', description: '客服对话偏好训练', status: 'pending', train_type: 'DPO', train_method: 'lora', template: 'qwen', base_model: 1, train_dataset_id: 3, gpus: [2], progress: 0, train_duration: '-', create_time: '2026-02-08T14:00:00Z' }, { id: 201948, name: 'finance-sft-002', description: '金融领域二轮微调', status: 'failed', train_type: 'SFT', train_method: 'lora', template: 'qwen', base_model: 1, train_dataset_id: 1, gpus: [3], progress: 32, train_duration: '18分钟', create_time: '2026-02-10T11:00:00Z' }, { id: 940212, name: 'general-sft-001', description: '通用能力微调', status: 'completed', train_type: 'SFT', train_method: 'full', template: 'llama3', base_model: 3, train_dataset_id: 3, gpus: [0, 2], progress: 100, train_duration: '3小时05分钟', create_time: '2026-02-12T13:00:00Z' }, ] // ============ 模型推理/对比 ============ export const mockCompareList: CompareTask[] = [ { id: 1, name: '金融问答对比', model_name: '金融问答对比', description: '对比基座模型与微调模型', status: 'loaded', models: JSON.stringify([ { model_id: 1, model_name: 'Qwen2.5-7B-Instruct', model_path: '/data/models/qwen2.5-7b', gpu_id: 0, source: 'database', port: 18001 }, { model_id: 101, model_name: 'qwen-ft-finance-001', model_path: '/data/saves/qwen-ft-finance-001-merged', gpu_id: 1, source: 'trained', port: 18002 }, ]), load_status: JSON.stringify({ loaded_models: [ { model_id: 1, model_name: 'Qwen2.5-7B-Instruct', status: 'ready', pid: 12345, port: 18001 }, { model_id: 101, model_name: 'qwen-ft-finance-001', status: 'ready', pid: 12346, port: 18002 }, ], }), create_time: '2026-02-15T10:00:00Z', }, { id: 2, name: '客服场景推理', model_name: '客服场景推理', description: '客服对话推理测试', status: 'pending', models: JSON.stringify([{ model_id: 3, model_name: 'Llama3-8B-Instruct', model_path: '/data/models/llama3-8b', gpu_id: 2, source: 'database' }]), load_status: JSON.stringify({ loaded_models: [] }), create_time: '2026-02-18T11:00:00Z', }, { id: 3, name: '法律文书推理', model_name: '法律文书推理', description: '法律文书推理测试', status: 'loaded', models: JSON.stringify([{ model_id: 102, model_name: 'qwen-ft-legal-002', model_path: '/data/saves/qwen-ft-legal-002-merged', gpu_id: 3, source: 'trained' }]), load_status: JSON.stringify({ loaded_models: [ { model_id: 102, model_name: 'qwen-ft-legal-002', status: 'ready', pid: 12350, port: 18003 }, ], }), create_time: '2026-02-20T14:00:00Z', }, ] // ============ 模型评测 ============ export const mockEvalList: EvalTask[] = [ { id: 1, eval_task_name: '金融模型评测-v1', model_name: 'qwen-ft-finance-001', dataset: '金融评测集', metric: 'accuracy', score: 87.5, status: 'completed', create_time: '2026-02-01T10:00:00Z' }, { id: 2, eval_task_name: '客服模型评测-v1', model_name: 'llama3-ft-customer-service', dataset: '通用能力评测', metric: 'rouge-1', score: 0.82, status: 'completed', create_time: '2026-02-05T11:00:00Z' }, { id: 3, eval_task_name: '基线对比评测', model_name: 'Qwen2.5-7B-Instruct', dataset: '金融评测集', metric: 'accuracy', score: 72.3, status: 'running', create_time: '2026-02-10T09:00:00Z' }, ] export const mockDimensions: Dimension[] = [ { id: 1, name: '回答准确性', type: 'classification', description: '评估模型回答是否准确', eval_model: 'GPT-4o', eval_method: 'standard', eval_prompt: '# 角色\n你是专业的评估专家...', is_active: true, is_default: true, create_time: '2025-12-01T08:00:00Z' }, { id: 2, name: '综合评分', type: 'metric', description: '0-5 分综合评分', eval_model: 'Claude-3.5-Sonnet', eval_method: 'metric_standard', eval_prompt: '# 角色\n你是专业评分专家...', is_active: true, is_default: false, score_min: 0, score_max: 5, pass_threshold: 3.5, create_time: '2025-12-05T09:00:00Z' }, { id: 3, name: '语义相似度', type: 'metric', description: '生成文本与参考答案的语义相似度', eval_model: 'GPT-4o', eval_method: 'semantic', eval_prompt: '# 角色\n你是语义相似度评估专家...', is_active: true, is_default: false, score_min: 0, score_max: 1, pass_threshold: 0.7, create_time: '2025-12-08T10:00:00Z' }, { id: 4, name: 'BLEU-4 相似度', type: 'text_similarity', description: '使用 BLEU-4 评估文本相似度', is_active: true, is_default: false, eval_method: ['bleu_4'], bleu_n: 4, output_precision: 3, create_time: '2025-12-10T11:00:00Z' }, { id: 5, name: 'ROUGE 多指标', type: 'text_similarity', description: 'ROUGE-1/2/4 多指标评估', is_active: false, is_default: false, eval_method: ['rouge_1', 'rouge_2', 'rouge_4'], bleu_n: 1, output_precision: 3, create_time: '2025-12-12T13:00:00Z' }, ] // ============ 日志 ============ export const mockLogFiles: LogFile[] = [ { file: 'system-2026-02-15.log', name: '系统日志-2026-02-15', size: '2.3 MB' }, { file: 'error-2026-02-15.log', name: '错误日志-2026-02-15', size: '156 KB' }, { file: 'system-2026-02-14.log', name: '系统日志-2026-02-14', size: '3.1 MB' }, ] export const mockTrainingLogFiles: TrainingLogFile[] = [ { file: 'qwen-ft-finance-001_pid12345.log', name: 'finance-sft-001', size: '4.5 MB', pid: 12345, date: '2026-02-15' }, { file: 'llama3-ft-customer-service_pid12346.log', name: 'service-dpo-001', size: '2.1 MB', pid: 12346, date: '2026-02-18' }, { file: 'qwen-ft-legal-002_pid12350.log', name: 'legal-sft-002', size: '5.8 MB', pid: 12350, date: '2026-02-20' }, ] const fakeLogLines = [ "[2026-02-15 08:30:12] INFO: Loading model from /data/models/qwen2.5-7b", "[2026-02-15 08:30:13] INFO: Loading dataset finance-train-001 (8560 samples)", "[2026-02-15 08:30:15] INFO: Training started with batch_size=8, learning_rate=2e-5", "[2026-02-15 08:32:45] INFO: {'loss': 2.341, 'grad_norm': 1.234, 'learning_rate': 1.95e-05, 'epoch': 0.05}", "[2026-02-15 08:34:15] INFO: {'loss': 1.892, 'grad_norm': 0.987, 'learning_rate': 1.88e-05, 'epoch': 0.10}", "[2026-02-15 08:35:42] INFO: {'loss': 1.543, 'grad_norm': 0.876, 'learning_rate': 1.79e-05, 'epoch': 0.15}", "[2026-02-15 08:37:10] INFO: {'loss': 1.287, 'grad_norm': 0.765, 'learning_rate': 1.70e-05, 'epoch': 0.20}", "[2026-02-15 08:38:55] INFO: {'loss': 1.056, 'grad_norm': 0.654, 'learning_rate': 1.60e-05, 'epoch': 0.25}", "[2026-02-15 08:40:30] WARN: Gradient norm exceeds threshold (0.654 > 0.5)", "[2026-02-15 08:42:00] INFO: {'loss': 0.892, 'grad_norm': 0.543, 'learning_rate': 1.50e-05, 'epoch': 0.30}", "[2026-02-15 08:45:15] INFO: Saved checkpoint to /data/checkpoints/finance-sft-001-step-100", "[2026-02-15 08:46:30] INFO: {'loss': 0.754, 'grad_norm': 0.432, 'learning_rate': 1.40e-05, 'epoch': 0.35}", "[2026-02-15 08:48:00] INFO: {'loss': 0.623, 'grad_norm': 0.398, 'learning_rate': 1.30e-05, 'epoch': 0.40}", "[2026-02-15 08:50:15] INFO: {'loss': 0.512, 'grad_norm': 0.345, 'learning_rate': 1.20e-05, 'epoch': 0.45}", "[2026-02-15 08:52:30] ERROR: Failed to save model: No space left on device", "[2026-02-15 08:52:31] INFO: Retrying save with compressed format...", "[2026-02-15 08:53:00] INFO: Model saved successfully (size: 14.2 GB)", "[2026-02-15 08:55:00] INFO: {'loss': 0.421, 'grad_norm': 0.298, 'learning_rate': 1.10e-05, 'epoch': 0.50}", "[2026-02-15 08:57:30] INFO: {'loss': 0.356, 'grad_norm': 0.256, 'learning_rate': 1.00e-05, 'epoch': 0.55}", "[2026-02-15 09:00:00] INFO: Training completed successfully", "", "***** train metrics *****", " epoch = 1.0", " total_flos = 1234567890", " train_loss = 0.342", " train_runtime = 1785.2", " train_samples_per_second = 4.79", " train_steps_per_second = 0.60", "***** train metrics end *****", ] export const mockLogContent: LogContent = { file: 'system-2026-02-15.log', size: '2.3 MB', content: fakeLogLines.join('\n'), }