import SkillCreatorConversationItem from './SkillCreatorConversationItem'; export interface ToolCall { id: string; name: string; input?: Record; output?: string; } export interface ConversationStep { text: string; subText?: string; status: 'done' | 'processing'; } export interface ConversationMessage { id: string; role: 'user' | 'assistant'; content: string; steps?: ConversationStep[]; thinkings?: Array<{ duration: number; content: string }>; toolCalls?: ToolCall[]; } interface AgentConversationListProps { messages: ConversationMessage[]; isConnecting?: boolean; className?: string; } export default function AgentConversationList({ messages, isConnecting = false, className = '' }: AgentConversationListProps) { return (
{messages.map((message, index) => { // 仅在最后一条 assistant 且尚未收到任何生成内容时显示“连接中”态 // 一旦出现 steps/thinkings/toolCalls/content,就切回正常渲染 const hasStartedGenerating = Boolean(message.content) || Boolean(message.steps?.length) || Boolean(message.thinkings?.length) || Boolean(message.toolCalls?.length); const shouldShowConnecting = isConnecting && index === messages.length - 1 && message.role === 'assistant' && !hasStartedGenerating; return ( ); })}
); }