diff --git a/frontend/src/app/share/[threadId]/page.tsx b/frontend/src/app/share/[threadId]/page.tsx index 889cbed4..2d1c349f 100644 --- a/frontend/src/app/share/[threadId]/page.tsx +++ b/frontend/src/app/share/[threadId]/page.tsx @@ -20,6 +20,28 @@ import { cn } from "@/lib/utils"; import { UnifiedMessage, ParsedContent, ParsedMetadata, ThreadParams } from '@/components/thread/types'; import { getToolIcon, extractPrimaryParam, safeJsonParse } from '@/components/thread/utils'; +// Function to extract tool calls from a message +function extractToolCallsFromMessage(messageText: string) { + const result: { name: string; fullMatch: string }[] = []; + + // Define regex to find tool calls in text + const toolCallRegex = /<([a-zA-Z\-_]+)(?:\s+[^>]*)?>(?:[\s\S]*?)<\/\1>|<([a-zA-Z\-_]+)(?:\s+[^>]*)?\/>/g; + + let match; + while ((match = toolCallRegex.exec(messageText)) !== null) { + const toolName = match[1] || match[2]; + // Skip tags + if (toolName !== 'ask') { + result.push({ + name: toolName, + fullMatch: match[0] + }); + } + } + + return result; +} + // Define the set of tags whose raw XML should be hidden during streaming const HIDE_STREAMING_XML_TAGS = new Set([ 'execute-command', @@ -1127,57 +1149,6 @@ export default function ThreadPage({ params }: { params: Promise } } }, [streamingTextContent, streamHookStatus, messages, isStreamingText, isPlaying, currentMessageIndex, streamText]); - // Create a memoized VNC iframe component to prevent reconnections - const memoizedVncIframe = useMemo(() => { - if (!vncPreviewUrl) return null; - - return ( -