From 49ebf6f8ba0ea55ea7987f40ecdd32738241a3f2 Mon Sep 17 00:00:00 2001 From: centdix <40307056+centdix@users.noreply.github.com> Date: Tue, 19 May 2026 00:35:08 +0200 Subject: [PATCH] feat: add global chat selected context (#9216) * feat: add global chat selected context * refactor: store workspace context as references * fix: refresh db context after global mode --- .../copilot/chat/AIChatInput.svelte | 8 +- .../copilot/chat/AIChatManager.svelte.ts | 11 ++- .../copilot/chat/AvailableContextList.svelte | 81 +++++++------------ .../copilot/chat/ContextManager.svelte.ts | 23 +++++- .../copilot/chat/ContextManager.test.ts | 79 ++++++++++++++++++ .../lib/components/copilot/chat/context.ts | 13 ++- .../copilot/chat/global/core.test.ts | 34 +++++++- .../components/copilot/chat/global/core.ts | 23 +++++- .../components/copilot/chat/shared.test.ts | 29 +++++++ .../src/lib/components/copilot/chat/shared.ts | 18 ++--- 10 files changed, 236 insertions(+), 83 deletions(-) create mode 100644 frontend/src/lib/components/copilot/chat/ContextManager.test.ts diff --git a/frontend/src/lib/components/copilot/chat/AIChatInput.svelte b/frontend/src/lib/components/copilot/chat/AIChatInput.svelte index 833649e9b6..f0fc826243 100644 --- a/frontend/src/lib/components/copilot/chat/AIChatInput.svelte +++ b/frontend/src/lib/components/copilot/chat/AIChatInput.svelte @@ -90,7 +90,11 @@ let appTooltipCurrentViewNumber = $state(0) export function focusInput() { - if (aiChatManager.mode === AIMode.SCRIPT || aiChatManager.mode === AIMode.FLOW) { + if ( + aiChatManager.mode === AIMode.SCRIPT || + aiChatManager.mode === AIMode.FLOW || + aiChatManager.mode === AIMode.GLOBAL + ) { contextTextareaComponent?.focus() } else { instructionsTextareaComponent?.focus() @@ -390,7 +394,7 @@