/** * AgentHub - 智能体大厅主界面 * * 100%还原原型图V11: * - 最大宽度 760px,居中 * - 头部搜索框 * - 时间轴设计(左侧序号圆点+连接线) * - 5个阶段,12个智能体卡片 */ import React, { useState, useMemo } from 'react'; import { BrainCircuit, Search } from 'lucide-react'; import { AgentCard } from './AgentCard'; import { AGENTS, PHASES } from '../constants'; import type { AgentConfig } from '../types'; import '../styles/agent-hub.css'; interface AgentHubProps { onAgentSelect: (agent: AgentConfig) => void; } export const AgentHub: React.FC = ({ onAgentSelect }) => { const [searchValue, setSearchValue] = useState(''); // 按阶段分组智能体 const agentsByPhase = useMemo(() => { const grouped: Record = {}; AGENTS.forEach(agent => { if (!grouped[agent.phase]) { grouped[agent.phase] = []; } grouped[agent.phase].push(agent); }); return grouped; }, []); // 搜索提交 const handleSearch = () => { if (searchValue.trim()) { // 默认进入第一个智能体并携带搜索内容 const firstAgent = AGENTS[0]; onAgentSelect({ ...firstAgent, initialQuery: searchValue } as any); } }; const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { handleSearch(); } }; return (
{/* 主体内容 */}
{/* 头部搜索区 */}

医学研究专属大模型 已接入DeepSeek

setSearchValue(e.target.value)} onKeyDown={handleKeyDown} className="search-input" />
{/* 流水线模块 */}
{PHASES.map((phase, phaseIndex) => { const isLast = phaseIndex === PHASES.length - 1; const agents = agentsByPhase[phase.phase] || []; // 根据阶段确定列数 let gridCols = 'grid-cols-3'; if (phase.phase === 2) gridCols = 'grid-cols-3'; // 4个卡片,每行3个 if (phase.phase === 3) gridCols = 'grid-cols-3'; // 1个卡片 if (phase.phase === 4) gridCols = 'grid-cols-3'; // 2个卡片 if (phase.phase === 5) gridCols = 'grid-cols-3'; // 2个卡片 return (
{/* 左侧时间轴 */}
{phase.phase}
{!isLast &&
}
{/* 阶段内容 */}

{phase.name} {phase.isTool && ( 工具 )}

{agents.map(agent => ( ))}
); })}
{/* 底部 */}
); }; export default AgentHub;