From 64a8cd04229f7b903913fc3dc7ef4aef267ac3bc Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 26 十月 2026 17:36:14 +0800
Subject: [PATCH] Merge branch 'dev_pro2.0' into dev_南通_苏珩
---
src/views/ai/model/model/data.ts | 88 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 73 insertions(+), 15 deletions(-)
diff --git a/src/views/ai/model/model/data.ts b/src/views/ai/model/model/data.ts
index f40e590..f7115a6 100644
--- a/src/views/ai/model/model/data.ts
+++ b/src/views/ai/model/model/data.ts
@@ -1,7 +1,9 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import { AiModelTypeEnum, CommonStatusEnum, DICT_TYPE } from '@vben/constants';
+import type { AiModelModelApi } from '#/api/ai/model/model';
+
+import { AiModelCapabilityEnum, AiModelTypeEnum, CommonStatusEnum, DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { z } from '#/adapter/form';
@@ -41,6 +43,26 @@
};
},
rules: 'required',
+ },
+ {
+ fieldName: 'capability',
+ label: '妯″瀷鑳藉姏',
+ component: 'Select',
+ componentProps: (values) => {
+ return {
+ placeholder: '璇烽�夋嫨妯″瀷鑳藉姏',
+ // 鍙湁瀵硅瘽绫诲瀷鍖哄垎鏂囨湰/瑙嗚锛屽叾浣欑被鍨嬬粺涓�鎸夋枃鏈兘鍔涘鐞�
+ disabled: !!values.id || values.type !== AiModelTypeEnum.CHAT,
+ options: getDictOptions(DICT_TYPE.AI_MODEL_CAPABILITY, 'string'),
+ allowClear: true,
+ };
+ },
+ help: '鍚屼竴绫诲瀷鍚屼竴鑳藉姏鍙兘鍚敤涓�涓ā鍨嬶紱瑙嗚鑳藉姏鐢ㄤ簬鍥剧墖璇嗗埆',
+ dependencies: {
+ triggerFields: ['type'],
+ show: (values) => values.type === AiModelTypeEnum.CHAT,
+ },
+ rules: z.string().default(AiModelCapabilityEnum.TEXT),
},
{
fieldName: 'keyId',
@@ -162,11 +184,31 @@
},
},
{
+ fieldName: 'type',
+ label: '妯″瀷绫诲瀷',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨妯″瀷绫诲瀷',
+ options: getDictOptions(DICT_TYPE.AI_MODEL_TYPE, 'number'),
+ allowClear: true,
+ },
+ },
+ {
fieldName: 'model',
label: '妯″瀷鏍囪瘑',
component: 'Input',
componentProps: {
placeholder: '璇疯緭鍏ユā鍨嬫爣璇�',
+ allowClear: true,
+ },
+ },
+ {
+ fieldName: 'capability',
+ label: '妯″瀷鑳藉姏',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨妯″瀷鑳藉姏',
+ options: getDictOptions(DICT_TYPE.AI_MODEL_CAPABILITY, 'string'),
allowClear: true,
},
},
@@ -183,23 +225,34 @@
}
/** 鍒楄〃鐨勫瓧娈� */
-export function useGridColumns(): VxeTableGridOptions['columns'] {
+export function useGridColumns(
+ onStatusChange?: (newStatus: number, row: AiModelModelApi.Model) => Promise<boolean | undefined>,
+): VxeTableGridOptions['columns'] {
return [
- {
- field: 'platform',
- title: '鎵�灞炲钩鍙�',
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.AI_PLATFORM },
- },
- minWidth: 100,
- },
{
field: 'type',
title: '妯″瀷绫诲瀷',
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.AI_MODEL_TYPE },
+ },
+ minWidth: 100,
+ },
+ {
+ field: 'capability',
+ title: '妯″瀷鑳藉姏',
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.AI_MODEL_CAPABILITY },
+ },
+ minWidth: 100,
+ },
+ {
+ field: 'platform',
+ title: '鎵�灞炲钩鍙�',
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.AI_PLATFORM },
},
minWidth: 100,
},
@@ -225,12 +278,17 @@
},
{
field: 'status',
- title: '鐘舵��',
+ title: '鍚敤',
+ minWidth: 100,
+ align: 'center',
cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.COMMON_STATUS },
+ attrs: { beforeChange: onStatusChange },
+ name: 'CellSwitch',
+ props: {
+ checkedValue: CommonStatusEnum.ENABLE,
+ unCheckedValue: CommonStatusEnum.DISABLE,
+ },
},
- minWidth: 80,
},
{
field: 'temperature',
--
Gitblit v1.9.3