diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 5532109e2c..d04570cd36 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -122,7 +122,12 @@ updateChatParams, updateChatFolderIdById } from '$lib/apis/chats'; - import { resolveTerminalTarget, setCwd, type FilesystemFile } from '$lib/apis/terminal'; + import { + listTerminalSkills, + resolveTerminalTarget, + setCwd, + type FilesystemFile + } from '$lib/apis/terminal'; import { generateOpenAIChatCompletion, getErrorMessage } from '$lib/apis/openai'; import { processUrl, processWebSearch } from '$lib/apis/retrieval'; import { @@ -1302,6 +1307,19 @@ } } + // Sent skill mentions and the + menu's Skills entry need the terminal's skills before any list opens. + $: { + const terminalId = $selectedTerminalId; + void listTerminalSkills( + resolveTerminalTarget(terminalId, $terminalServers ?? [], localStorage.token, { + chatId: $chatId || null, + modelId: selectedModels[0] ?? null + }) + ).then((items) => { + if (terminalId === $selectedTerminalId) terminalSkills.set(items); + }); + } + const applyFolderTerminal = (folder: any) => { const terminalId = folder?.data?.terminal_id; if (!terminalId) return;