Update schema.ts

This commit is contained in:
clukboy 2026-04-02 11:38:42 +08:00
parent 8a90e46aae
commit 37d3afc63a
1 changed files with 30 additions and 34 deletions

View File

@ -3,61 +3,57 @@ import type { VbenFormProps } from "@vben/common-ui";
export const ModelCertificateFrom: VbenFormProps = { export const ModelCertificateFrom: VbenFormProps = {
schema: [ schema: [
{ {
fieldName: 'CertificateType', fieldName: 'certificateType',
label: '凭证类型', label: '凭证类型',
component: "Select", component: "Select",
rules: "required",
defaultValue: 'apiKey',
componentProps: { componentProps: {
options: [ options: [
{ label: 'API密钥', value: 'apiKey' }, { label: 'API密钥', value: 'apiKey' },
{ label: '其他', value: 'other' }, { label: '其他', value: 'other' },
] ],
}, },
}, },
{ {
fieldName: "modelName", fieldName: "modelProvider",
label: "模型名称", label: "模型提供商",
component: "Select",
rules: "required",
componentProps: {
options: [
{ label: '提供商A', value: 'providerA' },
{ label: '提供商B', value: 'providerB' },
],
},
dependencies: {
triggerFields: ["certificateType"],
show: (values) => values.certificateType === 'apiKey',
}
},
{
fieldName: "apiKey",
label: "API密钥",
component: "Input", component: "Input",
rules: "required", rules: "required",
dependencies: { dependencies: {
triggerFields: ["CertificateType"], triggerFields: ["certificateType"],
show: (values) => values.CertificateType === 'other', show: (values) => values.certificateType === 'apiKey',
}, },
}, },
{
fieldName: "modelType",
label: "模型类型",
component: "Select",
rules: "selectRequired",
componentProps: {
options: [
{ label: 'LLM', value: 'llm' },
{ label: 'Text Embedding', value: 'textEmbedding' },
{ label: 'Rerank', value: 'rerank' },
]
},
dependencies: {
triggerFields: ["CertificateType"],
show: (values) => values.CertificateType === 'other',
},
},
{
fieldName: "certificateName",
label: "凭证名称",
component: "Input",
},
{ {
fieldName: "baseUrl", fieldName: "baseUrl",
label: "基础URL", label: "API基础URL",
component: "Input", component: "Input",
dependencies: { dependencies: {
rules: ({ values }) => { triggerFields: ["certificateType"],
if (values.CertificateType === 'other') { rules: (values) => {
return "required"; if (values.certificateType === 'other') {
return "required"
} }
return null; return null;
}, },
triggerFields: ["CertificateType"], },
}
} }
] ]
}; };