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.

Explain unavailable Assistant help commands

rcourtman94c8df87d7d5
diff --git a/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
index 6a21891695..e570d6c038 100644
--- a/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
+++ b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
@@ -80,7 +80,7 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogProp
case 'Enter': {
consumeDialogCloseKey(event);
const command = selectedCommand();
- if (!command || command.disabled) return;
+ if (!command) return;
props.onRunCommand(command);
break;
}
@@ -183,14 +183,12 @@ export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogProp
role="option"
aria-selected={item.index === selectedCommandIndex()}
aria-disabled={command.disabled ? 'true' : undefined}
- disabled={command.disabled}
class={`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left transition-colors focus:outline-none ${
command.disabled
- ? 'cursor-not-allowed opacity-55'
+ ? 'cursor-help opacity-55'
: 'hover:bg-surface-hover focus:bg-surface-hover'
} ${item.index === selectedCommandIndex() ? 'bg-surface-hover' : ''}`}
onClick={() => {
- if (command.disabled) return;
props.onRunCommand(command);
}}
onMouseEnter={() => setSelectedCommandIndex(item.index)}
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 c311c31a17..9dc82d358d 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -1926,6 +1926,32 @@ describe('AIChat', () => {
expect(mockChat.sendMessage).not.toHaveBeenCalled();
});
+ it('explains unavailable commands selected from Assistant command help', async () => {
+ renderChat();
+ const textarea = screen.getByPlaceholderText('Ask about your infrastructure...');
+
+ fireEvent.input(textarea, { target: { value: '/commands' } });
+ fireEvent.keyDown(textarea, { key: 'Enter' });
+
+ expect(screen.getByRole('dialog', { name: 'Assistant commands' })).toBeInTheDocument();
+ fireEvent.input(screen.getByLabelText('Search Assistant commands'), {
+ target: { value: 'compact' },
+ });
+ fireEvent.click(screen.getByRole('option', { name: /\/compact/ }));
+
+ await waitFor(() => {
+ expect(
+ screen.queryByRole('dialog', { name: 'Assistant commands' }),
+ ).not.toBeInTheDocument();
+ expect(mockNotificationStore.info).toHaveBeenCalledWith(
+ 'Requires a saved Assistant session.',
+ 2000,
+ );
+ });
+ expect(mockAIChatAPI.summarizeSession).not.toHaveBeenCalled();
+ expect(mockChat.sendMessage).not.toHaveBeenCalled();
+ });
+
it('opens Assistant provider settings from /connect without sending a provider prompt', async () => {
const onClose = vi.fn();
renderChat(onClose);
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx
index cf3d50db6a..936a4c0204 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AssistantCommandHelpDialog.test.tsx
@@ -80,7 +80,7 @@ describe('AssistantCommandHelpDialog', () => {
expect(screen.queryByText('Model')).not.toBeInTheDocument();
});
- it('shows disabled commands in help without running them', () => {
+ it('keeps disabled commands selectable so the caller can explain them', () => {
const onRunCommand = vi.fn();
render(() => (
<AssistantCommandHelpDialog
@@ -101,11 +101,13 @@ describe('AssistantCommandHelpDialog', () => {
const compactCommand = screen.getByRole('option', { name: /\/compact/ });
expect(compactCommand).toHaveAttribute('aria-disabled', 'true');
- expect(compactCommand).toBeDisabled();
+ expect(compactCommand).not.toBeDisabled();
expect(screen.getByText('Requires transcript content.')).toBeInTheDocument();
fireEvent.keyDown(document, { key: 'Enter' });
- expect(onRunCommand).not.toHaveBeenCalled();
+ expect(onRunCommand).toHaveBeenCalledWith(
+ expect.objectContaining({ action: 'compact', name: 'compact' }),
+ );
});
it('consumes Escape as a local dialog close command', () => {