Added ability to change completion prompt key(s)

This commit is contained in:
Nathan Hedge 2024-01-06 15:49:41 -06:00
parent 1c121748f4
commit a36cd2ed80
No known key found for this signature in database
GPG Key ID: 1ADBA36D6E304C5C
2 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"name": "ollama-autocoder", "name": "ollama-autocoder",
"displayName": "Ollama Autocoder", "displayName": "Ollama Autocoder",
"description": "A simple to use Ollama autocompletion engine with options exposed and streaming functionality", "description": "A simple to use Ollama autocompletion engine with options exposed and streaming functionality",
"version": "0.0.4", "version": "0.0.5",
"icon": "icon.png", "icon": "icon.png",
"publisher": "10nates", "publisher": "10nates",
"license": "MIT", "license": "MIT",
@ -75,6 +75,11 @@
"type": "integer", "type": "integer",
"default": 2000, "default": 2000,
"description": "The size of the prompt in characters. NOT tokens, so can be set about 1.5-2x the max tokens of the model (varies)." "description": "The size of the prompt in characters. NOT tokens, so can be set about 1.5-2x the max tokens of the model (varies)."
},
"ollama-autocoder.completion keys": {
"type": "string",
"default": " ",
"description": "Character that the autocompletion item provider appear on. Multiple characters will be treated as different entries. REQUIRES RELOAD"
} }
} }
}, },

View File

@ -10,6 +10,7 @@ let apiSystemMessage: string | undefined;
let numPredict: number; let numPredict: number;
let promptWindowSize: number; let promptWindowSize: number;
let rawInput: boolean | undefined; let rawInput: boolean | undefined;
let completionKeys: string;
function updateVSConfig() { function updateVSConfig() {
VSConfig = vscode.workspace.getConfiguration("ollama-autocoder"); VSConfig = vscode.workspace.getConfiguration("ollama-autocoder");
@ -19,6 +20,7 @@ function updateVSConfig() {
numPredict = VSConfig.get("max tokens predicted") || 500; numPredict = VSConfig.get("max tokens predicted") || 500;
promptWindowSize = VSConfig.get("prompt window size") || 2000; promptWindowSize = VSConfig.get("prompt window size") || 2000;
rawInput = VSConfig.get("raw input"); rawInput = VSConfig.get("raw input");
completionKeys = VSConfig.get("completion keys") || " ";
if (apiSystemMessage == "DEFAULT" || rawInput) apiSystemMessage = undefined; if (apiSystemMessage == "DEFAULT" || rawInput) apiSystemMessage = undefined;
} }
@ -172,7 +174,7 @@ function activate(context: vscode.ExtensionContext) {
return [item]; return [item];
}, },
}, },
" " ...completionKeys.split("")
); );
// Register a command for getting a completion from Ollama through command/keybind // Register a command for getting a completion from Ollama through command/keybind