add useHistoryPrompts config

This commit is contained in:
bobo.yang 2023-05-08 20:21:57 +08:00
parent bbb93a5fda
commit ac4f9d6802
2 changed files with 11 additions and 3 deletions

View File

@ -53,6 +53,12 @@
"description": "token for each prompt",
"when": "DevChat.llmModel == 'OpenAI'"
},
"DevChat.OpenAI.useHistoryPrompt": {
"type": "boolean",
"default": true,
"description": "use history prompts as context",
"when": "DevChat.llmModel == 'OpenAI'"
},
"DevChat.OpenAI.apiKey": {
"type": "string",
"default": "",

View File

@ -70,9 +70,6 @@ class DevChat {
async chat(content: string, options: ChatOptions = {}, onData: (data: string) => void): Promise<ChatResponse> {
let args = ["prompt"];
if (options.parent) {
args.push("-p", options.parent);
}
if (options.reference) {
for (const reference of options.reference) {
args.push("-r", reference);
@ -102,6 +99,11 @@ class DevChat {
const openaiStream = vscode.workspace.getConfiguration('DevChat').get('OpenAI.stream');
const llmModel = vscode.workspace.getConfiguration('DevChat').get('llmModel');
const tokensPerPrompt = vscode.workspace.getConfiguration('DevChat').get('OpenAI.tokensPerPrompt');
const userHistoryPrompts = vscode.workspace.getConfiguration('DevChat').get('OpenAI.useHistoryPrompt');
if (userHistoryPrompts && options.parent) {
args.push("-p", options.parent);
}
const devchatConfig = {
model: openaiModel,