Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configurable initial instructions for the LLM #116

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion extensions/void/src/sidebar/SidebarChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ export const SidebarChat = () => {
const relevantFiles = await awaitVSCodeResponse('files')

// add message to chat history
const userContent = userInstructionsStr(instructions, relevantFiles.files, selection)
let userContent = userInstructionsStr(instructions, relevantFiles.files, selection)

// check if the intial instructions have been send to the LLM
if (voidConfig.default.initialLLMInstuctions && !currentThread?.messages.some((message) => message.content.includes(voidConfig.default.initialLLMInstuctions))) {
userContent = voidConfig.default.initialLLMInstuctions + '\n\n' + userContent;
}

// console.log('prompt:\n', content)
const newHistoryElt: ChatMessage = { role: 'user', content: userContent, displayContent: instructions, selection, files }
addMessageToHistory(newHistoryElt)
Expand Down
9 changes: 9 additions & 0 deletions extensions/void/src/sidebar/SidebarSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ export const SidebarSettings = () => {
</div>
})}

<hr />

<div className='outline-vscode-input-bg'>
<SettingOfFieldAndParam
field='default'
param='initialLLMInstuctions'
/>
</div>

{/* Remove this after 10/21/24, this is just to give developers a heads up about the recent change */}
<div className='pt-20'>
{`We recently updated Settings. To copy your old Void settings over, press Ctrl+Shift+P, `}
Expand Down
1 change: 1 addition & 0 deletions extensions/void/src/sidebar/contextForConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const voidConfigInfo: Record<
'anthropic',
configFields,
),
initialLLMInstuctions: configString('Your initial instructions for your LLM.', ''),
},
anthropic: {
apikey: configString('Anthropic API key.', ''),
Expand Down