Update submodules and workflow commands
This commit is contained in:
parent
dd4afea7ea
commit
60d2c5b808
2
gui
2
gui
@ -1 +1 @@
|
|||||||
Subproject commit fc781cece340c22ecf301c612e64efde3313a2dc
|
Subproject commit fc5e916ec69fd0dcc18fe4ea92352ae8dd3d9e67
|
@ -5,38 +5,6 @@ import { ApiKeyManager } from '../util/apiKey';
|
|||||||
import DevChat from '../toolwrapper/devchat';
|
import DevChat from '../toolwrapper/devchat';
|
||||||
|
|
||||||
|
|
||||||
export interface Command {
|
|
||||||
name: string;
|
|
||||||
pattern: string;
|
|
||||||
description: string;
|
|
||||||
path: string;
|
|
||||||
args: number;
|
|
||||||
recommend: number;
|
|
||||||
handler: (commandName: string, userInput: string) => Promise<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getCommandListByDevChatRun(includeHide: boolean = false): Promise<Command[]> {
|
|
||||||
// load commands from CustomCommands
|
|
||||||
let newCommands: Command[] = [];
|
|
||||||
|
|
||||||
const devChat = new DevChat();
|
|
||||||
const commandList = await devChat.commands();
|
|
||||||
commandList.forEach(command => {
|
|
||||||
const commandObj: Command = {
|
|
||||||
name: command.name,
|
|
||||||
pattern: command.name,
|
|
||||||
description: command.description,
|
|
||||||
path: command.path,
|
|
||||||
recommend: command.recommend,
|
|
||||||
args: 0,
|
|
||||||
handler: async (commandName: string, userInput: string) => { return ''; }
|
|
||||||
};
|
|
||||||
newCommands.push(commandObj);
|
|
||||||
});
|
|
||||||
|
|
||||||
return newCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
let existPannel: vscode.WebviewPanel|vscode.WebviewView|undefined = undefined;
|
let existPannel: vscode.WebviewPanel|vscode.WebviewView|undefined = undefined;
|
||||||
|
|
||||||
regInMessage({command: 'regCommandList'});
|
regInMessage({command: 'regCommandList'});
|
||||||
@ -44,17 +12,8 @@ regOutMessage({command: 'regCommandList', result: [{name: '', pattern: '', descr
|
|||||||
export async function getWorkflowCommandList(message: any, panel: vscode.WebviewPanel|vscode.WebviewView): Promise<void> {
|
export async function getWorkflowCommandList(message: any, panel: vscode.WebviewPanel|vscode.WebviewView): Promise<void> {
|
||||||
existPannel = panel;
|
existPannel = panel;
|
||||||
|
|
||||||
const commandList = await getCommandListByDevChatRun();
|
const commandList = await new DevChat().commands();
|
||||||
const commandCovertedList = commandList.map(command => {
|
MessageHandler.sendMessage(panel, { command: 'regCommandList', result: commandList });
|
||||||
if (command.args > 0) {
|
|
||||||
// replace {{prompt}} with {{["",""]}}, count of "" is args
|
|
||||||
const prompt = Array.from({length: command.args}, () => "");
|
|
||||||
command.pattern = command.pattern.replace('{{prompt}}', '{{' + JSON.stringify(prompt) + '}}');
|
|
||||||
}
|
|
||||||
return command;
|
|
||||||
});
|
|
||||||
|
|
||||||
MessageHandler.sendMessage(panel, { command: 'regCommandList', result: commandCovertedList });
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ class DevChat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async commands(): Promise<CommandEntry[]> {
|
async commands(): Promise<any[]> {
|
||||||
try {
|
try {
|
||||||
const args = ["-m", "devchat", "workflow", "list", "--json"];
|
const args = ["-m", "devchat", "workflow", "list", "--json"];
|
||||||
|
|
||||||
@ -475,9 +475,7 @@ class DevChat {
|
|||||||
// 确保每个CommandEntry对象的recommend字段默认为-1
|
// 确保每个CommandEntry对象的recommend字段默认为-1
|
||||||
const recommendCommands = await this.loadRecommendCommands();
|
const recommendCommands = await this.loadRecommendCommands();
|
||||||
commands = commands.map((cmd: any) => ({
|
commands = commands.map((cmd: any) => ({
|
||||||
name: cmd.name,
|
...cmd,
|
||||||
description: cmd.command_conf.description,
|
|
||||||
path: cmd.namespace,
|
|
||||||
recommend: recommendCommands.indexOf(cmd.name),
|
recommend: recommendCommands.indexOf(cmd.name),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
2
tools
2
tools
@ -1 +1 @@
|
|||||||
Subproject commit 1db2a69a5f1cd1576e582d9d7b3ae5a2d88392c2
|
Subproject commit a761c6a462fb0d0e5eb8ec3328dba2015d455fe6
|
@ -1 +1 @@
|
|||||||
Subproject commit daea79e719527e93a5262a2b8f1d1cb83c47ebe7
|
Subproject commit a9015f2a37a25e324a8e9e41a9c12b75a8b78e37
|
Loading…
x
Reference in New Issue
Block a user