diff --git a/src/components/chat/hooks/useChatMessages.ts b/src/components/chat/hooks/useChatMessages.ts index 82e7d9e1ef..fd0128b35d 100644 --- a/src/components/chat/hooks/useChatMessages.ts +++ b/src/components/chat/hooks/useChatMessages.ts @@ -55,8 +55,8 @@ export function normalizedToChatMessages(messages: NormalizedMessage[]): ChatMes if (msg.role === 'user') { // Parse task notifications - const taskNotifRegex = /\s*[^<]*<\/task-id>\s*[^<]*<\/output-file>\s*([^<]*)<\/status>\s*([^<]*)<\/summary>\s*<\/task-notification>/g; - const taskNotifMatch = taskNotifRegex.exec(content); + const taskNotifRegex = /^[\s\S]*?([^<]*)<\/status>[\s\S]*?([^<]*)<\/summary>[\s\S]*?<\/task-notification>$/; + const taskNotifMatch = taskNotifRegex.exec(content.trim()); if (taskNotifMatch) { converted.push({ type: 'assistant',