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
Replace live Assistant workflow status
rcourtman357d7c59518c
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex 216ef2e918..c14e05835c 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -1248,7 +1248,7 @@ describe('useChat', () => {dispose();});- it('coalesces same workflow activity and appends later phases as visible progress', async () => {+ it('replaces neutral workflow activity until a durable stream boundary appears', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -1315,12 +1315,6 @@ describe('useChat', () => {}),);expect(assistant.streamEvents).toEqual([- expect.objectContaining({- type: 'workflow_status',- workflowStatus: expect.objectContaining({- message: 'Built compact inventory context for the model.',- }),- }),expect.objectContaining({type: 'workflow_status',workflowStatus: expect.objectContaining({@@ -1332,7 +1326,7 @@ describe('useChat', () => {dispose();});- it('keeps workflow progress visible when answer content starts streaming', async () => {+ it('clears neutral workflow progress when answer content starts streaming', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -1351,14 +1345,11 @@ describe('useChat', () => {const assistant = chat.messages().find((m) => m.role === 'assistant')!;expect(assistant.content).toBe('Here is the answer.');expect(assistant.workflowStatus).toBeUndefined();- expect(assistant.streamEvents?.map((event) => event.type)).toEqual([- 'workflow_status',- 'content',- ]);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);dispose();});- it('keeps workflow progress visible when a governed tool block starts', async () => {+ it('clears neutral workflow progress when a governed tool block starts', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -1377,10 +1368,7 @@ describe('useChat', () => {const assistant = chat.messages().find((m) => m.role === 'assistant')!;expect(assistant.workflowStatus).toBeUndefined();expect(assistant.pendingTools).toHaveLength(1);- expect(assistant.streamEvents?.map((event) => event.type)).toEqual([- 'workflow_status',- 'pending_tool',- ]);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['pending_tool']);dispose();});@@ -1425,11 +1413,10 @@ describe('useChat', () => {}),);expect(assistant.streamEvents?.map((event) => event.type)).toEqual([- 'workflow_status','tool','workflow_status',]);- expect(assistant.streamEvents?.[2]).toEqual(+ expect(assistant.streamEvents?.[1]).toEqual(expect.objectContaining({workflowStatus: expect.objectContaining({phase: 'model_thinking',@@ -1954,7 +1941,7 @@ describe('useChat', () => {dispose();});- it('done event removes unresolved interactive rows but keeps visible workflow activity', async () => {+ it('done event removes unresolved interactive rows and neutral workflow activity', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -1995,10 +1982,7 @@ describe('useChat', () => {expect(assistant.pendingTools).toEqual([]);expect(assistant.pendingApprovals).toEqual([]);expect(assistant.pendingQuestions).toEqual([]);- expect(assistant.streamEvents?.map((event) => event.type)).toEqual([- 'workflow_status',- 'content',- ]);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);dispose();});@@ -2019,7 +2003,7 @@ describe('useChat', () => {dispose();});- it('error event removes unresolved interactive rows but keeps visible workflow activity', async () => {+ it('error event removes unresolved interactive rows and neutral workflow activity', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -2061,10 +2045,7 @@ describe('useChat', () => {expect(assistant.pendingTools).toEqual([]);expect(assistant.pendingApprovals).toEqual([]);expect(assistant.pendingQuestions).toEqual([]);- expect(assistant.streamEvents?.map((event) => event.type)).toEqual([- 'workflow_status',- 'content',- ]);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);dispose();});diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.tsindex 87573cd8b0..25e1313391 100644--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts@@ -160,13 +160,23 @@ export function useChat(options: UseChatOptions = {}) {return promise;};- const streamEventsWithoutUnresolvedInteractiveRows = (+ const streamEventsWithoutWorkflowStatusRows = (+ events: StreamDisplayEvent[] | undefined,+ ): StreamDisplayEvent[] | undefined => {+ if (!events) return events;+ return events.filter((event) => event.type !== 'workflow_status');+ };++ const streamEventsWithoutTransientRows = (events: StreamDisplayEvent[] | undefined,): StreamDisplayEvent[] | undefined => {if (!events) return events;return events.filter((event) =>- event.type !== 'pending_tool' && event.type !== 'approval' && event.type !== 'question',+ event.type !== 'pending_tool' &&+ event.type !== 'approval' &&+ event.type !== 'question' &&+ event.type !== 'workflow_status',);};@@ -193,7 +203,7 @@ export function useChat(options: UseChatOptions = {}) {pendingApprovals: [],pendingQuestions: [],streamEvents: interruption- ? streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents)+ ? streamEventsWithoutTransientRows(msg.streamEvents): msg.streamEvents,workflowStatus: undefined,}@@ -262,7 +272,10 @@ export function useChat(options: UseChatOptions = {}) {const addStreamEvent = (msg: ChatMessage, event: StreamDisplayEvent): ChatMessage => {const nextEvent = withStreamEventTiming(event);- const events = msg.streamEvents || [];+ const events =+ nextEvent.type === 'workflow_status'+ ? msg.streamEvents || []+ : streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || [];// For content events, merge consecutive content into oneif (nextEvent.type === 'content' && events.length > 0) {@@ -310,18 +323,6 @@ export function useChat(options: UseChatOptions = {}) {};};- const shouldCoalesceWorkflowStatusEvents = (previous?: WorkflowStatus, next?: WorkflowStatus) => {- if (!previous || !next) return false;- return (- (previous.phase || '') === (next.phase || '') &&- (previous.state || '') === (next.state || '') &&- (previous.tool || '') === (next.tool || '') &&- (previous.attempt || 0) === (next.attempt || 0) &&- (previous.maxAttempts || 0) === (next.maxAttempts || 0) &&- (previous.retryAfterMs || 0) === (next.retryAfterMs || 0)- );- };-const withWorkflowStatusEvent = (msg: ChatMessage,workflowStatus: WorkflowStatus,@@ -343,18 +344,16 @@ export function useChat(options: UseChatOptions = {}) {if (workflowStatusesMatch(last.workflowStatus, workflowStatus)) {return msg;}- if (shouldCoalesceWorkflowStatusEvents(last.workflowStatus, workflowStatus)) {- return {- ...msg,- streamEvents: [- ...events.slice(0, -1),- {- ...nextEvent,- startedAt: last.startedAt || nextEvent.startedAt,- },- ],- };- }+ return {+ ...msg,+ streamEvents: [+ ...events.slice(0, -1),+ {+ ...nextEvent,+ startedAt: nextEvent.startedAt || last.startedAt,+ },+ ],+ };}return addStreamEvent(msg, nextEvent);@@ -476,7 +475,7 @@ export function useChat(options: UseChatOptions = {}) {return {...msg,streamEvents: replacePendingToolStreamEvents(- msg.streamEvents || [],+ streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || [],resolvedTool,matchesTool,now,@@ -555,7 +554,12 @@ export function useChat(options: UseChatOptions = {}) {return {...msg,streamEvents: resolvedTool- ? replacePendingToolStreamEvents(msg.streamEvents || [], resolvedTool, matchesTool, now)+ ? replacePendingToolStreamEvents(+ streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || [],+ resolvedTool,+ matchesTool,+ now,+ ): msg.streamEvents,workflowStatus: undefined,pendingTools: updatedPendingTools,@@ -1033,11 +1037,12 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: (msg.pendingTools || []).filter((tool) => !matchesTool(tool, tool.id),),- streamEvents: (msg.streamEvents || []).filter(- (streamEvent) =>- streamEvent.type !== 'pending_tool' ||- !matchesTool(streamEvent.pendingTool, streamEvent.toolId),- ),+ streamEvents: (streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || [])+ .filter(+ (streamEvent) =>+ streamEvent.type !== 'pending_tool' ||+ !matchesTool(streamEvent.pendingTool, streamEvent.toolId),+ ),};}@@ -1052,7 +1057,7 @@ export function useChat(options: UseChatOptions = {}) {success: boolean;};const pendingTools = msg.pendingTools || [];- const events = msg.streamEvents || [];+ const events = streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || [];const normalizedEndName = normalizeChatToolName(data.name || '');@@ -1324,9 +1329,7 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutUnresolvedInteractiveRows(- flushedMsg.streamEvents,- ),+ streamEvents: streamEventsWithoutTransientRows(flushedMsg.streamEvents),tokens,workflowStatus: undefined,};@@ -1339,7 +1342,7 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutUnresolvedInteractiveRows(flushedMsg.streamEvents),+ streamEvents: streamEventsWithoutTransientRows(flushedMsg.streamEvents),workflowStatus: undefined,};}@@ -1356,7 +1359,7 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents),+ streamEvents: streamEventsWithoutTransientRows(msg.streamEvents),workflowStatus: undefined,error: errorMsg || 'Request failed',};@@ -1535,7 +1538,7 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents),+ streamEvents: streamEventsWithoutTransientRows(msg.streamEvents),workflowStatus: undefined,error: errorMessage,}