update api key setting

This commit is contained in:
bobo.yang 2023-09-22 23:08:19 +08:00
parent e02fa4d163
commit 21b07f44db
3 changed files with 8 additions and 5 deletions

View File

@ -73,7 +73,6 @@ async function configUpdateTo_0912() {
Object.keys(modelConfig3).length === 0) {
// config default gpt models
if (Object.keys(modelConfigNew).length === 0) {
modelConfigNew["api_key"] = "DC.<your devchat key>";
modelConfigNew["provider"] = "openai";
}

View File

@ -55,10 +55,14 @@ export class ApiKeyManager {
if (!providerName) {
return undefined;
}
const apiKey = await this.loadApiKeySecret(providerName);
let apiKey = await this.loadApiKeySecret(providerName);
if (!apiKey) {
return undefined;
apiKey = await this.loadApiKeySecret("DevChat");
if (!apiKey) {
return undefined;
}
}
modelProperties["api_key"] = apiKey;
}

View File

@ -128,8 +128,8 @@ Generate a professionally written and formatted release note in markdown with th
switch (value) {
case "settings": messageUtil.sendMessage({ command: 'doCommand', content: ['workbench.action.openSettings', 'DevChat'] }); break;
case "start_indexing": messageUtil.sendMessage({ command: 'doCommand', content: ['DevChat.AskCodeIndexStart'] }); break;
case "setting_openai_key": messageUtil.sendMessage({ command: 'doCommand', content: ['workbench.action.openSettings', 'DevChat: Api_key_OpenAI'] }); break;
case "setting_devchat_key": messageUtil.sendMessage({ command: 'doCommand', content: ['workbench.action.openSettings', 'DevChat: Access_key_DevChat'] }); break;
case "setting_openai_key": messageUtil.sendMessage({ command: 'doCommand', content: ['DevChat.AccessKey.OpenAI'] }); break;
case "setting_devchat_key": messageUtil.sendMessage({ command: 'doCommand', content: ['DevChat.AccessKey.DevChat'] }); break;
}
};