perf(webui): bound reasoning previews and pace streaming updates

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-12 18:33:39 +08:00
1 parent 9e71087a2a
commit 7cede64f07
5 files changed
+167 -12

No files matched your search

@@ -12,8 +12,10 @@ export interface ActivityStepProps {
marker?: ReactNode;
showMarker?: boolean;
label: ReactNode;
tooltipContent?: ReactNode;
ariaLabel?: string;
active?: boolean;
animateLabel?: boolean;
tone?: ActivityStepTone;
className?: string;
contentClassName?: string;
@@ -27,8 +29,10 @@ export function ActivityStep({
marker,
showMarker = true,
label,
tooltipContent,
ariaLabel,
active = false,
animateLabel = true,
tone = active ? "active" : "neutral",
className,
contentClassName,
@@ -43,7 +47,7 @@ export function ActivityStep({
className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap"
>
<StreamingLabelSheen
active={active}
active={active && animateLabel}
className={cn(
"min-w-0 flex-1 truncate font-medium",
tone === "error" ? "text-destructive/78" : "text-muted-foreground/85",
@@ -95,7 +99,7 @@ export function ActivityStep({
<Tooltip>
<TooltipTrigger asChild>{line}</TooltipTrigger>
<TooltipContent side="top" className="max-w-[min(32rem,calc(100vw-2rem))] whitespace-pre-wrap break-words">
{label}
{tooltipContent ?? label}
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -21,12 +21,19 @@ export function ReasoningRow({
? t("message.reasoningStreaming", { defaultValue: "Thinking…" })
: t("message.reasoning", { defaultValue: "Thinking" });
const preview = compactReasoningPreview(text) || fallback;
// CSS ellipsis still lays out the full string, including the animated copy.
const truncated = preview.length > 512;
const label = truncated
? preview.slice(0, 512).replace(/[\uD800-\uDBFF]$/, "") + "…"
: preview;
return (
<ActivityStep
marker={<ReasoningMarker streaming={streaming} />}
active={streaming}
animateLabel={!truncated}
tone={streaming ? "active" : "success"}
label={preview}
label={label}
tooltipContent={preview}
labelClassName="italic text-muted-foreground/78"
contentClassName="overflow-hidden"
className={className}