Skip to content

Commit 46e17b9

Browse files
authored
Merge pull request #589 from devchat-ai/auto_custom_workflow
Auto custom workflow
2 parents 459d6e0 + 0f45be3 commit 46e17b9

File tree

8 files changed

+33
-4
lines changed

8 files changed

+33
-4
lines changed

src/contributes/commands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,16 @@ export function registerInstallCommandsCommand(
208208
if (!fs.existsSync(sysDirPath)) {
209209
// Directory does not exist, wait for updateWorkflows to finish
210210
await dcClient.updateWorkflows();
211+
await dcClient.updateCustomWorkflows();
211212
sendCommandListByDevChatRun();
212213
} else {
213214
// Directory exists, execute sendCommandListByDevChatRun immediately
214215
await sendCommandListByDevChatRun();
215216

216217
// Then asynchronously execute updateWorkflows
217218
await dcClient.updateWorkflows();
219+
await dcClient.updateCustomWorkflows();
220+
218221
await sendCommandListByDevChatRun();
219222
}
220223
}

src/handler/handlerRegister.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,5 @@ messageHandler.registerHandler('getIDEServicePort', getIDEServicePort);
8282

8383
messageHandler.registerHandler('readServerConfigBase', readServerConfigBase);
8484
messageHandler.registerHandler('writeServerConfigBase', writeServerConfigBase);
85+
86+

src/handler/workflowCommandHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ export async function sendCommandListByDevChatRun() {
5757
if (existPannel) {
5858
await getWorkflowCommandList({}, existPannel!);
5959
}
60-
}
60+
}

src/ide_services/endpoints/getServicePort.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ export async function getServicePort() {
77
// return await UiUtilWrapper.getLSPBrigePort();
88
return process.env.DEVCHAT_IDE_SERVICE_PORT;
99
}
10+
11+
export async function getLocalServicePort() {
12+
logger
13+
.channel()
14+
?.info(`get local service port: ${process.env.DC_LOCALSERVICE_PORT}`);
15+
return process.env.DC_LOCALSERVICE_PORT;
16+
}

src/ide_services/services.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as http from "http";
33
import * as querystring from "querystring";
44
import { logger } from "../util/logger";
55

6-
import { getServicePort } from "./endpoints/getServicePort";
6+
import { getServicePort, getLocalServicePort } from "./endpoints/getServicePort";
77
import { installPythonEnv } from "./endpoints/installPythonEnv";
88
import { ideLogging} from "./endpoints/ideLogging";
99
import { updateSlashCommands } from "./endpoints/updateSlashCommands";
@@ -26,6 +26,10 @@ const functionRegistry: any = {
2626
keys: [],
2727
handler: getServicePort,
2828
},
29+
"/get_local_service_port": {
30+
keys: [],
31+
handler: getLocalServicePort,
32+
},
2933
"/install_python_env": {
3034
keys: ["command_name", "requirements_file"],
3135
handler: installPythonEnv,

src/toolwrapper/devchatClient.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,19 @@ export class DevChatClient {
229229
);
230230
}
231231

232+
@timeThis
233+
@catchAndReturn(undefined)
234+
async updateCustomWorkflows(): Promise<void> {
235+
const response = await this._post("/workflows/custom_update");
236+
logger
237+
.channel()
238+
?.trace(
239+
`updateCustomWorkflows response data: \n${JSON.stringify(
240+
response.data
241+
)}`
242+
);
243+
}
244+
232245
@timeThis
233246
async message(
234247
message: ChatRequest,

tools

Submodule tools updated 419 files

0 commit comments

Comments
 (0)