feat: add deployment_mapping for Azure OpenAI

This commit is contained in:
WqyJh
2023-11-20 16:00:21 +08:00
parent 495fc628e4
commit 9042b7c4e4
5 changed files with 68 additions and 12 deletions

View File

@@ -10,6 +10,11 @@ const MODEL_MAPPING_EXAMPLE = {
'gpt-4-32k-0314': 'gpt-4-32k'
};
const DEPLOYMENT_MAPPING_EXAMPLE = {
'gpt-3.5-turbo': 'gpt-35-turbo',
'gpt-4': 'custom-gpt4'
};
function type2secretPrompt(type) {
// inputs.type === 15 ? '按照如下格式输入APIKey|SecretKey' : (inputs.type === 18 ? '按照如下格式输入APPID|APISecret|APIKey' : '请输入渠道对应的鉴权密钥')
switch (type) {
@@ -43,6 +48,7 @@ const EditChannel = () => {
base_url: '',
other: '',
model_mapping: '',
deployment_mapping: '',
models: [],
groups: ['default']
};
@@ -396,6 +402,23 @@ const EditChannel = () => {
autoComplete='new-password'
/>
</Form.Field>
{
inputs.type === 3 && (
<>
<Form.Field>
<Form.TextArea
label='部署映射'
placeholder={`此项可选,为一个 JSON 字符串,键为请求中模型名称,值为要替换的部署名称,用于修改 Azure OpenAI 的 deployment 参数。如果不填此参数,则部署名称必须与模型名称一致,例如 gpt-3.5-turbo 模型对应的部署名称应该为 gpt-35-turbo。若实际的部署名称不满足此规则则可以通过该参数自定义。例如\n${JSON.stringify(DEPLOYMENT_MAPPING_EXAMPLE, null, 2)}`}
name='deployment_mapping'
onChange={handleInputChange}
value={inputs.deployment_mapping}
style={{ minHeight: 150, fontFamily: 'JetBrains Mono, Consolas' }}
autoComplete='new-password'
/>
</Form.Field>
</>
)
}
{
batch ? <Form.Field>
<Form.TextArea