Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Pace Assistant live answer rendering
rcourtman35c9fcc05570
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 806fc911e4..52c6d6e36e 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -359,6 +359,13 @@ runtime cost control, and shared AI transport surfaces.content and hidden reasoning may continue to opt out of those checkpoints soanswer streaming remains fast, while session, workflow, model-switch, tool,approval, and question events remain user-visible progress checkpoints.+ Live answer text must be paced in the presentation layer, not throttled or+ mutated in the canonical stream state: appended content is revealed in short+ readable slices while the turn is streaming, and completed/restored messages+ render immediately from the full stored content. This adapts OpenCode's+ `createPacedValue` live markdown pattern in+ `packages/ui/src/components/message-part.tsx` so Pulse feels active without+ delaying copy/export, tool boundaries, approvals, or audit evidence.Completed Assistant tool rows follow the same source-anchored display policy:the referenced OpenCode commit`9ed17da55ab1f7360cc0e01075f763e27fa899e9` keeps ordinary tool activity tersediff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsxindex a1241c1aad..9521120a44 100644--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx@@ -83,6 +83,154 @@ const formatAssistantTurnDuration = (startedAt: Date, completedAt?: Date): strinconst markdownClass ='text-sm prose prose-slate prose-sm dark:prose-invert max-w-none prose-p:leading-relaxed prose-p:my-2 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-pre:rounded-md prose-pre:text-xs prose-pre:border prose-pre:border-slate-800 prose-code:text-blue-700 dark:prose-code:text-blue-300 prose-code:bg-blue-50 dark:prose-code:bg-blue-900 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:font-mono prose-code:text-[0.9em] prose-code:border prose-code:border-blue-100 dark:prose-code:border-blue-800 prose-code:before:content-none prose-code:after:content-none prose-headings:font-semibold prose-hr:border-slate-200 dark:prose-hr:border-slate-700 prose-ul:my-2 prose-ol:my-2 prose-li:my-1';+const TEXT_RENDER_PACE_MS = 24;+const TEXT_RENDER_SNAP = /[\s.,!?;:)\]]/;++const textRenderStep = (size: number) => {+ if (size <= 12) return 2;+ if (size <= 48) return 4;+ if (size <= 96) return 8;+ return Math.min(24, Math.ceil(size / 8));+};++const nextPacedTextIndex = (text: string, start: number) => {+ const end = Math.min(text.length, start + textRenderStep(text.length - start));+ const max = Math.min(text.length, end + 8);+ for (let idx = end; idx < max; idx += 1) {+ if (TEXT_RENDER_SNAP.test(text[idx] || '')) return idx + 1;+ }+ return end;+};++const pacedTextCache = new Map<string, string>();+const pacedTextCleanupTimers = new Map<string, ReturnType<typeof setTimeout>>();++const cancelPacedTextCleanup = (key: string) => {+ const timer = pacedTextCleanupTimers.get(key);+ if (!timer) return;+ clearTimeout(timer);+ pacedTextCleanupTimers.delete(key);+};++const deletePacedTextCache = (key: string) => {+ cancelPacedTextCleanup(key);+ pacedTextCache.delete(key);+};++const schedulePacedTextCleanup = (key: string) => {+ cancelPacedTextCleanup(key);+ pacedTextCleanupTimers.set(+ key,+ setTimeout(() => {+ pacedTextCleanupTimers.delete(key);+ pacedTextCache.delete(key);+ }, 1000),+ );+};++const createPacedText = (getText: () => string, live: () => boolean, cacheKey: () => string) => {+ const initialText = getText();+ const initialKey = cacheKey();+ if (initialKey) {+ cancelPacedTextCleanup(initialKey);+ }+ const cachedText = initialKey ? pacedTextCache.get(initialKey) : undefined;+ const initialValue =+ live() &&+ cachedText &&+ initialText.startsWith(cachedText) &&+ cachedText.length < initialText.length+ ? cachedText+ : initialText;+ const [value, setValue] = createSignal(initialValue);+ let shown = initialValue;+ let timeout: ReturnType<typeof setTimeout> | undefined;++ if (initialKey) {+ pacedTextCache.set(initialKey, initialValue);+ }++ const clear = () => {+ if (!timeout) return;+ clearTimeout(timeout);+ timeout = undefined;+ };++ const sync = (text: string) => {+ shown = text;+ setValue(text);+ const key = cacheKey();+ if (!key) return;+ if (live()) {+ cancelPacedTextCleanup(key);+ pacedTextCache.set(key, text);+ } else {+ deletePacedTextCache(key);+ }+ };++ const run = () => {+ timeout = undefined;+ const text = getText();+ if (!live()) {+ sync(text);+ return;+ }+ if (!text.startsWith(shown) || text.length <= shown.length) {+ sync(text);+ return;+ }+ const end = nextPacedTextIndex(text, shown.length);+ sync(text.slice(0, end));+ if (end < text.length) timeout = setTimeout(run, TEXT_RENDER_PACE_MS);+ };++ createEffect(() => {+ const text = getText();+ if (!live()) {+ clear();+ sync(text);+ return;+ }+ if (!text.startsWith(shown) || text.length < shown.length) {+ clear();+ sync(text);+ return;+ }+ if (text.length === shown.length || timeout) return;+ timeout = setTimeout(run, TEXT_RENDER_PACE_MS);+ });++ onCleanup(() => {+ clear();+ const key = cacheKey();+ if (key) schedulePacedTextCleanup(key);+ });++ return value;+};++const AssistantMarkdownBlock: Component<{+ text: string;+ streaming?: boolean;+ paceKey: string;+}> = (props) => {+ const visibleText = createPacedText(+ () => props.text,+ () => props.streaming === true,+ () => props.paceKey,+ );++ return (+ <div+ class={markdownClass}+ aria-live={props.streaming ? 'polite' : undefined}+ // eslint-disable-next-line solid/no-innerhtml+ innerHTML={renderMarkdown(visibleText())}+ />+ );+};+/*** MessageItem - Renders a single message in the chat.*@@ -465,12 +613,10 @@ export const MessageItem: Component<MessageItemProps> = (props) => {stripAssistantOutputArtifacts(evt.content || '').text}>- <div- class={markdownClass}- // eslint-disable-next-line solid/no-innerhtml- innerHTML={renderMarkdown(- stripAssistantOutputArtifacts(evt.content || '').text,- )}+ <AssistantMarkdownBlock+ text={stripAssistantOutputArtifacts(evt.content || '').text}+ streaming={props.message.isStreaming}+ paceKey={`${props.message.id}:stream:${index()}`}/></Match>@@ -500,10 +646,10 @@ export const MessageItem: Component<MessageItemProps> = (props) => {{/* Fallback */}<Show when={visibleMessageContent() && !hasRenderableStreamEvents()}>- <div- class={markdownClass}- // eslint-disable-next-line solid/no-innerhtml- innerHTML={renderMarkdown(visibleMessageContent())}+ <AssistantMarkdownBlock+ text={visibleMessageContent()}+ streaming={props.message.isStreaming}+ paceKey={`${props.message.id}:fallback`}/></Show>diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsxindex e2026f50ff..5a27c5c0f7 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx@@ -1,5 +1,6 @@import { describe, expect, it, vi, afterEach } from 'vitest';import { cleanup, render, screen, fireEvent } from '@solidjs/testing-library';+import { createSignal } from 'solid-js';import { MessageItem } from '../MessageItem';import type { ChatMessage, PendingApproval, PendingQuestion, StreamDisplayEvent } from '../types';@@ -80,7 +81,10 @@ vi.mock('../../aiChatUtils', () => ({renderMarkdown: (text: string) => `<p>${text}</p>`,}));-afterEach(cleanup);+afterEach(() => {+ cleanup();+ vi.useRealTimers();+});function makeMessage(overrides?: Partial<ChatMessage>): ChatMessage {return {@@ -871,6 +875,33 @@ describe('MessageItem', () => {expect(prose!.innerHTML).toContain('<p>Here is the analysis</p>');});+ it('paces appended streaming content instead of dumping the whole delta at once', async () => {+ vi.useFakeTimers();+ const [content, setContent] = createSignal('A');+ const message = () =>+ makeMessage({+ role: 'assistant',+ content: content(),+ isStreaming: true,+ streamEvents: [{ type: 'content', content: content() }],+ });++ const { container } = render(() => <MessageItem message={message()} {...makeHandlers()} />);+ const prose = () => container.querySelector('.prose') as HTMLElement;++ expect(prose().innerHTML).toContain('<p>A</p>');++ setContent('A readable streaming answer lands over a few frames.');+ await Promise.resolve();++ expect(prose().innerHTML).toContain('<p>A</p>');+ expect(prose().innerHTML).not.toContain('streaming answer lands');++ await vi.runAllTimersAsync();++ expect(prose().innerHTML).toContain('A readable streaming answer lands over a few frames.');+ });+it('strips serialized tool-call text from content blocks', () => {const events: StreamDisplayEvent[] = [{diff --git a/frontend-modern/src/components/AI/Chat/__tests__/transcriptExport.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/transcriptExport.test.tsindex 4b720c8c6c..b58eaf4f09 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/transcriptExport.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/transcriptExport.test.ts@@ -78,7 +78,8 @@ describe('Assistant transcript export', () => {expect(transcript).toContain('Model: DeepSeek via OpenRouter');expect(transcript).toContain('[status] Checking device nodes');expect(transcript).toContain('[tool:read]');- expect(transcript).toContain('ls /dev | wc -l');+ expect(transcript).toContain('Inspect devices on current resource');+ expect(transcript).not.toContain('ls /dev | wc -l');expect(transcript).toContain('completed');expect(transcript).toContain('There are 4,358 entries in /dev.');expect(transcript).not.toContain('4358\n\n##');@@ -90,7 +91,7 @@ describe('Assistant transcript export', () => {id: 'assistant-1',role: 'assistant',content:- "I'llcheckthedevicenodesinsidethecontainertoanswerthat.Letmecounttheentriesin/devandlisttheblockdevices.pulse_read(target_host=\"current_resource\",command=\"ls/dev|wc-l\")",+ 'I\'llcheckthedevicenodesinsidethecontainertoanswerthat.Letmecounttheentriesin/devandlisttheblockdevices.pulse_read(target_host="current_resource",command="ls/dev|wc-l")',thinking: 'Private chain of thought',timestamp,streamEvents: [