Skip to content

Commit 71038ed

Browse files
committed
Context items
Signed-off-by: worksofliam <[email protected]>
1 parent 360af3a commit 71038ed

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/aiProviders/copilot/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from "vscode";
22
import {
33
canTalkToDb,
44
} from "../context";
5-
import { buildPrompt, Db2ContextItems } from "../prompt";
5+
import { getContextItems, Db2ContextItems } from "../prompt";
66
import { registerSqlRunTool, RUN_SQL_TOOL_ID } from "./sqlTool";
77

88
const CHAT_ID = `vscode-db2i.chat`;
@@ -82,7 +82,7 @@ export function activateChat(context: vscode.ExtensionContext) {
8282
});
8383
}
8484

85-
const contextItems = await buildPrompt(request.prompt, {
85+
const contextItems = await getContextItems(request.prompt, {
8686
history,
8787
progress: stream.progress
8888
});

src/aiProviders/prompt.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { buildSchemaDefinition, canTalkToDb, getContentItemsForRefs, getSqlConte
77
import { DB2_SYSTEM_PROMPT } from "./prompts";
88

99
export interface PromptOptions {
10+
userInputNotContext?: boolean
1011
history?: Db2ContextItems[];
1112
progress?: (text: string) => void;
1213
}
@@ -24,7 +25,7 @@ export interface BuildResult {
2425
followUps: string[];
2526
}
2627

27-
export async function buildPrompt(input: string, options: PromptOptions = {}): Promise<BuildResult> {
28+
export async function getContextItems(input: string, options: PromptOptions = {}): Promise<BuildResult> {
2829
const currentJob: JobInfo = JobManager.getSelection();
2930

3031
let contextItems: Db2ContextItems[] = [];
@@ -123,12 +124,14 @@ export async function buildPrompt(input: string, options: PromptOptions = {}): P
123124
});
124125
}
125126

126-
contextItems.push({
127-
name: `user prompt`,
128-
content: input,
129-
description: `user prompt`,
130-
type: `user`
131-
});
127+
if (!options.userInputNotContext) {
128+
contextItems.push({
129+
name: `user prompt`,
130+
content: input,
131+
description: `user prompt`,
132+
type: `user`
133+
});
134+
}
132135
}
133136

134137
return {

0 commit comments

Comments
 (0)