新增推理模型判断逻辑和会话模型开关显示

- 在模型配置页面中添加 `isInferenceModel` 函数,用于判断模型类型是否为推理模型。
- 根据模型类型动态显示会话模型开关,提升用户交互体验。
This commit is contained in:
2026-05-12 00:42:49 +08:00
parent 88c9d08e95
commit fe24948ce9

View File

@@ -38,10 +38,12 @@
<el-table-column label="会话模型" width="110" align="center">
<template #default="{ row }">
<el-switch
v-if="isInferenceModel(row.modelsType)"
size="small"
:model-value="Number(row.isChatModel) === 1"
:before-change="() => onChatModelSwitchRequest(row)"
/>
<span v-else style="color: #999;">—</span>
</template>
</el-table-column>
<el-table-column prop="enabled" label="状态" width="100">
@@ -108,6 +110,16 @@ const state = reactive({
},
});
// 判断是否为推理模型(只有推理模型才显示会话模型开关)
const isInferenceModel = (modelsType: number | string | undefined | null) => {
if (modelsType === undefined || modelsType === null || modelsType === '') {
return false;
}
// 查找模型类型标签,判断是否为"推理模型"
const typeInfo = state.modelTypes.find((t) => String(t.id) === String(modelsType));
return typeInfo?.label === '推理模型' || String(modelsType) === '1';
};
// 会话模型开关切换
const onChatModelSwitchRequest = async (row: { id?: number | string; isChatModel?: number }) => {
try {