diff --git a/admin/inertia/pages/easy-setup/index.tsx b/admin/inertia/pages/easy-setup/index.tsx index 2036faf..f310db8 100644 --- a/admin/inertia/pages/easy-setup/index.tsx +++ b/admin/inertia/pages/easy-setup/index.tsx @@ -122,6 +122,13 @@ export default function EasySetupWizard(props: { const [selectedServices, setSelectedServices] = useState([]) const [selectedMapCollections, setSelectedMapCollections] = useState([]) const [selectedAiModels, setSelectedAiModels] = useState([]) + // Auto-index policy for the AI Assistant Knowledge Base. Defaults to + // 'Always' so a new user who keeps the default behavior gets the "just + // works" experience — downloads become searchable automatically. Persisted + // to KVStore['rag.defaultIngestPolicy'] on wizard submit (same key #894's + // KB modal toggle reads/writes) so the JIT prompt at first chat sees a + // decided policy and doesn't ask again. + const [ingestPolicy, setIngestPolicy] = useState<'Always' | 'Manual'>('Always') const [isProcessing, setIsProcessing] = useState(false) const [showAdditionalTools, setShowAdditionalTools] = useState(false) const [remoteOllamaEnabled, setRemoteOllamaEnabled] = useState( @@ -338,6 +345,23 @@ export default function EasySetupWizard(props: { setIsProcessing(true) try { + // Persist the auto-index policy choice before kicking off downloads so + // any content that finishes during this same wizard run sees the right + // policy. Skipped when the user did not select the AI capability — the + // KV stays null and the first-chat JIT prompt (#899) handles the + // decision later if/when the user enables AI. + const aiSelected = + selectedServices.includes(SERVICE_NAMES.OLLAMA) || + installedServices.some((s) => s.service_name === SERVICE_NAMES.OLLAMA) + if (aiSelected) { + try { + await api.updateSetting('rag.defaultIngestPolicy', ingestPolicy) + } catch (err) { + // Non-fatal: the user can still set the policy from the KB modal. + console.warn('Could not persist ingest policy from wizard:', err) + } + } + // If using remote Ollama, configure it first before other installs if (remoteOllamaEnabled && remoteOllamaUrl) { const remoteResult = await api.configureRemoteOllama(remoteOllamaUrl) @@ -921,6 +945,47 @@ export default function EasySetupWizard(props: {

No recommended AI models available at this time.

)} + + {/* Auto-index policy — choose now so the JIT prompt at first chat + doesn't ask again (RFC #883 Phase 3 task 13). Persisted to + rag.defaultIngestPolicy on wizard submit. */} +
+

+ Auto-index new content for {aiAssistantName}? +

+

+ When you add new ZIMs, documents, or curated content, should {aiAssistantName} index them automatically so it can search them while answering your questions? +

+
+ + +
+

+ You can change this any time from the Knowledge Base panel inside AI Chat. +

+
)} @@ -1157,6 +1222,25 @@ export default function EasySetupWizard(props: { )} + {(selectedAiModels.length > 0 || remoteOllamaEnabled) && ( +
+

+ Auto-index Setting +

+

+ {ingestPolicy === 'Always' ? ( + <> + New content will be indexed automatically as it arrives so {aiAssistantName} can search it. + + ) : ( + <> + New content will wait for you to opt in from the Knowledge Base panel before {aiAssistantName} indexes it. + + )} +

+
+ )} +