2025-09-08 10:49:45 +08:00
|
|
|
import { create } from 'zustand';
|
|
|
|
|
|
|
|
|
|
export interface Agent {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
icon: string;
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar?: string;
|
2025-09-08 10:49:45 +08:00
|
|
|
model: string;
|
|
|
|
|
role: string;
|
|
|
|
|
status: 'waiting' | 'thinking' | 'generating' | 'done';
|
|
|
|
|
input?: string;
|
|
|
|
|
output?: string;
|
|
|
|
|
prompt?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DemoState {
|
|
|
|
|
// 演示状态
|
|
|
|
|
status: 'idle' | 'running' | 'paused' | 'completed';
|
|
|
|
|
currentPhase: number;
|
|
|
|
|
currentAgent: string | null;
|
|
|
|
|
progress: number;
|
|
|
|
|
|
|
|
|
|
// Agent配置
|
|
|
|
|
agents: Agent[];
|
|
|
|
|
|
|
|
|
|
// 生成的内容
|
|
|
|
|
generatedContent: {
|
|
|
|
|
[key: string]: {
|
|
|
|
|
title: string;
|
|
|
|
|
content: string;
|
|
|
|
|
images: string[];
|
|
|
|
|
isComplete: boolean;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 控制选项
|
|
|
|
|
controls: {
|
|
|
|
|
speed: number; // 1-5倍速
|
|
|
|
|
autoAdvance: boolean;
|
|
|
|
|
showDetails: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Actions
|
|
|
|
|
startDemo: () => void;
|
|
|
|
|
pauseDemo: () => void;
|
|
|
|
|
resumeDemo: () => void;
|
|
|
|
|
setCurrentAgent: (agentId: string) => void;
|
|
|
|
|
updateAgentStatus: (agentId: string, status: Agent['status']) => void;
|
|
|
|
|
updateAgentOutput: (agentId: string, output: string) => void;
|
|
|
|
|
addGeneratedContent: (section: string, content: any) => void;
|
|
|
|
|
setProgress: (progress: number) => void;
|
|
|
|
|
reset: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const initialAgents: Agent[] = [
|
|
|
|
|
{
|
|
|
|
|
id: 'retrieval',
|
|
|
|
|
name: '信息检索专家',
|
|
|
|
|
icon: '🔍',
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar: '/agents/信息检索专家.jpg',
|
2025-09-08 10:49:45 +08:00
|
|
|
model: 'DeepSeek Chat Model5',
|
|
|
|
|
role: '市场调研、数据收集、竞品分析',
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'design',
|
|
|
|
|
name: '设计专家',
|
|
|
|
|
icon: '🎨',
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar: '/agents/设计专家.jpg',
|
2025-09-08 10:49:45 +08:00
|
|
|
model: 'Google Gemini Chat Model2',
|
|
|
|
|
role: '视觉设计、空间布局、品牌形象',
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'budget',
|
|
|
|
|
name: '财务预算专家',
|
|
|
|
|
icon: '💰',
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar: '/agents/预算编辑专家.jpg',
|
2025-09-08 10:49:45 +08:00
|
|
|
model: 'DeepSeek Chat Model2',
|
|
|
|
|
role: '成本核算、预算规划、ROI分析',
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'format',
|
|
|
|
|
name: '格式编辑专家',
|
|
|
|
|
icon: '📝',
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar: '/agents/结构编辑专家.jpg',
|
2025-09-08 10:49:45 +08:00
|
|
|
model: 'DeepSeek Chat Model4',
|
|
|
|
|
role: '文档格式化、内容结构优化',
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'execution',
|
|
|
|
|
name: '活动执行专家',
|
|
|
|
|
icon: '⚡',
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar: '/agents/会展执行专家.jpg',
|
2025-09-08 10:49:45 +08:00
|
|
|
model: 'DeepSeek Chat Model1',
|
|
|
|
|
role: '执行计划、时间线管理、任务分配',
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'marketing',
|
|
|
|
|
name: '营销宣传专家',
|
|
|
|
|
icon: '📢',
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar: '/agents/营销策划专家.jpg',
|
2025-09-08 10:49:45 +08:00
|
|
|
model: 'DeepSeek Chat Model3',
|
|
|
|
|
role: '推广策略、媒体规划、品牌传播',
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'coordinator',
|
|
|
|
|
name: '会展策划专家',
|
|
|
|
|
icon: '🎯',
|
2025-09-08 12:06:01 +08:00
|
|
|
avatar: '/agents/会展策划专家.jpg',
|
2025-09-08 10:49:45 +08:00
|
|
|
model: 'Chat Models + Memories',
|
|
|
|
|
role: '中央协调、方案整合、决策支持',
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const useDemoStore = create<DemoState>((set) => ({
|
|
|
|
|
status: 'idle',
|
|
|
|
|
currentPhase: 0,
|
|
|
|
|
currentAgent: null,
|
|
|
|
|
progress: 0,
|
|
|
|
|
agents: initialAgents,
|
|
|
|
|
generatedContent: {},
|
|
|
|
|
controls: {
|
|
|
|
|
speed: 1,
|
|
|
|
|
autoAdvance: true,
|
|
|
|
|
showDetails: true,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
startDemo: () => set({ status: 'running', progress: 0 }),
|
|
|
|
|
pauseDemo: () => set({ status: 'paused' }),
|
|
|
|
|
resumeDemo: () => set({ status: 'running' }),
|
|
|
|
|
|
|
|
|
|
setCurrentAgent: (agentId) => set({ currentAgent: agentId }),
|
|
|
|
|
|
|
|
|
|
updateAgentStatus: (agentId, status) =>
|
|
|
|
|
set((state) => ({
|
|
|
|
|
agents: state.agents.map((agent) =>
|
|
|
|
|
agent.id === agentId ? { ...agent, status } : agent
|
|
|
|
|
),
|
|
|
|
|
})),
|
|
|
|
|
|
|
|
|
|
updateAgentOutput: (agentId, output) =>
|
|
|
|
|
set((state) => ({
|
|
|
|
|
agents: state.agents.map((agent) =>
|
|
|
|
|
agent.id === agentId ? { ...agent, output } : agent
|
|
|
|
|
),
|
|
|
|
|
})),
|
|
|
|
|
|
|
|
|
|
addGeneratedContent: (section, content) =>
|
|
|
|
|
set((state) => ({
|
|
|
|
|
generatedContent: {
|
|
|
|
|
...state.generatedContent,
|
|
|
|
|
[section]: content,
|
|
|
|
|
},
|
|
|
|
|
})),
|
|
|
|
|
|
|
|
|
|
setProgress: (progress) => set({ progress }),
|
|
|
|
|
|
|
|
|
|
reset: () =>
|
|
|
|
|
set({
|
|
|
|
|
status: 'idle',
|
|
|
|
|
currentPhase: 0,
|
|
|
|
|
currentAgent: null,
|
|
|
|
|
progress: 0,
|
|
|
|
|
agents: initialAgents,
|
|
|
|
|
generatedContent: {},
|
|
|
|
|
}),
|
|
|
|
|
}));
|