| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { AiModelApiKeyApi } from '#/api/ai/model/apiKey'; |
| | | |
| | | import { AiModelTypeEnum, CommonStatusEnum, DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getApiKeySimpleList } from '#/api/ai/model/apiKey'; |
| | | |
| | | /** 关联数据 */ |
| | | let apiKeyList: AiModelApiKeyApi.ApiKey[] = []; |
| | | getApiKeySimpleList().then((data) => (apiKeyList = data)); |
| | | |
| | | /** 新增/修改的表单 */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | |
| | | }, |
| | | { |
| | | fieldName: 'keyId', |
| | | label: 'API 秘钥', |
| | | component: 'ApiSelect', |
| | | label: 'API 秘钥 ID', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | placeholder: '请选择 API 秘钥', |
| | | api: getApiKeySimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | allowClear: true, |
| | | class: '!w-full', |
| | | placeholder: '请输入 API 秘钥 ID', |
| | | min: 0, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | |
| | | minWidth: 180, |
| | | }, |
| | | { |
| | | title: 'API 秘钥', |
| | | title: 'API 秘钥 ID', |
| | | field: 'keyId', |
| | | formatter: ({ cellValue }) => { |
| | | return ( |
| | | apiKeyList.find((apiKey) => apiKey.id === cellValue)?.name || '-' |
| | | ); |
| | | }, |
| | | minWidth: 140, |
| | | }, |
| | | { |