import React, { useMemo } from "react"; import useRenderTracker from "../../../hooks/useRenderTracker"; import MarkdownBlock from "../Blocks/MarkdownBlock"; import CodeBlock from "../Blocks/CodeBlock"; import { ParsedBlock, parseMarkdownAndCode } from "../../../utils/parseMarkdownAndCode"; import type { FinalizedThinkingSummary } from "../../../types/chatStream"; import AssistantThinkingSummary from "./AssistantThinkingSummary"; interface StaticAssistantMessageProps { content: string; thinkingSummary?: FinalizedThinkingSummary; } const StaticAssistantMessage: React.FC = ({ content, thinkingSummary }) => { useRenderTracker('StaticAssistantMessage', { content, thinkingSummary }); const blocks: ParsedBlock[] = parseMarkdownAndCode(content); const renderedBlocks = useMemo(() => ( <> {blocks.map((block) => { if (block.type === 'markdown') { return ; } if (block.type === 'code') { return ; } return null; })} ), [blocks]); return (
{thinkingSummary && ( )}
{renderedBlocks}
); } export default React.memo(StaticAssistantMessage);