主要修复: - 恢复Agent真实头像显示(替换emoji为实际图片) - 删除自动跳转到ResultPageV2的逻辑 - 修改ResultModal支持动态内容显示 - 根据不同订单班显示对应的方案信息 优化内容: - 重构Agent系统,每个订单班独立管理Agent配置 - 删除不需要的ResultPageV2组件 - handleViewDetails改为在新标签页打开 影响模块: - web_frontend/exhibition-demo/src/components/ResultModal.tsx - web_frontend/exhibition-demo/src/pages/WorkflowPageV4.tsx - web_frontend/exhibition-demo/src/App.tsx - web_frontend/exhibition-demo/src/data/terminalSimulations/*.ts 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
100 lines
3.1 KiB
TypeScript
100 lines
3.1 KiB
TypeScript
/**
|
||
* 终端模拟数据管理器
|
||
* 为12个订单班提供统一的终端模拟数据
|
||
*/
|
||
|
||
import { Agent } from '@/store/demoStore';
|
||
import { wenluSimulation } from './wenlu';
|
||
import { foodSimulation } from './food';
|
||
|
||
// 终端行类型定义
|
||
export interface TerminalLine {
|
||
type: 'info' | 'success' | 'warning' | 'error' | 'system' | 'output' | 'progress' | 'install' | 'file' | 'image';
|
||
content: string;
|
||
agent?: string;
|
||
// 进度条相关
|
||
target?: number;
|
||
stutters?: number[];
|
||
duration?: number; // 添加duration字段
|
||
// 图片相关
|
||
imageSrc?: string;
|
||
imageAlt?: string;
|
||
}
|
||
|
||
// Agent输出定义
|
||
export interface AgentOutput {
|
||
agent: () => Agent; // 修改为函数类型
|
||
outputs: TerminalLine[];
|
||
}
|
||
|
||
// 完整的模拟数据结构
|
||
export interface SimulationData {
|
||
orderClassId: string;
|
||
orderClassName: string;
|
||
projectTitle: string;
|
||
agents: Agent[]; // 添加agents字段
|
||
startupSequence: TerminalLine[];
|
||
agentSequence: AgentOutput[];
|
||
completionSequence: TerminalLine[];
|
||
}
|
||
|
||
// 生成函数类型 - 不再需要传入agents参数
|
||
export type SimulationGenerator = () => SimulationData;
|
||
|
||
// 订单班模拟数据映射表 - 目前只有文旅和食品
|
||
export const simulationMap: Record<string, SimulationGenerator> = {
|
||
wenlu: wenluSimulation, // 文旅
|
||
food: foodSimulation, // 食品
|
||
// 其他订单班暂未实现,缺少agent prompt和头像数据
|
||
};
|
||
|
||
// 获取指定订单班的模拟数据
|
||
export const getSimulationData = (orderClassId: string): SimulationData | null => {
|
||
console.log('[getSimulationData] Called with orderClassId:', orderClassId);
|
||
|
||
const generator = simulationMap[orderClassId];
|
||
console.log('[getSimulationData] Available keys:', Object.keys(simulationMap));
|
||
console.log('[getSimulationData] Generator found:', !!generator);
|
||
|
||
if (!generator) {
|
||
console.warn(`No simulation data found for order class: ${orderClassId}`);
|
||
return null;
|
||
}
|
||
|
||
const data = generator();
|
||
console.log('[getSimulationData] Data generated:', {
|
||
hasData: !!data,
|
||
orderClassName: data?.orderClassName,
|
||
projectTitle: data?.projectTitle,
|
||
agentsCount: data?.agents?.length,
|
||
startupSequenceLength: data?.startupSequence?.length,
|
||
agentSequenceLength: data?.agentSequence?.length,
|
||
completionSequenceLength: data?.completionSequence?.length
|
||
});
|
||
|
||
return data;
|
||
};
|
||
|
||
// 通用工具函数
|
||
export const utils = {
|
||
// 生成随机延迟
|
||
getRandomDelay: (min: number, max: number) => {
|
||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||
},
|
||
|
||
// 生成进度条字符串
|
||
generateProgressBar: (progress: number, width: number = 40) => {
|
||
const filled = Math.floor((progress / 100) * width);
|
||
const empty = width - filled;
|
||
return `[${'█'.repeat(filled)}${'░'.repeat(empty)}] ${progress.toString().padStart(3, ' ')}%`;
|
||
},
|
||
|
||
// 生成文件大小
|
||
generateFileSize: () => {
|
||
const sizes = ['12.3KB', '456KB', '1.2MB', '3.4MB', '15.7MB', '48.2MB', '126MB'];
|
||
return sizes[Math.floor(Math.random() * sizes.length)];
|
||
},
|
||
|
||
// 重复字符
|
||
repeat: (char: string, times: number) => char.repeat(times)
|
||
}; |