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.

Add Assistant help command

rcourtman7614875ba09b
diff --git a/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
new file mode 100644
index 0000000000..3c9a92a1f0
--- /dev/null
+++ b/frontend-modern/src/components/AI/Chat/AssistantCommandHelpDialog.tsx
@@ -0,0 +1,93 @@
+import { For, Show, createEffect, onCleanup } from 'solid-js';
+import XIcon from 'lucide-solid/icons/x';
+import {
+ ASSISTANT_SLASH_COMMANDS,
+ getAssistantSlashCommandTokens,
+ type AssistantSlashCommand,
+} from './assistantSlashCommands';
+import { AssistantSlashCommandIcon } from './SlashCommandAutocomplete';
+import {
+ AI_CHAT_COMMAND_HELP_CLOSE_LABEL,
+ AI_CHAT_COMMAND_HELP_TITLE,
+} from '@/utils/aiChatPresentation';
+
+interface AssistantCommandHelpDialogProps {
+ onClose: () => void;
+ onRunCommand: (command: AssistantSlashCommand) => void;
+}
+
+export function AssistantCommandHelpDialog(props: AssistantCommandHelpDialogProps) {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (event.key !== 'Escape') return;
+ event.preventDefault();
+ props.onClose();
+ };
+
+ createEffect(() => {
+ document.addEventListener('keydown', handleKeyDown);
+ onCleanup(() => document.removeEventListener('keydown', handleKeyDown));
+ });
+
+ return (
+ <div
+ class="absolute inset-0 z-50 flex items-end bg-slate-950/20 p-3 sm:items-center sm:justify-center"
+ onClick={props.onClose}
+ >
+ <section
+ role="dialog"
+ aria-modal="true"
+ aria-label={AI_CHAT_COMMAND_HELP_TITLE}
+ class="max-h-[min(34rem,calc(100%-1.5rem))] w-full max-w-[30rem] overflow-hidden rounded-md border border-border bg-surface shadow-xl"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <div class="flex min-h-12 items-center justify-between gap-3 border-b border-border px-4 py-3">
+ <h3 class="text-sm font-semibold text-base-content">{AI_CHAT_COMMAND_HELP_TITLE}</h3>
+ <button
+ type="button"
+ onClick={props.onClose}
+ class="inline-flex h-8 w-8 items-center justify-center rounded-md text-muted transition-colors hover:bg-surface-hover hover:text-base-content"
+ title={AI_CHAT_COMMAND_HELP_CLOSE_LABEL}
+ aria-label={AI_CHAT_COMMAND_HELP_CLOSE_LABEL}
+ >
+ <XIcon class="h-4 w-4" aria-hidden="true" />
+ </button>
+ </div>
+ <div class="max-h-[28rem] overflow-y-auto p-2" role="list">
+ <For each={ASSISTANT_SLASH_COMMANDS}>
+ {(command) => {
+ const aliases = () => getAssistantSlashCommandTokens(command).slice(1);
+ return (
+ <button
+ type="button"
+ class="flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-surface-hover focus:bg-surface-hover focus:outline-none"
+ onClick={() => props.onRunCommand(command)}
+ >
+ <span class="mt-0.5 text-muted">
+ <AssistantSlashCommandIcon action={command.action} />
+ </span>
+ <span class="min-w-0 flex-1">
+ <span class="flex min-w-0 flex-wrap items-center gap-2">
+ <span class="font-mono text-xs font-semibold text-base-content">
+ /{command.name}
+ </span>
+ <Show when={aliases().length > 0}>
+ <span class="min-w-0 truncate text-[10px] text-muted">
+ {aliases()
+ .map((alias) => `/${alias}`)
+ .join(', ')}
+ </span>
+ </Show>
+ </span>
+ <span class="mt-0.5 block text-xs leading-5 text-muted">
+ {command.description}
+ </span>
+ </span>
+ </button>
+ );
+ }}
+ </For>
+ </div>
+ </section>
+ </div>
+ );
+}
diff --git a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
index b42edcb1a2..3418c68dfe 100644
--- a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
+++ b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
@@ -8,6 +8,7 @@ import PlusIcon from 'lucide-solid/icons/plus';
import Redo2Icon from 'lucide-solid/icons/redo-2';
import SettingsIcon from 'lucide-solid/icons/settings';
import Undo2Icon from 'lucide-solid/icons/undo-2';
+import CircleHelpIcon from 'lucide-solid/icons/circle-help';
import type { AssistantSlashCommand, AssistantSlashCommandAction } from './assistantSlashCommands';
import {
filterAssistantSlashCommands,
@@ -22,8 +23,10 @@ interface SlashCommandAutocompleteProps {
onSelect: (command: AssistantSlashCommand) => void;
}
-const commandIcon = (action: AssistantSlashCommandAction) => {
- switch (action) {
+export const AssistantSlashCommandIcon = (props: { action: AssistantSlashCommandAction }) => {
+ switch (props.action) {
+ case 'help':
+ return <CircleHelpIcon class="h-4 w-4" aria-hidden="true" />;
case 'new':
return <PlusIcon class="h-4 w-4" aria-hidden="true" />;
case 'sessions':
@@ -104,9 +107,7 @@ export function SlashCommandAutocomplete(props: SlashCommandAutocompleteProps) {
data-slash-command-autocomplete
onClick={(event) => event.stopPropagation()}
>
- <div class="border-b border-border px-3 py-2 text-xs font-medium text-muted">
- Commands
- </div>
+ <div class="border-b border-border px-3 py-2 text-xs font-medium text-muted">Commands</div>
<div class="max-h-[260px] overflow-y-auto" role="listbox" aria-label="Assistant commands">
<For each={commands()}>
{(command, index) => (
@@ -124,7 +125,9 @@ export function SlashCommandAutocomplete(props: SlashCommandAutocompleteProps) {
}}
onMouseEnter={() => setSelectedIndex(index())}
>
- <span class="mt-0.5 text-muted">{commandIcon(command.action)}</span>
+ <span class="mt-0.5 text-muted">
+ <AssistantSlashCommandIcon action={command.action} />
+ </span>
<span class="min-w-0 flex-1">
<span class="flex min-w-0 items-center gap-2">
<span class="font-mono text-xs font-semibold text-base-content">
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 22891ce60e..79270e0814 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -133,7 +133,7 @@ const {
commandRequestSignal: vi.fn(
(): {
id: number;
- action: 'new' | 'sessions' | 'models' | 'status' | 'undo' | 'redo';
+ action: 'help' | 'new' | 'sessions' | 'models' | 'status' | 'undo' | 'redo';
} | null => null,
),
ackCommandRequest: vi.fn(),
@@ -1622,6 +1622,42 @@ describe('AIChat', () => {
expect(mockChat.sendMessage).not.toHaveBeenCalled();
});
+ it('opens Assistant command help from /help without sending a provider prompt', async () => {
+ renderChat();
+ const textarea = screen.getByPlaceholderText('Ask about your infrastructure...');
+
+ fireEvent.input(textarea, { target: { value: '/help' } });
+ fireEvent.keyDown(textarea, { key: 'Enter' });
+
+ expect(screen.getByRole('dialog', { name: 'Assistant commands' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /\/models/ })).toHaveTextContent(
+ 'Choose the model and provider route',
+ );
+ expect(screen.getByRole('button', { name: /\/status/ })).toHaveTextContent(
+ 'Check the selected model route',
+ );
+ expect(mockChat.sendMessage).not.toHaveBeenCalled();
+ });
+
+ it('runs commands 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.click(screen.getByRole('button', { name: /\/models/ }));
+
+ await waitFor(() => {
+ expect(
+ screen.queryByRole('dialog', { name: 'Assistant commands' }),
+ ).not.toBeInTheDocument();
+ expect(screen.getByTestId('model-selector')).toHaveAttribute('data-open-request', '1');
+ });
+ expect(mockChat.sendMessage).not.toHaveBeenCalled();
+ });
+
it('filters slash command suggestions by alias and runs clicked commands', async () => {
renderChat();
await waitFor(() => {
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
index c5696754ee..6fce55152a 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
@@ -7,6 +7,8 @@ import {
describe('assistantSlashCommands', () => {
it('maps OpenCode-style session commands to local Assistant actions', () => {
+ expect(parseAssistantSlashCommand('/help')).toBe('help');
+ expect(parseAssistantSlashCommand('/commands')).toBe('help');
expect(parseAssistantSlashCommand('/new')).toBe('new');
expect(parseAssistantSlashCommand('/clear')).toBe('new');
expect(parseAssistantSlashCommand('/sessions')).toBe('sessions');
@@ -38,6 +40,7 @@ describe('assistantSlashCommands', () => {
it('filters commands by canonical name, alias, and description', () => {
expect(filterAssistantSlashCommands('').map((command) => command.name)).toEqual([
+ 'help',
'new',
'sessions',
'models',
@@ -57,9 +60,14 @@ describe('assistantSlashCommands', () => {
expect(filterAssistantSlashCommands('runtime').map((command) => command.name)).toEqual([
'status',
]);
+ expect(filterAssistantSlashCommands('commands').map((command) => command.name)).toEqual([
+ 'help',
+ ]);
});
it('exposes canonical and alias tokens for the picker', () => {
+ const help = filterAssistantSlashCommands('commands')[0];
+ expect(getAssistantSlashCommandTokens(help)).toEqual(['help', 'commands']);
const sessions = filterAssistantSlashCommands('resume')[0];
expect(getAssistantSlashCommandTokens(sessions)).toEqual(['sessions', 'resume', 'continue']);
const models = filterAssistantSlashCommands('mo')[0];
diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
index 1d757a5672..0d6cf7a5e9 100644
--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
@@ -2,6 +2,7 @@ export type AssistantSlashCommandAction =
| 'copy'
| 'export'
| 'fork'
+ | 'help'
| 'models'
| 'new'
| 'redo'
@@ -17,6 +18,12 @@ export interface AssistantSlashCommand {
}
export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [
+ {
+ name: 'help',
+ aliases: ['commands'],
+ action: 'help',
+ description: 'Show Assistant commands',
+ },
{
name: 'new',
aliases: ['clear'],
@@ -75,9 +82,7 @@ const commandByToken = new Map<string, AssistantSlashCommandAction>(
]),
);
-export const parseAssistantSlashCommand = (
- input: string,
-): AssistantSlashCommandAction | null => {
+export const parseAssistantSlashCommand = (input: string): AssistantSlashCommandAction | null => {
const trimmed = input.trim();
if (!trimmed.startsWith('/')) return null;
@@ -117,9 +122,7 @@ export const filterAssistantSlashCommands = (
limit = ASSISTANT_SLASH_COMMANDS.length,
): AssistantSlashCommand[] => {
const normalizedQuery = normalizeSlashQuery(query);
- return ASSISTANT_SLASH_COMMANDS.filter((command) =>
- commandMatchesQuery(command, normalizedQuery),
- )
+ return ASSISTANT_SLASH_COMMANDS.filter((command) => commandMatchesQuery(command, normalizedQuery))
.map((command, index) => ({ command, index }))
.sort((left, right) => {
const scoreDelta =
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index a2bab4cf96..208d36b469 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -141,6 +141,7 @@ import {
type SendMessageOptions,
} from './hooks/useChat';
import { ChatMessages } from './ChatMessages';
+import { AssistantCommandHelpDialog } from './AssistantCommandHelpDialog';
import { ModelSelector } from './ModelSelector';
import { MentionAutocomplete, type MentionResource } from './MentionAutocomplete';
import { SlashCommandAutocomplete } from './SlashCommandAutocomplete';
@@ -617,6 +618,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
const [savedPromptDraft, setSavedPromptDraft] = createSignal<PromptHistoryEntry | null>(null);
const [sessions, setSessions] = createSignal<ChatSession[]>([]);
const [showSessions, setShowSessions] = createSignal(false);
+ const [showCommandHelp, setShowCommandHelp] = createSignal(false);
const [sessionRefreshLoading, setSessionRefreshLoading] = createSignal(false);
const [sessionSearchQuery, setSessionSearchQuery] = createSignal('');
const [sessionSearchResults, setSessionSearchResults] = createSignal<ChatSession[] | null>(null);
@@ -1949,6 +1951,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
createEffect(() => {
if (!isOpen()) {
+ setShowCommandHelp(false);
return;
}
void initializeWhenOpen();
@@ -2415,33 +2418,48 @@ export const AIChat: Component<AIChatProps> = (props) => {
switch (command) {
case 'new':
+ setShowCommandHelp(false);
void handleNewConversation();
break;
case 'sessions':
+ setShowCommandHelp(false);
void handleToggleSessions();
break;
+ case 'help':
+ setShowSessions(false);
+ setSessionRefreshLoading(false);
+ resetSessionSearch();
+ setShowCommandHelp(true);
+ break;
case 'models':
setShowSessions(false);
+ setShowCommandHelp(false);
setSessionRefreshLoading(false);
resetSessionSearch();
setModelSelectorOpenRequest((value) => value + 1);
break;
case 'status':
+ setShowCommandHelp(false);
runSelectedProviderStatusCheck();
break;
case 'copy':
+ setShowCommandHelp(false);
void copyAssistantTranscript();
break;
case 'export':
+ setShowCommandHelp(false);
exportAssistantTranscript();
break;
case 'fork':
+ setShowCommandHelp(false);
void handleForkSession();
break;
case 'undo':
+ setShowCommandHelp(false);
void handleUndoLastTurn();
break;
case 'redo':
+ setShowCommandHelp(false);
void handleRedoLastTurn();
break;
}
@@ -2638,6 +2656,11 @@ export const AIChat: Component<AIChatProps> = (props) => {
executeSlashCommand(command.action);
};
+ const handleCommandHelpRun = (command: AssistantSlashCommand) => {
+ setShowCommandHelp(false);
+ queueMicrotask(() => executeSlashCommand(command.action));
+ };
+
// Handle mention selection
const handleMentionSelect = (resource: MentionResource) => {
const currentInput = input();
@@ -3115,6 +3138,12 @@ export const AIChat: Component<AIChatProps> = (props) => {
</svg>
</button>
</Show>
+ <Show when={showCommandHelp()}>
+ <AssistantCommandHelpDialog
+ onClose={() => setShowCommandHelp(false)}
+ onRunCommand={handleCommandHelpRun}
+ />
+ </Show>
{/* Header - wraps on mobile */}
<div class="flex flex-wrap items-center gap-2 px-4 py-3 border-b border-border bg-surface-alt">
<h2 class="min-w-0 flex-1 text-sm font-semibold text-base-content">
diff --git a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
index b201f727a3..396cba27d3 100644
--- a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
@@ -83,6 +83,7 @@ describe('CommandPaletteModal', () => {
expect(commandPaletteModelSource).toContain("id: 'nav-vmware'");
expect(commandPaletteModelSource).toContain("id: 'nav-vmware-networks'");
expect(commandPaletteModelSource).toContain("id: 'assistant-open'");
+ expect(commandPaletteModelSource).toContain("id: 'assistant-help'");
expect(commandPaletteModelSource).toContain("id: 'assistant-switch-session'");
expect(commandPaletteModelSource).toContain("id: 'assistant-switch-model'");
expect(commandPaletteModelSource).toContain("id: 'assistant-status'");
@@ -104,6 +105,7 @@ describe('CommandPaletteModal', () => {
));
expect(screen.getByText('Open Pulse Assistant')).toBeInTheDocument();
+ expect(screen.getByText('Show Assistant commands')).toBeInTheDocument();
expect(screen.getByText('New Assistant session')).toBeInTheDocument();
expect(screen.getByText('Switch Assistant session')).toBeInTheDocument();
expect(screen.getByText('Switch Assistant model')).toBeInTheDocument();
@@ -152,6 +154,25 @@ describe('CommandPaletteModal', () => {
});
});
+ it('routes Assistant help workflow commands through the Assistant store', async () => {
+ const onClose = vi.fn();
+ const requestCommand = vi.spyOn(aiChatStore, 'requestCommand').mockImplementation(() => {});
+ render(() => (
+ <CommandPaletteModal
+ isOpen={true}
+ onClose={onClose}
+ platformVisibility={platformVisibility}
+ />
+ ));
+
+ await fireEvent.click(screen.getByText('Show Assistant commands'));
+
+ expect(onClose).toHaveBeenCalledTimes(1);
+ await waitFor(() => {
+ expect(requestCommand).toHaveBeenCalledWith('help');
+ });
+ });
+
it('routes Assistant status workflow commands through the Assistant store', async () => {
const onClose = vi.fn();
const requestCommand = vi.spyOn(aiChatStore, 'requestCommand').mockImplementation(() => {});
diff --git a/frontend-modern/src/components/shared/commandPaletteModel.ts b/frontend-modern/src/components/shared/commandPaletteModel.ts
index 8eedcc1114..16eef9fc09 100644
--- a/frontend-modern/src/components/shared/commandPaletteModel.ts
+++ b/frontend-modern/src/components/shared/commandPaletteModel.ts
@@ -31,6 +31,7 @@ export type CommandPaletteCommandPaths = {
export type CommandPaletteAssistantActions = {
open: () => void;
+ help: () => void;
newSession: () => void;
sessions: () => void;
models: () => void;
@@ -56,6 +57,13 @@ export function buildCommandPaletteCommands(options: {
keywords: ['assistant', 'ai', 'chat', 'ask', 'pulse'],
action: options.assistantActions.open,
},
+ {
+ id: 'assistant-help',
+ label: 'Show Assistant commands',
+ description: '/help',
+ keywords: ['assistant', 'help', 'commands', 'slash', 'palette'],
+ action: options.assistantActions.help,
+ },
{
id: 'assistant-new-session',
label: 'New Assistant session',
@@ -81,7 +89,15 @@ export function buildCommandPaletteCommands(options: {
id: 'assistant-status',
label: 'Check Assistant status',
description: '/status',
- keywords: ['assistant', 'status', 'runtime', 'health', 'provider', 'openrouter', 'deepseek'],
+ keywords: [
+ 'assistant',
+ 'status',
+ 'runtime',
+ 'health',
+ 'provider',
+ 'openrouter',
+ 'deepseek',
+ ],
action: options.assistantActions.status,
},
{
diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.ts
index 02f0586d56..011f71a7bb 100644
--- a/frontend-modern/src/components/shared/useCommandPaletteState.ts
+++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts
@@ -47,6 +47,7 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {
navigate,
assistantActions: {
open: () => runAfterPaletteSelection(() => aiChatStore.open()),
+ help: () => requestAssistantCommand('help'),
newSession: () => requestAssistantCommand('new'),
sessions: () => requestAssistantCommand('sessions'),
models: () => requestAssistantCommand('models'),
diff --git a/frontend-modern/src/stores/__tests__/aiChat.test.ts b/frontend-modern/src/stores/__tests__/aiChat.test.ts
index 33ec57c036..ea6839b612 100644
--- a/frontend-modern/src/stores/__tests__/aiChat.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiChat.test.ts
@@ -56,6 +56,9 @@ describe('aiChatStore', () => {
aiChatStore.requestCommand('status');
expect(aiChatStore.commandRequest).toMatchObject({ action: 'status' });
+
+ aiChatStore.requestCommand('help');
+ expect(aiChatStore.commandRequest).toMatchObject({ action: 'help' });
});
it('sets legacy context and clears it', () => {
diff --git a/frontend-modern/src/stores/aiChat.ts b/frontend-modern/src/stores/aiChat.ts
index 11eaaad286..f16f1c7aad 100644
--- a/frontend-modern/src/stores/aiChat.ts
+++ b/frontend-modern/src/stores/aiChat.ts
@@ -79,6 +79,7 @@ export interface AIChatContext {
}
export type AIChatCommandRequestAction =
+ | 'help'
| 'new'
| 'sessions'
| 'models'
diff --git a/frontend-modern/src/utils/aiChatPresentation.ts b/frontend-modern/src/utils/aiChatPresentation.ts
index d9aa07ebf9..cb350db2ea 100644
--- a/frontend-modern/src/utils/aiChatPresentation.ts
+++ b/frontend-modern/src/utils/aiChatPresentation.ts
@@ -45,6 +45,8 @@ export const AI_CHAT_DISCOVERY_HINT_DISMISS_LABEL = 'Dismiss discovery context w
export const AI_CHAT_CONTROL_MODE_LABEL = 'Assistant control mode';
export const AI_CHAT_CONTROL_MODE_MENU_LABEL = 'Assistant control mode options';
export const AI_CHAT_SWITCH_TO_APPROVAL_LABEL = 'Switch Assistant control mode to Approval';
+export const AI_CHAT_COMMAND_HELP_TITLE = 'Assistant commands';
+export const AI_CHAT_COMMAND_HELP_CLOSE_LABEL = 'Close Assistant commands';
export const AI_CHAT_SESSION_EMPTY_STATE = 'No previous assistant sessions';
export const AI_CHAT_SESSION_LOADING_STATE = 'Loading assistant sessions...';
export const AI_CHAT_SESSION_SEARCH_PLACEHOLDER = 'Search sessions...';