新增推理模型判断逻辑和会话模型开关显示
- 在模型配置页面中添加 `isInferenceModel` 函数,用于判断模型类型是否为推理模型。 - 根据模型类型动态显示会话模型开关,提升用户交互体验。
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user