/** * StreamingIndicator — 流式加载指示器 * * 仅在流式开始、尚无任何内容输出时显示初始加载状态。 * 一旦有思考内容或文本输出,AssistantMessage 卡片内部自行展示进度。 */ import { Box, Typography } from '@mui/material'; import { Loader2 } from 'lucide-react'; import { useAgentStore } from '@renderer/stores/agent-store'; export function StreamingIndicator(): React.JSX.Element | null { const isStreaming = useAgentStore((s) => s.isStreaming); const streamingContent = useAgentStore((s) => s.streamingContent); const messages = useAgentStore((s) => s.messages); // 已有内容输出时隐藏(AssistantMessage 内部展示) if (!isStreaming) return null; const lastMsg = messages[messages.length - 1]; const hasVisibleContent = !!streamingContent || !!lastMsg?.reasoningContent || !!lastMsg?.toolCalls?.length; if (hasVisibleContent) return null; return ( 正在连接 AI... ); }