/** * Hook for parsing markdown content with think sections. * Extracts ... blocks and returns main content and reasoning separately. */ import { useMemo } from 'react' import { parseThinkSections } from '@/lib/graph/renderingUtils' /** * Parse markdown content and extract think sections. * Returns main content (without think blocks) and reasoning content (from think blocks). * * @param content - The HTML/markdown content to parse * @param outputType - The output type ('image' or 'string') * @returns Object with main and think content */ export function useThinkSections( content: string | null, outputType: 'image' | 'string' ): { main: string think: string } { return useMemo(() => { if (!content || outputType === 'image') { return { main: '', think: '' } } return parseThinkSections(content) }, [content, outputType]) }