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 provider settings command

rcourtmanf822b38858c3
diff --git a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
index 3418c68dfe..482615b3b0 100644
--- a/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
+++ b/frontend-modern/src/components/AI/Chat/SlashCommandAutocomplete.tsx
@@ -4,6 +4,7 @@ import ClockIcon from 'lucide-solid/icons/clock';
import CopyIcon from 'lucide-solid/icons/copy';
import DownloadIcon from 'lucide-solid/icons/download';
import GitForkIcon from 'lucide-solid/icons/git-fork';
+import KeyRoundIcon from 'lucide-solid/icons/key-round';
import PlusIcon from 'lucide-solid/icons/plus';
import Redo2Icon from 'lucide-solid/icons/redo-2';
import SettingsIcon from 'lucide-solid/icons/settings';
@@ -33,6 +34,8 @@ export const AssistantSlashCommandIcon = (props: { action: AssistantSlashCommand
return <ClockIcon class="h-4 w-4" aria-hidden="true" />;
case 'models':
return <SettingsIcon class="h-4 w-4" aria-hidden="true" />;
+ case 'providers':
+ return <KeyRoundIcon class="h-4 w-4" aria-hidden="true" />;
case 'status':
return <ActivityIcon class="h-4 w-4" aria-hidden="true" />;
case 'copy':
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 79270e0814..fab6055c6b 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -17,6 +17,7 @@ const {
mockWebSocketState,
mockChatMessagesProps,
mockModelSelectorProps,
+ mockNavigate,
} = vi.hoisted(() => {
const mockChatMessagesProps: Array<{
messages: ChatMessage[];
@@ -133,7 +134,7 @@ const {
commandRequestSignal: vi.fn(
(): {
id: number;
- action: 'help' | 'new' | 'sessions' | 'models' | 'status' | 'undo' | 'redo';
+ action: 'help' | 'new' | 'sessions' | 'models' | 'providers' | 'status' | 'undo' | 'redo';
} | null => null,
),
ackCommandRequest: vi.fn(),
@@ -203,6 +204,7 @@ const {
const mockWebSocketState = {
resources: [] as Array<{ id: string; type: string }> | undefined,
};
+ const mockNavigate = vi.fn();
return {
mockChat,
@@ -215,11 +217,16 @@ const {
mockWebSocketState,
mockChatMessagesProps,
mockModelSelectorProps,
+ mockNavigate,
};
});
// ── Module mocks ───────────────────────────────────────────────────────────
+vi.mock('@solidjs/router', () => ({
+ useNavigate: () => mockNavigate,
+}));
+
vi.mock('../hooks/useChat', () => ({
useChat: () => mockChat,
}));
@@ -402,6 +409,7 @@ beforeEach(() => {
vi.clearAllMocks();
mockChatMessagesProps.length = 0;
mockModelSelectorProps.length = 0;
+ mockNavigate.mockReset();
resetAIChatComposerDraftStashForTests();
setViewportWidth(1440);
resetAIRuntimeState();
@@ -1658,6 +1666,19 @@ describe('AIChat', () => {
expect(mockChat.sendMessage).not.toHaveBeenCalled();
});
+ it('opens Assistant provider settings from /connect without sending a provider prompt', async () => {
+ const onClose = vi.fn();
+ renderChat(onClose);
+ const textarea = screen.getByPlaceholderText('Ask about your infrastructure...');
+
+ fireEvent.input(textarea, { target: { value: '/connect' } });
+ fireEvent.keyDown(textarea, { key: 'Enter' });
+
+ expect(mockNavigate).toHaveBeenCalledWith('/settings/system-ai');
+ expect(onClose).toHaveBeenCalledTimes(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 6fce55152a..8bf26446fb 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
@@ -17,6 +17,10 @@ describe('assistantSlashCommands', () => {
expect(parseAssistantSlashCommand('/models')).toBe('models');
expect(parseAssistantSlashCommand('/model')).toBe('models');
expect(parseAssistantSlashCommand('/mo')).toBe('models');
+ expect(parseAssistantSlashCommand('/providers')).toBe('providers');
+ expect(parseAssistantSlashCommand('/connect')).toBe('providers');
+ expect(parseAssistantSlashCommand('/settings')).toBe('providers');
+ expect(parseAssistantSlashCommand('/keys')).toBe('providers');
expect(parseAssistantSlashCommand('/status')).toBe('status');
expect(parseAssistantSlashCommand('/runtime')).toBe('status');
expect(parseAssistantSlashCommand('/health')).toBe('status');
@@ -44,6 +48,7 @@ describe('assistantSlashCommands', () => {
'new',
'sessions',
'models',
+ 'providers',
'status',
'copy',
'export',
@@ -55,8 +60,12 @@ describe('assistantSlashCommands', () => {
'sessions',
]);
expect(filterAssistantSlashCommands('provider').map((command) => command.name)).toEqual([
+ 'providers',
'models',
]);
+ expect(filterAssistantSlashCommands('connect').map((command) => command.name)).toEqual([
+ 'providers',
+ ]);
expect(filterAssistantSlashCommands('runtime').map((command) => command.name)).toEqual([
'status',
]);
@@ -72,6 +81,13 @@ describe('assistantSlashCommands', () => {
expect(getAssistantSlashCommandTokens(sessions)).toEqual(['sessions', 'resume', 'continue']);
const models = filterAssistantSlashCommands('mo')[0];
expect(getAssistantSlashCommandTokens(models)).toEqual(['models', 'model', 'mo']);
+ const providers = filterAssistantSlashCommands('connect')[0];
+ expect(getAssistantSlashCommandTokens(providers)).toEqual([
+ 'providers',
+ 'connect',
+ 'settings',
+ 'keys',
+ ]);
const status = filterAssistantSlashCommands('status')[0];
expect(getAssistantSlashCommandTokens(status)).toEqual(['status', 'runtime', 'health']);
});
diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
index 0d6cf7a5e9..a2f5c60797 100644
--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
@@ -5,6 +5,7 @@ export type AssistantSlashCommandAction =
| 'help'
| 'models'
| 'new'
+ | 'providers'
| 'redo'
| 'status'
| 'undo'
@@ -42,6 +43,12 @@ export const ASSISTANT_SLASH_COMMANDS: AssistantSlashCommand[] = [
action: 'models',
description: 'Choose the model and provider route',
},
+ {
+ name: 'providers',
+ aliases: ['connect', 'settings', 'keys'],
+ action: 'providers',
+ description: 'Open Assistant provider settings',
+ },
{
name: 'status',
aliases: ['runtime', 'health'],
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index 208d36b469..a12bbbf60b 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -8,6 +8,7 @@ import {
createMemo,
createEffect,
} from 'solid-js';
+import { useNavigate } from '@solidjs/router';
import { unwrap } from 'solid-js/store';
import SendIcon from 'lucide-solid/icons/send';
import SquareIcon from 'lucide-solid/icons/square';
@@ -602,6 +603,7 @@ const buildSessionHandoffContext = (session?: ChatSession): AIChatContext | unde
* session management, and streaming response display.
*/
export const AIChat: Component<AIChatProps> = (props) => {
+ const navigate = useNavigate();
// UI state - use store's isOpenSignal for reactivity
const isOpen = aiChatStore.isOpenSignal;
const { width } = useBreakpoint();
@@ -1672,6 +1674,15 @@ export const AIChat: Component<AIChatProps> = (props) => {
void refreshSelectedProviderReadiness(provider, model);
};
+ const openAssistantProviderSettings = () => {
+ setShowSessions(false);
+ setShowCommandHelp(false);
+ setSessionRefreshLoading(false);
+ resetSessionSearch();
+ navigate(AI_CHAT_PROVIDER_READINESS_SETTINGS_HREF);
+ props.onClose();
+ };
+
const isOverlayLayout = createMemo(() => width() < AI_CHAT_MIN_DOCKED_VIEWPORT_WIDTH);
const rootClassName = createMemo(() => {
if (isOverlayLayout()) {
@@ -2438,6 +2449,9 @@ export const AIChat: Component<AIChatProps> = (props) => {
resetSessionSearch();
setModelSelectorOpenRequest((value) => value + 1);
break;
+ case 'providers':
+ openAssistantProviderSettings();
+ break;
case 'status':
setShowCommandHelp(false);
runSelectedProviderStatusCheck();
diff --git a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
index 396cba27d3..7da1017484 100644
--- a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
@@ -86,6 +86,7 @@ describe('CommandPaletteModal', () => {
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-provider-settings'");
expect(commandPaletteModelSource).toContain("id: 'assistant-status'");
expect(commandPaletteModelSource).toContain("id: 'assistant-undo-last-turn'");
expect(commandPaletteModelSource).toContain("id: 'assistant-redo-last-turn'");
@@ -109,6 +110,7 @@ describe('CommandPaletteModal', () => {
expect(screen.getByText('New Assistant session')).toBeInTheDocument();
expect(screen.getByText('Switch Assistant session')).toBeInTheDocument();
expect(screen.getByText('Switch Assistant model')).toBeInTheDocument();
+ expect(screen.getByText('Open Assistant provider settings')).toBeInTheDocument();
expect(screen.getByText('Check Assistant status')).toBeInTheDocument();
expect(screen.getByText('Undo last Assistant turn')).toBeInTheDocument();
expect(screen.getByText('Redo last Assistant turn')).toBeInTheDocument();
@@ -192,6 +194,25 @@ describe('CommandPaletteModal', () => {
});
});
+ it('routes Assistant provider settings 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('Open Assistant provider settings'));
+
+ expect(onClose).toHaveBeenCalledTimes(1);
+ await waitFor(() => {
+ expect(requestCommand).toHaveBeenCalledWith('providers');
+ });
+ });
+
it('routes Assistant undo 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 16eef9fc09..80d91d08bb 100644
--- a/frontend-modern/src/components/shared/commandPaletteModel.ts
+++ b/frontend-modern/src/components/shared/commandPaletteModel.ts
@@ -35,6 +35,7 @@ export type CommandPaletteAssistantActions = {
newSession: () => void;
sessions: () => void;
models: () => void;
+ providers: () => void;
status: () => void;
undo: () => void;
redo: () => void;
@@ -85,6 +86,22 @@ export function buildCommandPaletteCommands(options: {
keywords: ['assistant', 'models', 'model', 'provider', 'openrouter', 'deepseek'],
action: options.assistantActions.models,
},
+ {
+ id: 'assistant-provider-settings',
+ label: 'Open Assistant provider settings',
+ description: '/providers',
+ keywords: [
+ 'assistant',
+ 'providers',
+ 'provider',
+ 'connect',
+ 'settings',
+ 'keys',
+ 'openrouter',
+ 'deepseek',
+ ],
+ action: options.assistantActions.providers,
+ },
{
id: 'assistant-status',
label: 'Check Assistant status',
diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.ts
index 011f71a7bb..5f09531246 100644
--- a/frontend-modern/src/components/shared/useCommandPaletteState.ts
+++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts
@@ -51,6 +51,7 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {
newSession: () => requestAssistantCommand('new'),
sessions: () => requestAssistantCommand('sessions'),
models: () => requestAssistantCommand('models'),
+ providers: () => requestAssistantCommand('providers'),
status: () => requestAssistantCommand('status'),
undo: () => requestAssistantCommand('undo'),
redo: () => requestAssistantCommand('redo'),
diff --git a/frontend-modern/src/stores/__tests__/aiChat.test.ts b/frontend-modern/src/stores/__tests__/aiChat.test.ts
index ea6839b612..3701735fa9 100644
--- a/frontend-modern/src/stores/__tests__/aiChat.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiChat.test.ts
@@ -59,6 +59,9 @@ describe('aiChatStore', () => {
aiChatStore.requestCommand('help');
expect(aiChatStore.commandRequest).toMatchObject({ action: 'help' });
+
+ aiChatStore.requestCommand('providers');
+ expect(aiChatStore.commandRequest).toMatchObject({ action: 'providers' });
});
it('sets legacy context and clears it', () => {
diff --git a/frontend-modern/src/stores/aiChat.ts b/frontend-modern/src/stores/aiChat.ts
index f16f1c7aad..60587b32a3 100644
--- a/frontend-modern/src/stores/aiChat.ts
+++ b/frontend-modern/src/stores/aiChat.ts
@@ -83,6 +83,7 @@ export type AIChatCommandRequestAction =
| 'new'
| 'sessions'
| 'models'
+ | 'providers'
| 'status'
| 'undo'
| 'redo';