more config
This commit is contained in:
parent
534e82ffaf
commit
04f8db150d
8
TODO.md
8
TODO.md
@ -3,4 +3,10 @@
|
|||||||
[] - add fill in middle
|
[] - add fill in middle
|
||||||
[x] - add config option to disable the extension
|
[x] - add config option to disable the extension
|
||||||
[] - add command to test and query connection to server
|
[] - add command to test and query connection to server
|
||||||
[x] - add feedback when waiting response
|
[x] - add feedback when waiting response
|
||||||
|
[] - add a chat window
|
||||||
|
[] - if the model is an instruct-type add the system prompt to the chat
|
||||||
|
[] - add an icon
|
||||||
|
[] - option to backup and restore model settings
|
||||||
|
[] - add a window to quickly modify model configs
|
||||||
|
[] - decorate ai generated text https://github.com/microsoft/vscode-extension-samples/tree/main/decorator-sample
|
11
package.json
11
package.json
@ -155,9 +155,18 @@
|
|||||||
"dumbpilot.llamaTailfree_z": {"type": "number", "default": 0.5},
|
"dumbpilot.llamaTailfree_z": {"type": "number", "default": 0.5},
|
||||||
"dumbpilot.llamaSeed": {"type": "number", "default": -1},
|
"dumbpilot.llamaSeed": {"type": "number", "default": -1},
|
||||||
"dumbpilot.llamaCachePrompt": {
|
"dumbpilot.llamaCachePrompt": {
|
||||||
"type": "bool",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
"description": "Enable prompt caching for faster results"
|
"description": "Enable prompt caching for faster results"
|
||||||
|
},
|
||||||
|
"dumbpilot.llamaInstructModel": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false",
|
||||||
|
"description": "For use with instruct models"
|
||||||
|
},
|
||||||
|
"dumbpilot.llamaSystemPrompt": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The system prompt that the model considers at the beginning of every request, used by instruct models"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,17 +111,13 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
config = vscode.workspace.getConfiguration("dumbpilot");
|
config = vscode.workspace.getConfiguration("dumbpilot");
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let completion_enabled: boolean = config.get("completionEnabled") as boolean;
|
|
||||||
|
|
||||||
// TODO: work with local configurations
|
// TODO: work with local configurations
|
||||||
let disposable = vscode.commands.registerCommand("dumbpilot.enableCompletion", () => {
|
let disposable = vscode.commands.registerCommand("dumbpilot.enableCompletion", () => {
|
||||||
completion_enabled = true;
|
|
||||||
config.update("completionEnabled", true);
|
config.update("completionEnabled", true);
|
||||||
});
|
});
|
||||||
context.subscriptions.push(disposable);
|
context.subscriptions.push(disposable);
|
||||||
|
|
||||||
disposable = vscode.commands.registerCommand("dumbpilot.disableCompletion", () => {
|
disposable = vscode.commands.registerCommand("dumbpilot.disableCompletion", () => {
|
||||||
completion_enabled = false;
|
|
||||||
config.update("completionEnabled", false);
|
config.update("completionEnabled", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -131,11 +127,12 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
const provider: vscode.InlineCompletionItemProvider = {
|
const provider: vscode.InlineCompletionItemProvider = {
|
||||||
async provideInlineCompletionItems(document, position, context, token) {
|
async provideInlineCompletionItems(document, position, context, token) {
|
||||||
|
|
||||||
if (completion_enabled === false) {
|
// disable if predictive completion is disabled
|
||||||
|
if (config.get("completionEnabled") as boolean === false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since for every completion we want to query the server, we want to filter out
|
// Since for every completion we will query the server, we want to filter out
|
||||||
// automatic completion invokes
|
// automatic completion invokes
|
||||||
if (context.triggerKind === vscode.InlineCompletionTriggerKind.Automatic) {
|
if (context.triggerKind === vscode.InlineCompletionTriggerKind.Automatic) {
|
||||||
return null;
|
return null;
|
||||||
@ -224,6 +221,9 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = await response.json() as llamaData;
|
data = await response.json() as llamaData;
|
||||||
|
const gen_tokens = data.timings.predicted_n;
|
||||||
|
const gen_time = (data.timings.predicted_ms / 1000).toFixed(2);
|
||||||
|
showMessageWithTimeout(`predicted ${gen_tokens} tokens in ${gen_time} seconds`, 1500);
|
||||||
|
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
const err = e as TypeError;
|
const err = e as TypeError;
|
||||||
|
Loading…
Reference in New Issue
Block a user