mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 22:07:10 +00:00
添加Azure配置支持,修复重复的配置项冲突
This commit is contained in:
parent
5028c2ea67
commit
57416dcd03
3 changed files with 27 additions and 2 deletions
|
|
@ -1935,7 +1935,7 @@ export class chatgpt extends plugin {
|
||||||
let msg = conversation.messages
|
let msg = conversation.messages
|
||||||
let content = { role: 'user', content: prompt }
|
let content = { role: 'user', content: prompt }
|
||||||
msg.push(content)
|
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 deploymentName = Config.azureDeploymentName
|
||||||
const { choices } = await client.getChatCompletions(deploymentName, msg)
|
const { choices } = await client.getChatCompletions(deploymentName, msg)
|
||||||
let completion = choices[0].message;
|
let completion = choices[0].message;
|
||||||
|
|
|
||||||
|
|
@ -854,7 +854,7 @@ export function supportGuoba () {
|
||||||
component: 'Divider'
|
component: 'Divider'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'apiKey',
|
field: 'azApiKey',
|
||||||
label: 'Azure API Key',
|
label: 'Azure API Key',
|
||||||
bottomHelpMessage: '管理密钥,用于访问Azure的API接口',
|
bottomHelpMessage: '管理密钥,用于访问Azure的API接口',
|
||||||
component: 'InputPassword'
|
component: 'InputPassword'
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,10 @@
|
||||||
"label": "必应",
|
"label": "必应",
|
||||||
"value": "bing"
|
"value": "bing"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "Azure OpenAI",
|
||||||
|
"value": "azure"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "ChatGPT API",
|
"label": "ChatGPT API",
|
||||||
"value": "api"
|
"value": "api"
|
||||||
|
|
@ -823,6 +827,27 @@
|
||||||
"data": "bardForceUseReverse"
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue