fix getUserAccessKey error

This commit is contained in:
bobo.yang 2023-09-14 16:44:41 +08:00
parent a2699cfa64
commit 0b4e2c25ed
2 changed files with 6 additions and 6 deletions

View File

@ -34,6 +34,11 @@ import { UiUtilVscode } from './util/uiUtil_vscode';
import { FT } from './util/feature_flags/feature_toggles';
async function configUpdateTo_0912() {
const defaultModel: any = UiUtilWrapper.getConfiguration("devchat", "defaultModel");
if (!defaultModel) {
vscode.workspace.getConfiguration("devchat").update("defaultModel", "gpt-3.5-turbo", vscode.ConfigurationTarget.Global);
}
const devchatKey = UiUtilWrapper.getConfiguration('DevChat', 'Access_Key_DevChat');
const openaiKey = UiUtilWrapper.getConfiguration('DevChat', 'Api_Key_OpenAI');
const endpointKey = UiUtilWrapper.getConfiguration('DevChat', 'API_ENDPOINT');
@ -72,11 +77,6 @@ async function configUpdateTo_0912() {
return;
}
}
const defaultModel: any = UiUtilWrapper.getConfiguration("devchat", "defaultModel");
if (!defaultModel) {
vscode.workspace.getConfiguration("devchat").update("defaultModel", "gpt-3.5-turbo");
}
}

View File

@ -13,7 +13,7 @@ regOutMessage({command: 'getUserAccessKey', accessKey: "DC.xxx", keyType: "DevCh
export async function getUserAccessKey(message: any, panel: vscode.WebviewPanel|vscode.WebviewView): Promise<void> {
const workspaceDir = UiUtilWrapper.workspaceFoldersFirstPath();
const llmModelData = await ApiKeyManager.llmModel();
if (!llmModelData || llmModelData.api_key) {
if (!llmModelData || !llmModelData.api_key) {
MessageHandler.sendMessage(panel, {"command": "getUserAccessKey", "accessKey": "", "keyType": "", "endPoint": ""});
return;
}