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
+2 -10
View File
@@ -248,13 +248,6 @@ const rehypePlugins: NonNullable<StreamdownProps["rehypePlugins"]> = [rehypeKate
const DIRECT_LINKS = { enabled: false } as const;
const SAFE_MARKDOWN_PROTOCOL = /^(https?|ircs?|mailto|xmpp)$/i;
const STREAMING_ANIMATION = {
animation: "fadeIn",
duration: 180,
easing: "cubic-bezier(0.16, 1, 0.3, 1)",
sep: "word",
stagger: 18,
} as const;
/** Preserve react-markdown's URL policy when rendering through Streamdown. */
const safeMarkdownUrl: NonNullable<StreamdownProps["urlTransform"]> = (url) => {
@@ -727,9 +720,8 @@ export default function MarkdownTextRenderer({
<Streamdown
mode={streaming ? "streaming" : "static"}
parseIncompleteMarkdown
isAnimating={streaming}
animated={streaming ? STREAMING_ANIMATION : false}
caret={streaming ? "block" : undefined}
isAnimating={false}
animated={false}
linkSafety={DIRECT_LINKS}
urlTransform={safeMarkdownUrl}
remarkPlugins={remarkPlugins}