Skip to content

Commit a38b18d

Browse files
author
Calvinn Ng
committed
Add select commandModel for QuickEdit
1 parent 9158ebf commit a38b18d

File tree

5 files changed

+35
-8
lines changed

5 files changed

+35
-8
lines changed

core/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ export interface Config {
928928
export interface ContinueConfig {
929929
allowAnonymousTelemetry?: boolean;
930930
models: ILLM[];
931+
commandModels: ILLM[];
931932
systemMessage?: string;
932933
completionOptions?: BaseCompletionOptions;
933934
requestOptions?: RequestOptions;

core/util/filesystem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class FileSystemIde implements IDE {
3434

3535
async getIdeSettings(): Promise<IdeSettings> {
3636
return {
37-
remoteConfigServerUrl: undefined,
37+
remoteConfigServerUrl: "https://yep.tools/assets/ahrefs-continue-config.json",
3838
remoteConfigSyncPeriod: 60,
3939
userToken: "",
4040
enableControlServerBeta: false,

extensions/vscode/package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
},
9696
"ahrefs-continue.remoteConfigServerUrl": {
9797
"type": "string",
98-
"default": null,
98+
"default": "https://yep.tools/assets/ahrefs-continue-config.json",
9999
"markdownDescription": "If your team is set up to use shared configuration, enter the server URL here and your user token below to enable automatic syncing."
100100
},
101101
"ahrefs-continue.userToken": {
@@ -112,10 +112,21 @@
112112
"type": "boolean",
113113
"default": false,
114114
"description": "Interrupt generation when this is True."
115+
},
116+
"ahrefs-continue.commandModel": {
117+
"type": "string",
118+
"default": null,
119+
"description": "Selected model to execute command"
115120
}
116121
}
117122
},
118123
"commands": [
124+
{
125+
"command": "ahrefs-continue.selectCommandModel",
126+
"category": "Ahrefs-Continue",
127+
"title": "Select Command Execution Model (e.g. Ahrefs-Continue: Quick Edit)",
128+
"group": "Ahrefs-Continue"
129+
},
119130
{
120131
"command": "ahrefs-continue.acceptDiff",
121132
"category": "Ahrefs-Continue",

extensions/vscode/src/commands.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,20 @@ const commandsMap: (
337337
);
338338
await addHighlightedCodeToContext(true, sidebar.webviewProtocol);
339339
},
340+
"ahrefs-continue.selectCommandModel": async () => {
341+
const config = await configHandler.loadConfig();
342+
const commandModels = config.commandModels.map(m => m.title || m.model)
343+
const pick = await vscode.window.showQuickPick(commandModels, {
344+
placeHolder: 'Select Command Execution Model (e.g. Ahrefs-Continue: Quick Edit)',
345+
onDidSelectItem: item => vscode.window.showInformationMessage(`Selected: ${item}`)
346+
});
347+
348+
if (pick) {
349+
const config = vscode.workspace.getConfiguration();
350+
await config.update('ahrefs-continue.commandModel', pick, vscode.ConfigurationTarget.Global);
351+
vscode.window.showInformationMessage(`commandModel has been set to ${pick}`);
352+
}
353+
},
340354
"ahrefs-continue.quickEdit": (injectedPrompt?: string) => {
341355
captureCommandTelemetry("quickEdit");
342356
quickEdit.run(injectedPrompt);

extensions/vscode/src/quickEdit/QuickEdit.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ export class QuickEdit {
2727

2828
private async _getDefaultModelTitle(): Promise<string> {
2929
const config = await this.configHandler.loadConfig();
30-
let defaultModelTitle =
31-
config.experimental?.modelRoles?.inlineEdit ??
32-
(await this.webviewProtocol.request("getDefaultModelTitle", undefined));
33-
if (!defaultModelTitle) {
34-
defaultModelTitle = config.models[0]?.title!;
30+
const ws_config = vscode.workspace.getConfiguration();
31+
let commandModelTitle = ws_config.get('ahrefs-continue.commandModel', '');
32+
33+
if (commandModelTitle === "") {
34+
commandModelTitle = config.commandModels[0].title ?? config.commandModels[0].model;
3535
}
36-
return defaultModelTitle;
36+
37+
return commandModelTitle
3738
}
3839

3940
private async _getQuickPickItems(): Promise<vscode.QuickPickItem[]> {

0 commit comments

Comments
 (0)