Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Make Assistant route status explicit

rcourtman57a9bda26a47
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
index 650c8854f7..2538b71819 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -444,7 +444,7 @@ async function waitForProviderCheckSettled() {
expect(mockAIAPI.testProvider).toHaveBeenCalled();
});
await waitFor(() => {
- expect(screen.queryByText('Verifying OpenAI provider')).not.toBeInTheDocument();
+ expect(screen.queryByText('Verifying selected model route')).not.toBeInTheDocument();
});
await waitFor(() => {
expect(screen.getByRole('button', { name: 'Send message' })).not.toBeDisabled();
@@ -1055,20 +1055,23 @@ describe('AIChat', () => {
await waitFor(() => {
expect(mockAIAPI.testProvider).toHaveBeenCalledWith('deepseek', 'deepseek:deepseek-v4-pro');
- expect(screen.getByLabelText('Assistant provider status')).toHaveTextContent(
- 'DeepSeek provider issue',
+ expect(screen.getByLabelText('Assistant selected model route status')).toHaveTextContent(
+ 'Selected model route issue',
);
});
- expect(screen.getByLabelText('Assistant provider status')).toHaveTextContent(
+ expect(screen.getByLabelText('Assistant selected model route status')).toHaveTextContent(
'Pulse could not maintain a healthy connection to this provider.',
);
+ expect(screen.getByLabelText('Assistant selected model route status')).toHaveTextContent(
+ 'This route stays selected until you choose another route.',
+ );
expect(screen.getByRole('link', { name: /Open settings/ })).toHaveAttribute(
'href',
'/settings/system-ai',
);
});
- it('shows pending selected-provider checks in the composer without blocking input', async () => {
+ it('shows pending selected-route checks in the composer without blocking input', async () => {
mockAIAPI.getSettings.mockResolvedValue({
model: 'openai:gpt-4',
chat_model: '',
@@ -1083,9 +1086,11 @@ describe('AIChat', () => {
await waitFor(() => {
expect(mockAIAPI.testProvider).toHaveBeenCalledWith('openai', 'openai:gpt-4');
});
- expect(screen.queryByText('Verifying OpenAI provider')).not.toBeInTheDocument();
- expect(screen.queryByLabelText('Assistant provider status')).not.toBeInTheDocument();
- expect(screen.getByLabelText('Assistant provider route health')).toHaveTextContent(
+ expect(screen.queryByText('Verifying selected model route')).not.toBeInTheDocument();
+ expect(
+ screen.queryByLabelText('Assistant selected model route status'),
+ ).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Assistant selected model route health')).toHaveTextContent(
'Checking OpenAI',
);
@@ -1106,7 +1111,7 @@ describe('AIChat', () => {
expect(document.activeElement).toBe(textarea);
});
- it('sends user input while a selected provider issue is unresolved', async () => {
+ it('sends user input while a selected model route issue is unresolved', async () => {
mockAIAPI.getSettings.mockResolvedValue({
model: 'deepseek:deepseek-v4-pro',
chat_model: '',
@@ -1127,7 +1132,7 @@ describe('AIChat', () => {
renderChat();
- await screen.findByText('DeepSeek provider issue');
+ await screen.findByText('Selected model route issue');
const textarea = screen.getByPlaceholderText(
'Ask about your infrastructure...',
) as HTMLTextAreaElement;
@@ -1177,8 +1182,8 @@ describe('AIChat', () => {
expect(
screen.queryByRole('status', { name: 'Assistant provider readiness route adopted' }),
).not.toBeInTheDocument();
- expect(screen.getByLabelText('Assistant provider status')).toHaveTextContent(
- 'OpenRouter provider issue',
+ expect(screen.getByLabelText('Assistant selected model route status')).toHaveTextContent(
+ 'Selected model route issue',
);
expect(mockNotificationStore.success).not.toHaveBeenCalledWith(
expect.stringContaining('after OpenRouter provider check'),
@@ -1207,7 +1212,7 @@ describe('AIChat', () => {
renderChat();
- await screen.findByText('OpenAI provider issue');
+ await screen.findByText('Selected model route issue');
const textarea = screen.getByPlaceholderText(
'Ask about your infrastructure...',
) as HTMLTextAreaElement;
@@ -1375,14 +1380,16 @@ describe('AIChat', () => {
renderChat();
await waitFor(() => {
- expect(screen.getByText('DeepSeek provider issue')).toBeInTheDocument();
+ expect(screen.getByText('Selected model route issue')).toBeInTheDocument();
});
- fireEvent.click(screen.getByRole('button', { name: 'Retry provider check' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Retry route check' }));
await waitFor(() => {
expect(mockAIAPI.testProvider).toHaveBeenCalledTimes(2);
- expect(screen.queryByLabelText('Assistant provider status')).not.toBeInTheDocument();
+ expect(
+ screen.queryByLabelText('Assistant selected model route status'),
+ ).not.toBeInTheDocument();
});
});
@@ -2148,7 +2155,9 @@ describe('AIChat', () => {
'openrouter:deepseek/deepseek-v4-pro',
);
});
- expect(screen.queryByLabelText('Assistant provider status')).not.toBeInTheDocument();
+ expect(
+ screen.queryByLabelText('Assistant selected model route status'),
+ ).not.toBeInTheDocument();
mockAIAPI.testProvider.mockClear();
const textarea = screen.getByPlaceholderText('Ask about your infrastructure...');
@@ -2163,14 +2172,14 @@ describe('AIChat', () => {
});
await waitFor(() => {
- expect(screen.getByLabelText('Assistant provider status')).toHaveTextContent(
- 'OpenRouter provider ready',
+ expect(screen.getByLabelText('Assistant selected model route status')).toHaveTextContent(
+ 'Selected model route ready',
);
});
- const status = screen.getByLabelText('Assistant provider status');
+ const status = screen.getByLabelText('Assistant selected model route status');
expect(status).toHaveTextContent('Connection successful');
expect(status).toHaveTextContent('Route:');
- expect(screen.getByRole('button', { name: 'Hide provider status' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Hide route status' })).toBeInTheDocument();
expect(mockChat.sendMessage).not.toHaveBeenCalled();
});
@@ -5603,9 +5612,7 @@ describe('AIChat', () => {
expect(status).not.toHaveTextContent('OpenRouter is starting the response.');
await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS);
- expect(status).toHaveTextContent(
- 'Reading current Pulse inventory. · 1 follow-up queued',
- );
+ expect(status).toHaveTextContent('Reading current Pulse inventory. · 1 follow-up queued');
await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS);
expect(status).toHaveTextContent('OpenRouter is starting the response. · 1 follow-up queued');
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index 5a793c4cc9..7c6ba311ea 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -1880,6 +1880,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
const providerReadinessPresentation = createMemo(() => {
const readiness = providerReadiness();
const visible = providerReadinessVisible();
+ const routeLabel = readiness.model?.trim() ? formatChatMessageModelRoute(readiness.model) : '';
if (!readiness.provider || readiness.status === 'idle') {
return null;
}
@@ -1898,6 +1899,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
? 'checking'
: 'error',
providerLabel: getAIProviderDisplayName(readiness.provider),
+ routeLabel,
message: readiness.message,
summary: readiness.summary,
recommendation: readiness.recommendation,
@@ -1986,9 +1988,9 @@ export const AIChat: Component<AIChatProps> = (props) => {
provider,
model,
message: 'Provider check failed',
- summary: 'Pulse could not verify the selected provider route.',
+ summary: 'Pulse could not verify the selected model route.',
recommendation:
- 'Check provider settings and network reachability, then retry the provider check.',
+ 'Check provider settings and network reachability, then retry the route check.',
action: 'open_provider_settings',
});
}
@@ -4245,7 +4247,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-800 dark:bg-emerald-950 dark:text-emerald-100'
: 'border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100'
}`}
- aria-label="Assistant provider status"
+ aria-label="Assistant selected model route status"
>
<div class="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between">
<div class="flex min-w-0 items-start gap-2.5">
@@ -4263,11 +4265,21 @@ export const AIChat: Component<AIChatProps> = (props) => {
<div class="mt-0.5 leading-5">{presentation().body}</div>
<Show when={providerReadiness().model}>
{(model) => (
- <div class="mt-0.5 truncate text-[10px] leading-5 text-muted">
+ <div
+ class="mt-0.5 truncate text-[10px] leading-5 text-muted"
+ title={`Selected route ID: ${model()}`}
+ >
Route: {formatAIModelRouteLabel(model())}
</div>
)}
</Show>
+ <Show
+ when={providerReadiness().status === 'error' && providerReadiness().model}
+ >
+ <div class="mt-0.5 text-[10px] leading-5 text-muted">
+ This route stays selected until you choose another route.
+ </div>
+ </Show>
<Show when={presentation().recommendation}>
{(recommendation) => <div class="mt-0.5 leading-5">{recommendation()}</div>}
</Show>
@@ -4284,7 +4296,9 @@ export const AIChat: Component<AIChatProps> = (props) => {
aria-label={providerReadinessAlternativeButtonLabel()}
title={alternative().label}
>
- <span class="truncate">{providerReadinessAlternativeButtonLabel()}</span>
+ <span class="truncate">
+ {providerReadinessAlternativeButtonLabel()}
+ </span>
</button>
)}
</Show>
@@ -4293,7 +4307,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
onClick={retrySelectedProviderReadiness}
disabled={providerReadiness().status === 'checking'}
class="inline-flex items-center gap-1.5 rounded-md border border-current/20 bg-surface px-2 py-1 text-[10px] font-medium text-base-content hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60"
- aria-label="Retry provider check"
+ aria-label="Retry route check"
>
<RefreshCwIcon class="h-3.5 w-3.5" />
<span>{AI_CHAT_PROVIDER_READINESS_RETRY_LABEL}</span>
@@ -4310,7 +4324,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
type="button"
onClick={() => setProviderReadinessVisible(false)}
class="inline-flex items-center gap-1.5 rounded-md border border-current/20 bg-surface px-2 py-1 text-[10px] font-medium text-base-content hover:bg-surface-hover"
- aria-label="Hide provider status"
+ aria-label="Hide route status"
>
<XIcon class="h-3.5 w-3.5" />
<span>Hide</span>
@@ -4710,7 +4724,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
{(health) => (
<div
role="status"
- aria-label="Assistant provider route health"
+ aria-label="Assistant selected model route health"
aria-live="polite"
title={health().title}
class={`inline-flex h-7 max-w-[11rem] shrink-0 items-center gap-1.5 rounded-md border px-2 text-[10px] font-medium ${health().className}`}
diff --git a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
index c23a861b15..038a5eb98e 100644
--- a/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts
@@ -133,12 +133,13 @@ describe('aiChatPresentation', () => {
getAIChatProviderReadinessPresentation({
status: 'error',
providerLabel: 'DeepSeek',
+ routeLabel: 'DeepSeek: DeepSeek V4 Pro',
summary: 'Pulse could not maintain a healthy connection to this provider.',
recommendation: 'Check provider reachability.',
}),
).toEqual({
tone: 'error',
- title: 'DeepSeek provider issue',
+ title: 'Selected model route issue',
body: 'Pulse could not maintain a healthy connection to this provider.',
recommendation: 'Check provider reachability.',
});
@@ -147,18 +148,20 @@ describe('aiChatPresentation', () => {
getAIChatProviderReadinessPresentation({
status: 'checking',
providerLabel: 'OpenRouter',
+ routeLabel: 'DeepSeek: DeepSeek V4 Pro via OpenRouter',
}).title,
- ).toBe('Verifying OpenRouter provider');
+ ).toBe('Verifying selected model route');
expect(
getAIChatProviderReadinessPresentation({
status: 'ready',
providerLabel: 'OpenRouter',
+ routeLabel: 'DeepSeek: DeepSeek V4 Pro via OpenRouter',
message: 'Connection successful',
}),
).toEqual({
tone: 'ready',
- title: 'OpenRouter provider ready',
+ title: 'Selected model route ready',
body: 'Connection successful',
});
});
diff --git a/frontend-modern/src/utils/aiChatPresentation.ts b/frontend-modern/src/utils/aiChatPresentation.ts
index 2d8c5ec64e..579da327a6 100644
--- a/frontend-modern/src/utils/aiChatPresentation.ts
+++ b/frontend-modern/src/utils/aiChatPresentation.ts
@@ -93,38 +93,50 @@ export function getAIChatProviderReadinessPresentation(args: {
message?: string;
providerLabel?: string;
recommendation?: string;
+ routeLabel?: string;
status: AIChatProviderReadinessStatus;
summary?: string;
}): AIChatProviderReadinessPresentation {
const providerLabel = args.providerLabel?.trim() || 'Selected';
+ const routeLabel = args.routeLabel?.trim();
+ const providerSuffix =
+ providerLabel && providerLabel.toLowerCase() !== 'selected' ? ` through ${providerLabel}` : '';
+ const fallbackSubject =
+ providerLabel.toLowerCase() === 'selected'
+ ? 'Selected model route'
+ : `${providerLabel} provider route`;
if (args.status === 'checking') {
return {
tone: 'checking',
- title: `Verifying ${providerLabel} provider`,
- body: 'Pulse is checking the selected provider route in the background.',
+ title: routeLabel ? 'Verifying selected model route' : `Verifying ${fallbackSubject}`,
+ body: routeLabel
+ ? `Pulse is checking ${routeLabel}${providerSuffix}.`
+ : 'Pulse is checking the selected model route.',
};
}
if (args.status === 'ready') {
return {
tone: 'ready',
- title: `${providerLabel} provider ready`,
+ title: routeLabel ? 'Selected model route ready' : `${fallbackSubject} ready`,
body:
args.summary?.trim() ||
args.message?.trim() ||
- 'Pulse can reach the selected provider route.',
+ (routeLabel
+ ? `Pulse can reach ${routeLabel}${providerSuffix}.`
+ : 'Pulse can reach the selected model route.'),
};
}
const body =
args.summary?.trim() ||
args.message?.trim() ||
- 'Pulse could not verify the selected provider route.';
+ 'Pulse could not verify the selected model route.';
const recommendation = args.recommendation?.trim() || undefined;
return {
tone: 'error',
- title: `${providerLabel} provider issue`,
+ title: routeLabel ? 'Selected model route issue' : `${fallbackSubject} issue`,
body,
recommendation,
};