Merge pull request #351 from devchat-ai/remove_user_date_from_response

Remove user date from response
This commit is contained in:
boob.yang 2023-12-07 09:13:59 +08:00 committed by GitHub
commit 1ebebcc76b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 11 deletions

2
.gitmodules vendored
View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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,

2
tools

@ -1 +1 @@
Subproject commit c9cc0d51a4d24162aaa2216e0bb0c6b198f74206
Subproject commit bbd2c13b6b08622bdea6b1e78a593af854c78859