From b268316524fb20f611c400926e49ddb79a29177c Mon Sep 17 00:00:00 2001 From: Bradley Axen Date: Thu, 27 Feb 2025 11:22:10 +0100 Subject: [PATCH] feat: Add extra details to prompt for gui (#1387) --- ui/desktop/src/utils/providerUtils.ts | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ui/desktop/src/utils/providerUtils.ts b/ui/desktop/src/utils/providerUtils.ts index fd66b6b1..1c452d22 100644 --- a/ui/desktop/src/utils/providerUtils.ts +++ b/ui/desktop/src/utils/providerUtils.ts @@ -73,11 +73,44 @@ const addAgent = async (provider: string, model: string) => { return response; }; +// Desktop-specific system prompt extension +const desktopPrompt = `You are being accessed through the Goose Desktop application. + +The user is interacting with you through a graphical user interface with the following features: +- A chat interface where messages are displayed in a conversation format +- Support for markdown formatting in your responses +- Support for code blocks with syntax highlighting +- Tool use messages are included in the chat but outputs may need to be expanded + +The user can add extensions for you through the "Settings" page, which is available in the menu +on the top right of the window. There is a section on that page for extensions, and it links to +the registry. + +Some extensions are builtin, such as Developer and Memory, while +3rd party extensions can be browsed at https://block.github.io/goose/v1/extensions/. +`; + export const initializeSystem = async (provider: string, model: string) => { try { console.log('initializing agent with provider', provider, 'model', model); await addAgent(provider.toLowerCase().replace(/ /g, '_'), model); + // Extend the system prompt with desktop-specific information + const response = await fetch(getApiUrl('/agent/prompt'), { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-Secret-Key': getSecretKey(), + }, + body: JSON.stringify({ extension: desktopPrompt }), + }); + + if (!response.ok) { + console.warn(`Failed to extend system prompt: ${response.statusText}`); + } else { + console.log('Extended system prompt with desktop-specific information'); + } + loadAndAddStoredExtensions().catch((error) => { console.error('Failed to load and add stored extension configs:', error); });