diff --git a/apps/chat.js b/apps/chat.js index c9efd86..7dd8706 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -1935,7 +1935,7 @@ export class chatgpt extends plugin { let msg = conversation.messages let content = { role: 'user', content: prompt } msg.push(content) - const client = new OpenAIClient(Config.azureUrl, new AzureKeyCredential(Config.apiKey)) + const client = new OpenAIClient(Config.azureUrl, new AzureKeyCredential(Config.azApiKey)) const deploymentName = Config.azureDeploymentName const { choices } = await client.getChatCompletions(deploymentName, msg) let completion = choices[0].message; diff --git a/guoba.support.js b/guoba.support.js index 0bb7319..d855d72 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -854,7 +854,7 @@ export function supportGuoba () { component: 'Divider' }, { - field: 'apiKey', + field: 'azApiKey', label: 'Azure API Key', bottomHelpMessage: '管理密钥,用于访问Azure的API接口', component: 'InputPassword' diff --git a/resources/view/setting_view.json b/resources/view/setting_view.json index 5fa743a..6903eb3 100644 --- a/resources/view/setting_view.json +++ b/resources/view/setting_view.json @@ -61,6 +61,10 @@ "label": "必应", "value": "bing" }, + { + "label": "Azure OpenAI", + "value": "azure" + }, { "label": "ChatGPT API", "value": "api" @@ -823,6 +827,27 @@ "data": "bardForceUseReverse" } ] + }, + { + "title": "Azure", + "tab": "azure", + "view": [ + { + "type": "password", + "label": "Azure API Key", + "data": "azApiKey" + }, + { + "type": "url", + "label": "端点地址", + "data": "azureUrl" + }, + { + "type": "url", + "label": "部署名称", + "data": "azureDeploymentName" + } + ] } ] }