添加Azure配置支持,修复重复的配置项冲突

This commit is contained in:
Alcedo 2023-08-31 08:51:39 +08:00
parent 5028c2ea67
commit 57416dcd03
3 changed files with 27 additions and 2 deletions

View file

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

View file

@ -854,7 +854,7 @@ export function supportGuoba () {
component: 'Divider'
},
{
field: 'apiKey',
field: 'azApiKey',
label: 'Azure API Key',
bottomHelpMessage: '管理密钥用于访问Azure的API接口',
component: 'InputPassword'

View file

@ -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"
}
]
}
]
}