From 282757337ca580da4cb3f98220d3f3a32aee952b Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Sat, 11 Jul 2026 00:14:27 +0200 Subject: [PATCH] fix: load copilot config on home so AI chat isn't wrongly gated Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/lib/components/home/HomeAIChat.svelte | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/home/HomeAIChat.svelte b/frontend/src/lib/components/home/HomeAIChat.svelte index 1d95130d7f..9e8bb3c0a6 100644 --- a/frontend/src/lib/components/home/HomeAIChat.svelte +++ b/frontend/src/lib/components/home/HomeAIChat.svelte @@ -4,15 +4,26 @@ import Button from '../common/button/Button.svelte' import ProviderModelSelector from '../copilot/chat/ProviderModelSelector.svelte' import { startSessionWithPrompt } from '../sessions/sessionSwitch.svelte' - import { copilotInfo } from '$lib/aiStore' + import { copilotInfo, copilotWorkspace, loadCopilot } from '$lib/aiStore' + import { workspaceStore } from '$lib/stores' import { base } from '$lib/base' let value = $state('') let placeholder = $state('') + // In global-AI mode the layout's chat panel is disabled and never loads the copilot + // config, so the home chat loads it for the current workspace itself. + $effect(() => { + if ($workspaceStore) { + loadCopilot($workspaceStore) + } + }) + // No usable model (no provider configured, or AI disabled): the chat is shown but // non-interactive, and hovering reveals a prompt to configure AI in the settings. - let disabled = $derived(!$copilotInfo.enabled) + // Gate on the config having actually loaded for this workspace so the initial + // (unloaded) state doesn't flash the overlay while a provider is configured. + let disabled = $derived($copilotWorkspace === $workspaceStore && !$copilotInfo.enabled) let starting = $state(false) async function start() {