src/views/ai/model/model/data.ts
@@ -1,16 +1,10 @@
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[] {
@@ -50,14 +44,12 @@
    },
    {
      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',
    },
@@ -222,13 +214,8 @@
      minWidth: 180,
    },
    {
      title: 'API 秘钥',
      title: 'API 秘钥 ID',
      field: 'keyId',
      formatter: ({ cellValue }) => {
        return (
          apiKeyList.find((apiKey) => apiKey.id === cellValue)?.name || '-'
        );
      },
      minWidth: 140,
    },
    {