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.

Expose Discovery model override in AI settings

rcourtmand20671a73682
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 8fe00cb7a7..afcc56390e 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -918,8 +918,12 @@ AI runtime.
labeled as Pulse Assistant controls, while Patrol schedule and autonomy
continue to live on Patrol-owned surfaces rather than drifting back into
the shared settings shell. Shared/default model choices may remain on the
- combined shell only when Assistant and Patrol overrides are presented as
- explicit per-surface overrides instead of a generic advanced AI bucket.
+ combined shell only when Assistant, Patrol, and Discovery overrides are
+ presented as explicit per-surface overrides instead of a generic advanced
+ AI bucket. Each per-surface override must fall back to the shared default
+ when left empty rather than silently using a hard-coded backend default,
+ so the shared shell stays the single place an operator picks the model
+ for any of the three surfaces.
The shared shell must not show Pro-only autonomous execution as a default
free-user control when upgrade prompts are suppressed; it may surface that
option only when the entitlement is present, commercial prompts are
diff --git a/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx b/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx
index 6761970858..54af358bb5 100644
--- a/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx
+++ b/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx
@@ -171,6 +171,7 @@ export const AIModelSelectionSection: Component<AIModelSelectionSectionProps> =
const sharedModelOptions = () => selectableModels(state.form.model);
const chatModelOptions = () => selectableModels(state.form.chatModel);
const patrolModelOptions = () => selectableModels(state.form.patrolModel);
+ const discoveryModelOptions = () => selectableModels(state.form.discoveryModel);
const pickerButtonClass = () =>
`${controlClass()} flex items-center gap-2 justify-between text-left disabled:cursor-not-allowed disabled:opacity-60`;
const pickerLabelClass = 'min-w-0 flex-1 truncate text-left font-normal';
@@ -284,7 +285,8 @@ export const AIModelSelectionSection: Component<AIModelSelectionSectionProps> =
</p>
</Show>
<p class="text-[11px] text-muted mt-1">
- Used by both Pulse Assistant and Patrol unless you set a section-specific override below.
+ Used by Pulse Assistant, Patrol, and Discovery unless you set a section-specific override
+ below.
</p>
</div>
@@ -311,7 +313,7 @@ export const AIModelSelectionSection: Component<AIModelSelectionSectionProps> =
<span class="text-sm font-medium text-base-content">
{AI_SETTINGS_MODEL_OVERRIDES_TITLE}
</span>
- <Show when={state.form.chatModel || state.form.patrolModel}>
+ <Show when={state.form.chatModel || state.form.patrolModel || state.form.discoveryModel}>
<span class="px-1.5 py-0.5 text-[10px] font-semibold bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">
Customized
</span>
@@ -334,8 +336,8 @@ export const AIModelSelectionSection: Component<AIModelSelectionSectionProps> =
<Show when={state.showAdvancedModels()}>
<div class="px-3 py-3 bg-surface border-t border-border space-y-3">
<p class="text-xs text-muted">
- Override the shared default for Pulse Assistant or Patrol. Leave empty to use the
- shared default model.
+ Override the shared default for Pulse Assistant, Patrol, or Discovery. Leave empty to
+ use the shared default model.
</p>
<div>
<label class="block text-xs font-medium text-muted mb-0.5">
@@ -421,6 +423,48 @@ export const AIModelSelectionSection: Component<AIModelSelectionSectionProps> =
</Show>
<PatrolPreflightControl state={state} />
</div>
+ <div>
+ <label class="block text-xs font-medium text-muted mb-0.5">
+ Discovery Model
+ </label>
+ <p class="text-[11px] text-muted mb-1">
+ Used for one-shot service identification on a single resource — a cheaper model
+ like Haiku is usually sufficient.
+ </p>
+ <Show
+ when={discoveryModelOptions().length > 0}
+ fallback={
+ <input
+ type="text"
+ value={state.form.discoveryModel}
+ onInput={(e) => state.setForm('discoveryModel', e.currentTarget.value)}
+ placeholder="Use shared default model"
+ aria-label="Discovery model identifier"
+ class={controlClass()}
+ disabled={state.saving()}
+ />
+ }
+ >
+ <AIModelPicker
+ models={discoveryModelOptions()}
+ selectedModel={state.form.discoveryModel}
+ onModelSelect={(modelId) => state.setForm('discoveryModel', modelId)}
+ defaultOption={{
+ label: 'Use shared default',
+ description: sharedDefaultDescription(),
+ }}
+ emptySelectionLabel="Use shared default"
+ title="Select Discovery model"
+ searchPlaceholder="Search configured provider models"
+ customModelDescription="Custom provider:model ID"
+ disabled={state.saving()}
+ align="left"
+ buttonClass={pickerButtonClass()}
+ buttonLabelClass={pickerLabelClass}
+ dropdownClass={pickerDropdownClass}
+ />
+ </Show>
+ </div>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 6eae35aa69..fab395003d 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -482,6 +482,15 @@ describe('settings architecture guardrails', () => {
expect(aiModelSelectionSectionSource).not.toContain('<select');
expect(aiModelSelectionSectionSource).not.toContain('<optgroup');
+ expect(aiModelSelectionSectionSource).toContain('Pulse Assistant Model');
+ expect(aiModelSelectionSectionSource).toContain('Patrol Verification Model');
+ expect(aiModelSelectionSectionSource).toContain('Discovery Model');
+ expect(aiModelSelectionSectionSource).toContain('chatModelOptions');
+ expect(aiModelSelectionSectionSource).toContain('patrolModelOptions');
+ expect(aiModelSelectionSectionSource).toContain('discoveryModelOptions');
+ expect(aiSettingsStateSource).toContain('discoveryModel:');
+ expect(aiSettingsStateSource).toContain('payload.discovery_model = form.discoveryModel');
+
expect(aiSettingsModelSource).toContain('AIProviderTestResult');
expect(aiSettingsModelSource).toContain('AISettings as AISettingsType');
expect(aiSettingsModelSource).toContain('export type AIAvailableModel = ModelInfo;');
diff --git a/frontend-modern/src/components/Settings/useAISettingsState.ts b/frontend-modern/src/components/Settings/useAISettingsState.ts
index 4b0f8dfb23..59d257568b 100644
--- a/frontend-modern/src/components/Settings/useAISettingsState.ts
+++ b/frontend-modern/src/components/Settings/useAISettingsState.ts
@@ -290,6 +290,7 @@ export const useAISettingsState = () => {
model: '',
chatModel: '',
patrolModel: '',
+ discoveryModel: '',
autoFixModel: '',
authMethod: 'api_key' as AuthMethod,
patrolIntervalMinutes: 360,
@@ -363,6 +364,7 @@ export const useAISettingsState = () => {
model: '',
chatModel: '',
patrolModel: '',
+ discoveryModel: '',
autoFixModel: '',
authMethod: 'api_key',
patrolIntervalMinutes: 360,
@@ -390,6 +392,7 @@ export const useAISettingsState = () => {
model: data.model || '',
chatModel: data.chat_model || '',
patrolModel: data.patrol_model || '',
+ discoveryModel: data.discovery_model || '',
autoFixModel: data.auto_fix_model || '',
authMethod: data.auth_method || 'api_key',
patrolIntervalMinutes: data.patrol_interval_minutes ?? 360,
@@ -718,7 +721,7 @@ export const useAISettingsState = () => {
error,
payload,
providerHealth,
- models: [form.model, form.chatModel, form.patrolModel, form.autoFixModel],
+ models: [form.model, form.chatModel, form.patrolModel, form.discoveryModel, form.autoFixModel],
});
notificationStore.error(
getAISettingsSaveProviderFailureMessage(
@@ -867,6 +870,9 @@ export const useAISettingsState = () => {
if (form.patrolModel !== (settings()?.patrol_model || '')) {
payload.patrol_model = form.patrolModel;
}
+ if (form.discoveryModel !== (settings()?.discovery_model || '')) {
+ payload.discovery_model = form.discoveryModel;
+ }
if (form.autoFixModel !== (settings()?.auto_fix_model || '')) {
payload.auto_fix_model = form.autoFixModel;
}
@@ -948,7 +954,7 @@ export const useAISettingsState = () => {
error,
payload,
providerHealth,
- models: [selectedModel, form.chatModel, form.patrolModel, form.autoFixModel],
+ models: [selectedModel, form.chatModel, form.patrolModel, form.discoveryModel, form.autoFixModel],
});
notificationStore.error(
getAISettingsSaveProviderFailureMessage(
diff --git a/frontend-modern/src/types/ai.ts b/frontend-modern/src/types/ai.ts
index 711d66e267..89b0c27309 100644
--- a/frontend-modern/src/types/ai.ts
+++ b/frontend-modern/src/types/ai.ts
@@ -36,6 +36,7 @@ export interface AISettings {
model: string;
chat_model?: string; // Model for interactive chat (empty = use default)
patrol_model?: string; // Model for background patrol (empty = use default)
+ discovery_model?: string; // Model for infrastructure discovery (empty = use default)
auto_fix_model?: string; // Model for safe remediation workflows (empty = use patrol model)
configured: boolean; // true if AI is ready to use
custom_context: string; // user-provided infrastructure context
@@ -106,6 +107,7 @@ export interface AISettingsUpdateRequest {
// Model overrides for different use cases
chat_model?: string; // Model for interactive chat
patrol_model?: string; // Model for background patrol
+ discovery_model?: string; // Model for infrastructure discovery
auto_fix_model?: string; // Model for safe remediation workflows
// Patrol settings for token efficiency
patrol_interval_minutes?: number; // Custom interval in minutes (0 = disabled, minimum 10)
diff --git a/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts
index c7c8259f13..edc9a89330 100644
--- a/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts
@@ -32,7 +32,7 @@ describe('aiSettingsPresentation', () => {
expect(AI_SETTINGS_PANEL_DESCRIPTION).toBe(
'Configure providers and models for Pulse Assistant and Patrol.',
);
- expect(AI_SETTINGS_MODEL_OVERRIDES_TITLE).toBe('Assistant & Patrol Model Overrides');
+ expect(AI_SETTINGS_MODEL_OVERRIDES_TITLE).toBe('Model Overrides');
expect(AI_SETTINGS_ASSISTANT_SESSIONS_TITLE).toBe('Pulse Assistant Sessions');
expect(AI_SETTINGS_ASSISTANT_PERMISSIONS_TITLE).toBe('Pulse Assistant Permissions');
expect(getAISettingsWorkloadDiscoveryHelpContent()).toEqual({
diff --git a/frontend-modern/src/utils/aiSettingsPresentation.ts b/frontend-modern/src/utils/aiSettingsPresentation.ts
index f8d64b141e..210463b850 100644
--- a/frontend-modern/src/utils/aiSettingsPresentation.ts
+++ b/frontend-modern/src/utils/aiSettingsPresentation.ts
@@ -20,7 +20,7 @@ const AI_OAUTH_ERROR_MESSAGES: Record<string, string> = {
export const AI_SETTINGS_PANEL_TITLE = 'Assistant & Patrol';
export const AI_SETTINGS_PANEL_DESCRIPTION =
'Configure providers and models for Pulse Assistant and Patrol.';
-export const AI_SETTINGS_MODEL_OVERRIDES_TITLE = 'Assistant & Patrol Model Overrides';
+export const AI_SETTINGS_MODEL_OVERRIDES_TITLE = 'Model Overrides';
export const AI_SETTINGS_ASSISTANT_SESSIONS_TITLE = 'Pulse Assistant Sessions';
export const AI_SETTINGS_ASSISTANT_PERMISSIONS_TITLE = 'Pulse Assistant Permissions';
export const AI_SETTINGS_LOAD_MODELS_ERROR = 'Unable to load models.';