Skip to content

Commit f3bf66d

Browse files
committed
Add configuration option to include system messages in context items
1 parent abc1610 commit f3bf66d

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@
109109
"type": "boolean",
110110
"description": "Provide Schema definition as additional context in Continue and Copilot",
111111
"default": true
112+
},
113+
"vscode-db2i.ai.useSystemMessage": {
114+
"type": "boolean",
115+
"description": "Include system messages in Continue Context Items",
116+
"default": true
112117
}
113118
}
114119
},

src/aiProviders/continue/continueContextProvider.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ export class db2ContextProvider implements IContextProvider {
159159
});
160160
}
161161

162-
const newContextItems = await getContextItems(fullInput, {
163-
withDb2Prompt: true,
164-
})
162+
const newContextItems = await getContextItems(fullInput)
165163

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

src/aiProviders/copilot/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export function activateChat(context: vscode.ExtensionContext) {
7373
});
7474
}
7575

76+
// always include system message in Copilot
7677
const contextItems = await getContextItems(request.prompt, {
7778
progress: stream.progress,
7879
withDb2Prompt: true

src/aiProviders/prompt.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export async function getContextItems(input: string, options: PromptOptions = {}
3737
if (currentJob) {
3838
const currentSchema = currentJob?.job.options.libraries[0] || "QGPL";
3939
const useSchemaDef: boolean = Configuration.get<boolean>(`ai.useSchemaDefinition`);
40+
const useSystemMessage: boolean = Configuration.get<boolean>(`ai.useSystemMessage`);
4041

4142
// TODO: self?
4243

@@ -116,7 +117,8 @@ export async function getContextItems(input: string, options: PromptOptions = {}
116117
}
117118
}
118119

119-
if (options.withDb2Prompt) {
120+
// check if option is defined first via API, then check user settings
121+
if (options.withDb2Prompt !== undefined ? options.withDb2Prompt : useSystemMessage) {
120122
contextItems.push({
121123
name: `system prompt`,
122124
content: DB2_SYSTEM_PROMPT,

src/contributes.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
"type": "boolean",
6767
"description": "Provide Schema definition as additional context in Continue and Copilot",
6868
"default": true
69+
},
70+
"vscode-db2i.ai.useSystemMessage": {
71+
"type": "boolean",
72+
"description": "Include system messages in Continue Context Items",
73+
"default": true
74+
6975
}
7076
}
7177
}

0 commit comments

Comments
 (0)