fix(ai-chat): resolve the chat manager at init so sending in a session works

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hw1yzWHyqqZmQrviUEhr5b
This commit is contained in:
Guilhem Lemouel
2026-09-08 09:31:10 +02:00
co-authored by Claude Opus 5
parent d993013dc0
commit 7677af52a4
@@ -55,6 +55,9 @@
} from '$lib/components/common/image/ExpandableImage.svelte'
const chatHost = getChatViewHost()
// Resolved here, not where it is used: getContext is only legal during component
// initialisation, and the mention consumer below runs inside the send gesture.
const chatManager = getAiChatManager()
interface Props {
availableContext: ContextElement[]
@@ -758,7 +761,7 @@
if (chatHost.mode !== AIMode.GLOBAL) return
// The mention context belongs to the copilot's own ContextManager, which only
// the manager has — the GLOBAL guard above means this host is always it.
getAiChatManager().contextManager?.consumeMentionContext()
chatManager.contextManager?.consumeMentionContext()
}
function sendRequest() {