Smooth WebUI streaming with state-driven viewport motion (#4696)

This commit is contained in:
chengyongru
2026-07-26 00:18:24 +08:00
committed by GitHub
parent 9a7debcb48
commit b0ef759e2c
28 changed files with 3202 additions and 670 deletions
+4 -1
View File
@@ -13,6 +13,7 @@ interface MarkdownTextProps {
children: string;
className?: string;
streaming?: boolean;
preserveStreamingLayout?: boolean;
onOpenFilePreview?: (path: string) => void;
}
@@ -74,11 +75,13 @@ export function MarkdownText({
children,
className,
streaming = false,
preserveStreamingLayout = false,
onOpenFilePreview,
}: MarkdownTextProps) {
const renderedSource = children;
const renderPhase = streaming ? "streaming" : "complete";
const highlightCode = !streaming;
const renderWithStreamingLayout = streaming || preserveStreamingLayout;
useEffect(() => {
if (streaming) void preloadMarkdownText();
@@ -103,7 +106,7 @@ export function MarkdownText({
source={renderedSource}
className={className}
highlightCode={highlightCode}
streaming={streaming}
streaming={renderWithStreamingLayout}
onOpenFilePreview={onOpenFilePreview}
/>
</Suspense>