更新模型类型字段名称,统一为 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

@@ -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 () => {