From adedbec510f0d50ae49ce69b032ca7568b45b135 Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Mon, 26 Aug 2024 18:31:03 +0800 Subject: [PATCH 1/7] feat(workflow): update custom workflows asynchronously Modify the workflow update mechanism to include asynchronous updates for custom workflows in addition to the standard workflows. This ensures that both default and custom workflows are updated efficiently, improving the overall functionality and user experience within the DevChat environment. BREAKING CHANGE: Custom workflow updates now occur asynchronously alongside standard workflow updates. This may affect downstream systems that rely on synchronous workflow updates. Systems should now handle the asynchronous nature of custom workflow updates. --- src/contributes/commands.ts | 3 +++ src/handler/handlerRegister.ts | 5 ++++- src/handler/workflowCommandHandler.ts | 10 ++++++++++ src/toolwrapper/devchatClient.ts | 13 +++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) 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, From 3e2ccd5ab2d3f30d16c03c7905c51a3caf270eba Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Tue, 27 Aug 2024 17:35:23 +0800 Subject: [PATCH 2/7] feat(ide_services): add endpoint for retrieving local service port Add a new endpoint `/get_local_service_port` to ide_services for obtaining the port number of the local service. This endpoint utilizes the `getLocalServicePort` function, which logs the local service port and retrieves it from the environment variable `DC_LOCALSERVICE_PORT`. --- src/ide_services/endpoints/getServicePort.ts | 7 +++++++ src/ide_services/services.ts | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ide_services/endpoints/getServicePort.ts b/src/ide_services/endpoints/getServicePort.ts index a2a42a4..0f91fba 100644 --- a/src/ide_services/endpoints/getServicePort.ts +++ b/src/ide_services/endpoints/getServicePort.ts @@ -7,3 +7,10 @@ export async function getServicePort() { // return await UiUtilWrapper.getLSPBrigePort(); return process.env.DEVCHAT_IDE_SERVICE_PORT; } + +export async function getLocalServicePort() { + logger + .channel() + ?.info(`get local service port: ${process.env.DC_LOCALSERVICE_PORT}`); + return process.env.DC_LOCALSERVICE_PORT; +} \ No newline at end of file diff --git a/src/ide_services/services.ts b/src/ide_services/services.ts index f97c27a..b137f9f 100644 --- a/src/ide_services/services.ts +++ b/src/ide_services/services.ts @@ -3,7 +3,7 @@ import * as http from "http"; import * as querystring from "querystring"; import { logger } from "../util/logger"; -import { getServicePort } from "./endpoints/getServicePort"; +import { getServicePort, getLocalServicePort } from "./endpoints/getServicePort"; import { installPythonEnv } from "./endpoints/installPythonEnv"; import { ideLogging} from "./endpoints/ideLogging"; import { updateSlashCommands } from "./endpoints/updateSlashCommands"; @@ -26,6 +26,10 @@ const functionRegistry: any = { keys: [], handler: getServicePort, }, + "/get_local_service_port": { + keys: [], + handler: getLocalServicePort, + }, "/install_python_env": { keys: ["command_name", "requirements_file"], handler: installPythonEnv, From 3cf88d64ffdad358b83adbc667e5b7ff7e792c23 Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Tue, 27 Aug 2024 18:29:11 +0800 Subject: [PATCH 3/7] chore(submodules): update gui and tools to latest commits Update gui and tools submodules to their newest versions using the following commits: - gui: e7dea52c58d9da9dfb47c10dc20d8c35e9fd9837 -> 87c6c104db80991e818b1a9e5ab5ef4bfdb8fcf3 - tools: 0acb8467457b463118465cb067b1216860fd9e6d -> 488bc13fe0ee22dcee6eeafd023147e137a9eddf --- gui | 2 +- tools | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui b/gui index e7dea52..87c6c10 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit e7dea52c58d9da9dfb47c10dc20d8c35e9fd9837 +Subproject commit 87c6c104db80991e818b1a9e5ab5ef4bfdb8fcf3 diff --git a/tools b/tools index 0acb846..488bc13 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit 0acb8467457b463118465cb067b1216860fd9e6d +Subproject commit 488bc13fe0ee22dcee6eeafd023147e137a9eddf From 60cc1e376e92955d73a6d09e97ed9adf851825b6 Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Wed, 28 Aug 2024 06:50:35 +0800 Subject: [PATCH 4/7] workflow(update): refresh workflow commands on registration Update the workflow command list automatically when new workflows are registered or modified. This ensures the command list displayed to the user is always current and accurate, eliminating the need for manual refreshes. --- gui | 2 +- src/handler/handlerRegister.ts | 3 +-- src/handler/workflowCommandHandler.ts | 10 ---------- tools | 2 +- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/gui b/gui index 87c6c10..2499ff5 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit 87c6c104db80991e818b1a9e5ab5ef4bfdb8fcf3 +Subproject commit 2499ff53123e059d74a32770482ee9dce9d6a010 diff --git a/src/handler/handlerRegister.ts b/src/handler/handlerRegister.ts index c7e3ac8..90b80ae 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,handleUpdateWorkflowList } from './workflowCommandHandler'; +import { handleRegCommandList } from './workflowCommandHandler'; import { sendMessage, stopDevChat, regeneration, deleteChatMessage, userInput } from './sendMessage'; import { applyCodeWithDiff } from './diffHandler'; import { addConext } from './contextHandler'; @@ -37,7 +37,6 @@ 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: } diff --git a/src/handler/workflowCommandHandler.ts b/src/handler/workflowCommandHandler.ts index b5b0792..df3d076 100644 --- a/src/handler/workflowCommandHandler.ts +++ b/src/handler/workflowCommandHandler.ts @@ -57,14 +57,4 @@ export async function sendCommandListByDevChatRun() { if (existPannel) { 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/tools b/tools index 488bc13..dd0bb94 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit 488bc13fe0ee22dcee6eeafd023147e137a9eddf +Subproject commit dd0bb94be17a315e490856373d78b146de0fd8de From 682431efdb7999450ae2198b9aa1a577689ea9ac Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Mon, 2 Sep 2024 07:35:36 +0800 Subject: [PATCH 5/7] tools: update subproject to latest commit aac7c21 The tools subproject has been updated from commit dd0bb94 to aac7c21. This change includes various improvements and bug fixes detailed in the commit history between the two versions. --- tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools b/tools index dd0bb94..aac7c21 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit dd0bb94be17a315e490856373d78b146de0fd8de +Subproject commit aac7c2116641f3086583661ffcba066c6bf02cf8 From 0f93c39e0970716266202636cc961f13e2772271 Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Mon, 2 Sep 2024 14:54:37 +0800 Subject: [PATCH 6/7] fix(gui): update subproject to latest commit Upgrade the 'gui' subproject to incorporate recent changes from commit 34f4b4fc8cb58436c53726c7a9c54f098620cbfc, replacing the previous commit 2499ff53123e059d74a32770482ee9dce9d6a010. This update includes various UI improvements and bug fixes. --- gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui b/gui index 2499ff5..34f4b4f 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit 2499ff53123e059d74a32770482ee9dce9d6a010 +Subproject commit 34f4b4fc8cb58436c53726c7a9c54f098620cbfc From 0f45be36044ede28b76731ccc9ac183772bad4d7 Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Mon, 2 Sep 2024 16:02:13 +0800 Subject: [PATCH 7/7] update(gui): reflect styling changes in the GUI subproject Update the GUI subproject with a new commit that introduces various styling improvements. The commit hash has been changed from the previous 34f4b4fc8cb58436c53726c7a9c54f098620cbfc to the latest 87fb8b5d9d6cd937c449e00218b1777c38ee1ba2, indicating new styling updates. --- gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui b/gui index 34f4b4f..87fb8b5 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit 34f4b4fc8cb58436c53726c7a9c54f098620cbfc +Subproject commit 87fb8b5d9d6cd937c449e00218b1777c38ee1ba2