/** Insight Rail 组件 — 右侧 AI 洞察面板,可展开/折叠。 */ "use client"; import { useState } from "react"; import { ChevronRight, ChevronLeft, Bot, Sparkles, FileText, AlertTriangle, Users, ScrollText, Network, UserCircle, TrendingUp, Cpu, ShieldCheck, type LucideIcon, } from "lucide-react"; /** Agent 类型定义。 */ interface AgentDef { key: string; name: string; icon: LucideIcon; trigger: string; output: string; action: string; } /** 12 个 Agent 配置。 */ const AGENTS: AgentDef[] = [ { key: "report", name: "报表分析", icon: FileText, trigger: "查看月报/季报", output: "指标提取卡片 + 异常高亮", action: "生成投后摘要草稿" }, { key: "validator", name: "数据校验", icon: ShieldCheck, trigger: "指标出现矛盾", output: "校验维度矩阵 + 可信度评分", action: "标记可疑数据" }, { key: "risk", name: "风险预警", icon: AlertTriangle, trigger: "健康度下降/弱信号", output: "风险等级 + 证据链", action: "创建决策线程" }, { key: "board", name: "董事会", icon: Users, trigger: "董事会前后", output: "决议追踪 + 提问清单", action: "加入董事会议题" }, { key: "agreement", name: "投资协议", icon: ScrollText, trigger: "协议条款即将触发", output: "条款原文 + 触发条件", action: "发送披露提醒" }, { key: "synergy", name: "协同匹配", icon: Network, trigger: "查看协同中心", output: "匹配度评分 + 资源互补图", action: "生成协同方案草稿" }, { key: "talent", name: "人才分析", icon: UserCircle, trigger: "核心团队变动", output: "稳定性评分 + 9-Box 矩阵", action: "启动人才搜索" }, { key: "financing", name: "融资支持", icon: TrendingUp, trigger: "融资阶段/Runway", output: "融资准备度 + 投资人画像", action: "生成融资材料清单" }, { key: "research", name: "行业研究", icon: Bot, trigger: "竞品/行业动态", output: "行业风险提示 + 对标分析", action: "加入洞察域报告" }, { key: "ai_commercial", name: "AI+商业化", icon: Sparkles, trigger: "PoC/转化率指标", output: "转化漏斗 + 证据链", action: "生成董事会问题清单" }, { key: "ai_cost", name: "AI+模型成本", icon: Cpu, trigger: "推理成本/毛利指标", output: "成本趋势 + 单位经济模型", action: "建议模型调用优化" }, { key: "ai_compliance", name: "AI+数据合规", icon: ShieldCheck, trigger: "合规指标变化", output: "合规风险等级 + 整改建议", action: "生成合规报告草稿" }, ]; /** Insight Rail Props。 */ interface InsightRailProps { /** 当前激活的 Agent key,默认 "risk"。 */ defaultAgent?: string; } /** * Insight Rail 组件 — 桌面端右侧可折叠 AI 洞察面板。 * * 展开宽度 w-80(320px),折叠宽度 w-10(40px)。 * 包含 12 个 Agent 差异化卡片,支持 Tab 切换。 */ export function InsightRail({ defaultAgent = "risk" }: InsightRailProps) { const [expanded, setExpanded] = useState(false); const [activeAgent, setActiveAgent] = useState(defaultAgent); const [activeTabs, setActiveTabs] = useState([defaultAgent]); const agent = AGENTS.find((a) => a.key === activeAgent) ?? AGENTS[0]; /** 切换 Agent(最多 3 个 Tab)。 */ function switchAgent(key: string) { setActiveAgent(key); setActiveTabs((prev) => { if (prev.includes(key)) return prev; if (prev.length >= 3) return [...prev.slice(1), key]; return [...prev, key]; }); } if (!expanded) { return ( ); } return ( ); }