更新模型类型字段名称,统一为 modelType,以提高代码一致性和可读性。涉及多个组件和接口的相应调整,确保功能正常。

This commit is contained in:
2026-05-12 16:43:46 +08:00
parent 75cc91a4fb
commit 77aaeebf1d
5 changed files with 41 additions and 33 deletions

View File

@@ -445,7 +445,12 @@
<div class="workflow-list-vertical" v-loading="workflowListLoading">
<el-empty v-if="!workflowListLoading && templateWorkflowList.length === 0" description="暂无模板" :image-size="60" />
<div v-else class="workflow-list-scroll">
<div v-for="workflow in templateWorkflowList" :key="workflow.id" class="workflow-item" @click="isSuperAdmin ? editWorkflow(workflow) : useWorkflow(workflow)">
<div
v-for="workflow in templateWorkflowList"
:key="workflow.id"
class="workflow-item"
@click="isSuperAdmin ? editWorkflow(workflow) : useWorkflow(workflow)"
>
<div class="workflow-item-content">
<div class="workflow-item-name">{{ workflow.flowName || workflow.flowTemplateName }}</div>
<div class="workflow-item-desc">{{ workflow.description || '暂无描述' }}</div>
@@ -520,12 +525,14 @@
v-for="model in filteredChatModels"
:key="model.id"
class="chat-model-card"
:class="{ selected: selectedChatModel?.id === model.id }"
:class="{ selected: selectedChatModel?.id === model.id, 'is-chat-model': model.isChatModel === 1 }"
@click="selectedChatModel = model"
>
<div class="chat-model-name">{{ model.modelName }}</div>
<div class="chat-model-url">{{ model.baseUrl }}</div>
<el-icon v-if="selectedChatModel?.id === model.id" class="check-icon" color="#67c23a"><CircleCheck /></el-icon>
<el-icon v-if="selectedChatModel?.id === model.id || model.isChatModel === 1" class="check-icon" color="#67c23a"
><CircleCheck
/></el-icon>
</div>
</div>
</div>
@@ -1010,7 +1017,7 @@ const fetchChatModelList = async () => {
const res: any = await getModelModuleList({
pageNum: chatModelPagination.pageNum,
pageSize: chatModelPagination.pageSize,
modelsType: 1, // 传递 modelsType=1 给后端,获取推理模型
modelType: 1, // 传递 modelType=1 给后端,获取推理模型
modelName: chatModelSearchKeyword.value || undefined,
});
chatModelList.value = res.data?.list || [];
@@ -2385,7 +2392,7 @@ onMounted(async () => {
initLogicFlow();
await getNodeLibrary();
await fetchWorkflowList();
// 获取当前用户角色
try {
const res: any = await checkIsSuperAdmin();
@@ -3562,7 +3569,8 @@ onBeforeUnmount(() => {
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
transform: translateY(-2px);
}
.chat-model-card.selected {
.chat-model-card.selected,
.chat-model-card.is-chat-model {
border-color: #67c23a;
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
box-shadow: 0 4px 12px rgba(103, 194, 58, 0.2);

View File

@@ -17,8 +17,8 @@
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="模型类型" prop="modelsType">
<el-select v-model="state.ruleForm.modelsType" placeholder="请选择模型类型" clearable style="width: 100%">
<el-form-item label="模型类型" prop="modelType">
<el-select v-model="state.ruleForm.modelType" placeholder="请选择模型类型" clearable style="width: 100%">
<el-option v-for="t in modelTypeOptions" :key="String(t.id)" :label="t.label" :value="typeOptionValue(t.id)"></el-option>
</el-select>
</el-form-item>
@@ -279,7 +279,7 @@ const state = reactive({
ruleForm: {
id: '',
modelName: '',
modelsType: null as number | string | null,
modelType: null as number | string | null,
baseUrl: '',
httpMethod: 'POST',
headMsg: '',
@@ -299,7 +299,7 @@ const state = reactive({
},
rules: {
modelName: [{ required: true, message: '请输入模型名称', trigger: 'blur' }],
modelsType: [
modelType: [
{
validator: (_rule: unknown, value: unknown, callback: (e?: Error) => void) => {
if (value === null || value === undefined || value === '') {
@@ -528,7 +528,7 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
state.ruleForm = {
id: row.id as string,
modelName: String(row.modelName ?? ''),
modelsType: row.modelsType !== undefined && row.modelsType !== null ? typeOptionValue(row.modelsType as number | string) : null,
modelType: row.modelType !== undefined && row.modelType !== null ? typeOptionValue(row.modelType as number | string) : null,
baseUrl: String(row.baseUrl ?? ''),
httpMethod: String(row.httpMethod || 'POST'),
headMsg: String(row.headMsg || ''),
@@ -605,7 +605,7 @@ const openDialog = async (type: string, row?: Record<string, unknown>) => {
state.ruleForm = {
id: '',
modelName: '',
modelsType: null,
modelType: null,
baseUrl: '',
httpMethod: 'POST',
headMsg: '',
@@ -659,7 +659,7 @@ const onSubmit = () => {
const responseBody = responseBodyField ? { [responseBodyField.key.trim()]: responseBodyField.value } : {};
const submitData = {
modelName: state.ruleForm.modelName,
modelsType: state.ruleForm.modelsType as number | string,
modelType: state.ruleForm.modelType as number | string,
baseUrl: state.ruleForm.baseUrl,
httpMethod: state.ruleForm.httpMethod || 'POST',
headMsg: state.ruleForm.headMsg,

View File

@@ -32,7 +32,7 @@
<el-table-column prop="modelName" label="模型名称" show-overflow-tooltip></el-table-column>
<el-table-column label="模型类型" width="120" show-overflow-tooltip>
<template #default="{ row }">
{{ resolveModelTypeLabel(row.modelsType) }}
{{ resolveModelTypeLabel(row.modelType) }}
</template>
</el-table-column>
<!-- <el-table-column prop="baseUrl" label="模型服务地址" show-overflow-tooltip width="200"></el-table-column> -->
@@ -59,7 +59,7 @@
<!-- 非管理员才显示会话模型按钮 -->
<template v-if="!isSuperAdmin">
<el-button
v-if="isInferenceModel(scope.row.modelsType) && Number(scope.row.isChatModel) !== 1"
v-if="isInferenceModel(scope.row.modelType) && Number(scope.row.isChatModel) !== 1"
size="small"
text
type="warning"
@@ -68,7 +68,7 @@
设为会话模型
</el-button>
<el-tag
v-if="isInferenceModel(scope.row.modelsType) && Number(scope.row.isChatModel) === 1"
v-if="isInferenceModel(scope.row.modelType) && Number(scope.row.isChatModel) === 1"
type="success"
effect="dark"
size="default"
@@ -181,13 +181,13 @@ const checkAdminStatus = async () => {
};
// 判断是否为推理模型(只有推理模型才能设置为会话模型)
const isInferenceModel = (modelsType: number | string | undefined | null) => {
if (modelsType === undefined || modelsType === null || modelsType === '') {
const isInferenceModel = (modelType: number | string | undefined | null) => {
if (modelType === undefined || modelType === null || modelType === '') {
return false;
}
// 查找模型类型标签,判断是否为"推理模型"
const typeInfo = state.modelTypes.find((t) => String(t.id) === String(modelsType));
return typeInfo?.label === '推理模型' || String(modelsType) === '1';
const typeInfo = state.modelTypes.find((t) => String(t.id) === String(modelType));
return typeInfo?.label === '推理模型' || String(modelType) === '1';
};
// 设置为会话模型
@@ -227,7 +227,7 @@ const handleCreatePrivateModelAndSetChat = async () => {
const systemModel = systemModelToClone.value;
const createParams = {
modelName: apiKeyForm.modelName,
modelsType: systemModel.modelsType,
modelType: systemModel.modelType,
baseUrl: systemModel.baseUrl,
httpMethod: systemModel.httpMethod || 'POST',
headMsg: systemModel.headMsg || '',
@@ -266,12 +266,12 @@ const handleCreatePrivateModelAndSetChat = async () => {
}
};
const resolveModelTypeLabel = (modelsType: number | string | undefined | null) => {
if (modelsType === undefined || modelsType === null || modelsType === '') {
const resolveModelTypeLabel = (modelType: number | string | undefined | null) => {
if (modelType === undefined || modelType === null || modelType === '') {
return '—';
}
const hit = state.modelTypes.find((t) => String(t.id) === String(modelsType));
return hit?.label ?? String(modelsType);
const hit = state.modelTypes.find((t) => String(t.id) === String(modelType));
return hit?.label ?? String(modelType);
};
const loadModelTypes = async () => {