diff --git a/.gitmodules b/.gitmodules index b371a2a..acc49b1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "tools"] path = tools - url = https://github.com/devchat-ai/devchat-vscode-tools.git + url = git@github.com:devchat-ai/devchat-vscode-tools.git diff --git a/src/contributes/commands.ts b/src/contributes/commands.ts index cc77c58..eb5c36c 100644 --- a/src/contributes/commands.ts +++ b/src/contributes/commands.ts @@ -87,6 +87,12 @@ function regAccessKeyCommand(context: vscode.ExtensionContext, provider: string) if (passwordInput === undefined) { return; } + if (provider === "DevChat" && passwordInput.trim() !== "") { + if (!passwordInput.trim().startsWith("DC.")) { + UiUtilWrapper.showErrorMessage("Your key is invalid! DevChat Access Key is: DC.xxxxx"); + return; + } + } if (passwordInput.trim() !== "" && !isValidApiKey(passwordInput)) { UiUtilWrapper.showErrorMessage("Your key is invalid!"); @@ -223,6 +229,8 @@ export function regApplyDiffResultCommand(context: vscode.ExtensionContext) { const leftDoc = await vscode.workspace.openTextDocument(leftUri); const rightDoc = await vscode.workspace.openTextDocument(rightUri); + // close rightDoc + await vscode.commands.executeCommand('workbench.action.closeActiveEditor'); // 将右边文档的内容替换到左边文档 const leftEditor = await vscode.window.showTextDocument(leftDoc); await leftEditor.edit(editBuilder => { @@ -289,9 +297,9 @@ export function registerInstallCommandsPython(context: vscode.ExtensionContext) if (!fs.existsSync(requirementsFile)) { requirementsFile = path.join(os.homedir(), '.chat', 'workflows', 'sys', 'requirements.txt'); if (!fs.existsSync(requirementsFile)) { - logger.channel()?.warn(`requirements.txt not found in ~/.chat/workflows dir.`); - logger.channel()?.show(); - vscode.window.showErrorMessage(`Error: see OUTPUT for more detail!`); + // logger.channel()?.warn(`requirements.txt not found in ~/.chat/workflows dir.`); + // logger.channel()?.show(); + // vscode.window.showErrorMessage(`Error: see OUTPUT for more detail!`); return ; } } @@ -319,7 +327,7 @@ export function registerInstallCommandsPython(context: vscode.ExtensionContext) } UiUtilWrapper.updateConfiguration("DevChat", "PythonForCommands", pythonCommand.trim()); - vscode.window.showInformationMessage(`All slash Command has ready to use! Please input / to try it!`); + vscode.window.showInformationMessage(`All slash Commands are ready to use! Please input / to try workflow commands!`); }); context.subscriptions.push(disposable); diff --git a/src/handler/accessKeyHandler.ts b/src/handler/accessKeyHandler.ts index 482026d..b7222e6 100644 --- a/src/handler/accessKeyHandler.ts +++ b/src/handler/accessKeyHandler.ts @@ -31,5 +31,5 @@ export async function getUserAccessKey(message: any, panel: vscode.WebviewPanel| "keyType": llmModelData.api_key?.startsWith("DC.") ? "DevChat" : "others", "endPoint": llmModelData.api_base ? llmModelData.api_base : "" }; - MessageHandler.sendMessage(panel, keyData); + MessageHandler.sendMessage(panel, keyData, false); } \ No newline at end of file diff --git a/src/toolwrapper/devchat.ts b/src/toolwrapper/devchat.ts index 967dc2a..18b1a39 100644 --- a/src/toolwrapper/devchat.ts +++ b/src/toolwrapper/devchat.ts @@ -116,7 +116,11 @@ class DevChat { args.push("-m", llmModelData.model); args.push("-ns"); - args.push("-a"); + + const functionCalling = UiUtilWrapper.getConfiguration('DevChat', 'EnableFunctionCalling'); + if (functionCalling) { + args.push("-a"); + } return args; } @@ -194,11 +198,11 @@ class DevChat { private async runCommand(args: string[]): Promise<{code: number | null, stdout: string, stderr: string}> { // build env variables for command const envs = { + ...process.env, // eslint-disable-next-line @typescript-eslint/naming-convention "PYTHONUTF8":1, // eslint-disable-next-line @typescript-eslint/naming-convention - "PYTHONPATH": UiUtilWrapper.extensionPath() + "/tools/site-packages", - ...process.env + "PYTHONPATH": UiUtilWrapper.extensionPath() + "/tools/site-packages" }; const pythonApp = UiUtilWrapper.getConfiguration("DevChat", "PythonForChat") || "python3"; @@ -291,7 +295,7 @@ class DevChat { "prompt-hash": logs[0]['hash'], user: "", date: "", - response: stdout, + response: responseData.response, // eslint-disable-next-line @typescript-eslint/naming-convention finish_reason: "", isError: false, diff --git a/tools b/tools index c9cc0d5..bbd2c13 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit c9cc0d51a4d24162aaa2216e0bb0c6b198f74206 +Subproject commit bbd2c13b6b08622bdea6b1e78a593af854c78859