Skip to content

Add configuration option to include system messages in context items #345

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

Open
wants to merge 1 commit 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
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
"type": "boolean",
"description": "Provide Schema definition as additional context in Continue and Copilot",
"default": true
},
"vscode-db2i.ai.useSystemMessage": {
"type": "boolean",
"description": "Include system messages in Continue Context Items",
"default": true
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions src/aiProviders/continue/continueContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ export class db2ContextProvider implements IContextProvider {
});
}

const newContextItems = await getContextItems(fullInput, {
withDb2Prompt: true,
})
const newContextItems = await getContextItems(fullInput)

contextItems.push(...newContextItems.context);

Expand Down
1 change: 1 addition & 0 deletions src/aiProviders/copilot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function activateChat(context: vscode.ExtensionContext) {
});
}

// always include system message in Copilot
const contextItems = await getContextItems(request.prompt, {
progress: stream.progress,
withDb2Prompt: true
Expand Down
4 changes: 3 additions & 1 deletion src/aiProviders/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export async function getContextItems(input: string, options: PromptOptions = {}
if (currentJob) {
const currentSchema = currentJob?.job.options.libraries[0] || "QGPL";
const useSchemaDef: boolean = Configuration.get<boolean>(`ai.useSchemaDefinition`);
const useSystemMessage: boolean = Configuration.get<boolean>(`ai.useSystemMessage`);

// TODO: self?

Expand Down Expand Up @@ -116,7 +117,8 @@ export async function getContextItems(input: string, options: PromptOptions = {}
}
}

if (options.withDb2Prompt) {
// check if option is defined first via API, then check user settings
if (options.withDb2Prompt !== undefined ? options.withDb2Prompt : useSystemMessage) {
contextItems.push({
name: `system prompt`,
content: DB2_SYSTEM_PROMPT,
Expand Down
6 changes: 6 additions & 0 deletions src/contributes.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
"type": "boolean",
"description": "Provide Schema definition as additional context in Continue and Copilot",
"default": true
},
"vscode-db2i.ai.useSystemMessage": {
"type": "boolean",
"description": "Include system messages in Continue Context Items",
"default": true

}
}
}
Expand Down
Loading