diff --git a/src/contributes/commands.ts b/src/contributes/commands.ts index 46bb95f..83f5056 100644 --- a/src/contributes/commands.ts +++ b/src/contributes/commands.ts @@ -208,6 +208,7 @@ export function registerInstallCommandsCommand( if (!fs.existsSync(sysDirPath)) { // Directory does not exist, wait for updateWorkflows to finish await dcClient.updateWorkflows(); + await dcClient.updateCustomWorkflows(); sendCommandListByDevChatRun(); } else { // Directory exists, execute sendCommandListByDevChatRun immediately @@ -215,6 +216,8 @@ export function registerInstallCommandsCommand( // Then asynchronously execute updateWorkflows await dcClient.updateWorkflows(); + await dcClient.updateCustomWorkflows(); + await sendCommandListByDevChatRun(); } } diff --git a/src/handler/handlerRegister.ts b/src/handler/handlerRegister.ts index 12545cf..c7e3ac8 100644 --- a/src/handler/handlerRegister.ts +++ b/src/handler/handlerRegister.ts @@ -3,7 +3,7 @@ import { insertCodeBlockToFile } from './codeBlockHandler'; import { replaceCodeBlockToFile } from './codeBlockHandler'; import { doCommit } from './commitHandler'; import { getHistoryMessages } from './historyMessagesHandler'; -import { handleRegCommandList } from './workflowCommandHandler'; +import { handleRegCommandList,handleUpdateWorkflowList } from './workflowCommandHandler'; import { sendMessage, stopDevChat, regeneration, deleteChatMessage, userInput } from './sendMessage'; import { applyCodeWithDiff } from './diffHandler'; import { addConext } from './contextHandler'; @@ -37,6 +37,7 @@ messageHandler.registerHandler('historyMessages', getHistoryMessages); // Register the command list // Response: { command: 'regCommandList', result: } messageHandler.registerHandler('regCommandList', handleRegCommandList); +messageHandler.registerHandler('updateWorkflowList', handleUpdateWorkflowList); // Send a message, send the message entered by the user to AI // Response: // { command: 'receiveMessagePartial', text: , user: , date: } @@ -82,3 +83,5 @@ messageHandler.registerHandler('getIDEServicePort', getIDEServicePort); messageHandler.registerHandler('readServerConfigBase', readServerConfigBase); messageHandler.registerHandler('writeServerConfigBase', writeServerConfigBase); + + diff --git a/src/handler/workflowCommandHandler.ts b/src/handler/workflowCommandHandler.ts index c886116..b5b0792 100644 --- a/src/handler/workflowCommandHandler.ts +++ b/src/handler/workflowCommandHandler.ts @@ -58,3 +58,13 @@ export async function sendCommandListByDevChatRun() { await getWorkflowCommandList({}, existPannel!); } } + +export async function handleUpdateWorkflowList(){ + + const dcClient = new DevChatClient(); + + await dcClient.updateWorkflows(); + await dcClient.updateCustomWorkflows(); + + await sendCommandListByDevChatRun(); +} \ No newline at end of file diff --git a/src/toolwrapper/devchatClient.ts b/src/toolwrapper/devchatClient.ts index a599ccd..2b65fc3 100644 --- a/src/toolwrapper/devchatClient.ts +++ b/src/toolwrapper/devchatClient.ts @@ -229,6 +229,19 @@ export class DevChatClient { ); } + @timeThis + @catchAndReturn(undefined) + async updateCustomWorkflows(): Promise { + const response = await this._post("/workflows/custom_update"); + logger + .channel() + ?.trace( + `updateCustomWorkflows response data: \n${JSON.stringify( + response.data + )}` + ); + } + @timeThis async message( message: ChatRequest,