feat:【ele】【ai】modal 部分的代码迁移

This commit is contained in:
YunaiV
2025-10-26 16:41:03 +08:00
parent fc6a467e63
commit 86cae454d1
11 changed files with 14 additions and 25 deletions

View File

@@ -155,7 +155,6 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber',
componentProps: {
placeholder: '请输入角色排序',
class: 'w-full',
},
dependencies: {
triggerFields: ['formType'],

View File

@@ -8,12 +8,9 @@ import { getDictOptions } from '@vben/hooks';
import { z } from '#/adapter/form';
import { getApiKeySimpleList } from '#/api/ai/model/apiKey';
/** 关联数据 */
let apiKeyList: AiModelApiKeyApi.ApiKey[] = [];
async function getApiKeyList() {
apiKeyList = await getApiKeySimpleList();
}
getApiKeyList();
getApiKeySimpleList().then((data) => (apiKeyList = data));
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -88,7 +85,6 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber',
componentProps: {
placeholder: '请输入模型排序',
class: 'w-full',
},
rules: 'required',
},
@@ -109,7 +105,6 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber',
componentProps: {
placeholder: '请输入温度参数',
class: 'w-full',
min: 0,
max: 2,
},
@@ -129,7 +124,6 @@ export function useFormSchema(): VbenFormSchema[] {
min: 0,
max: 8192,
placeholder: '请输入回复数 Token 数',
class: 'w-full',
},
dependencies: {
triggerFields: ['type'],
@@ -147,7 +141,6 @@ export function useFormSchema(): VbenFormSchema[] {
min: 0,
max: 20,
placeholder: '请输入上下文数量',
class: 'w-full',
},
dependencies: {
triggerFields: ['type'],

View File

@@ -136,7 +136,8 @@ export function useFormSchema(): VbenFormSchema[] {
label: '是否公开',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'), },
options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'),
},
defaultValue: true,
dependencies: {
triggerFields: ['formType'],
@@ -153,7 +154,7 @@ export function useFormSchema(): VbenFormSchema[] {
componentProps: {
placeholder: '请输入角色排序',
controlsPosition: 'right',
class: 'w-full',
class: '!w-full',
},
dependencies: {
triggerFields: ['formType'],
@@ -168,7 +169,8 @@ export function useFormSchema(): VbenFormSchema[] {
label: '开启状态',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), },
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
},
dependencies: {
triggerFields: ['formType'],
show: (values) => {

View File

@@ -37,7 +37,6 @@ function handleEdit(row: AiModelChatRoleApi.ChatRole) {
async function handleDelete(row: AiModelChatRoleApi.ChatRole) {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting', [row.name]),
duration: 0,
});
try {
await deleteChatRole(row.id!);

View File

@@ -5,7 +5,7 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { ElMessage as message } from 'element-plus';
import { ElMessage } from 'element-plus';
import { useVbenForm } from '#/adapter/form';
import {

View File

@@ -8,12 +8,9 @@ import { getDictOptions } from '@vben/hooks';
import { z } from '#/adapter/form';
import { getApiKeySimpleList } from '#/api/ai/model/apiKey';
/** 关联数据 */
let apiKeyList: AiModelApiKeyApi.ApiKey[] = [];
async function getApiKeyList() {
apiKeyList = await getApiKeySimpleList();
}
getApiKeyList();
getApiKeySimpleList().then((data) => (apiKeyList = data));
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {

View File

@@ -37,7 +37,6 @@ function handleEdit(row: AiModelModelApi.Model) {
async function handleDelete(row: AiModelModelApi.Model) {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting', [row.name]),
duration: 0,
});
try {
await deleteModel(row.id!);

View File

@@ -5,7 +5,7 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { ElMessage as message } from 'element-plus';
import { ElMessage } from 'element-plus';
import { useVbenForm } from '#/adapter/form';
import { createModel, getModel, updateModel } from '#/api/ai/model/model';

View File

@@ -39,7 +39,8 @@ export function useFormSchema(): VbenFormSchema[] {
label: '状态',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), },
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
},
defaultValue: CommonStatusEnum.ENABLE,
},
];

View File

@@ -37,7 +37,6 @@ function handleEdit(row: AiModelToolApi.Tool) {
async function handleDelete(row: AiModelToolApi.Tool) {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting', [row.name]),
duration: 0,
});
try {
await deleteTool(row.id!);

View File

@@ -5,7 +5,7 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { ElMessage as message } from 'element-plus';
import { ElMessage } from 'element-plus';
import { useVbenForm } from '#/adapter/form';
import { createTool, getTool, updateTool } from '#/api/ai/model/tool';