更改表单模型类型逻辑

This commit is contained in:
2026-05-12 15:03:47 +08:00
parent f2266317e2
commit 34bc30a2c5
3 changed files with 23 additions and 22 deletions

View File

@@ -22,6 +22,7 @@ export interface NodeLibraryModelConfig {
export interface NodeLibraryItem { export interface NodeLibraryItem {
nodeCode: string; nodeCode: string;
nodeName: string; nodeName: string;
modelType: number;
skillOption: boolean; skillOption: boolean;
formConfig: NodeLibraryFormItem[]; formConfig: NodeLibraryFormItem[];
modelConfig: NodeLibraryModelConfig[]; modelConfig: NodeLibraryModelConfig[];

View File

@@ -1,4 +1,4 @@
<template> <template>
<el-dialog v-model="visible" title="选择模型" width="1000px" :close-on-click-modal="false" @close="handleClose"> <el-dialog v-model="visible" title="选择模型" width="1000px" :close-on-click-modal="false" @close="handleClose">
<div class="model-selector-header"> <div class="model-selector-header">
<div class="search-bar"> <div class="search-bar">
@@ -127,6 +127,7 @@ interface ModelItem {
interface Props { interface Props {
modelValue: boolean; modelValue: boolean;
defaultModel?: ModelItem | null; defaultModel?: ModelItem | null;
modelType?: number;
} }
interface Emits { interface Emits {
@@ -137,6 +138,7 @@ interface Emits {
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
modelValue: false, modelValue: false,
defaultModel: null, defaultModel: null,
modelType: 1,
}); });
const emit = defineEmits<Emits>(); const emit = defineEmits<Emits>();
@@ -207,7 +209,7 @@ const fetchModelList = async () => {
pageNum: pagination.pageNum, pageNum: pagination.pageNum,
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
modelName: searchParams.modelName || undefined, modelName: searchParams.modelName || undefined,
modelType: 1, // 只获取推理模型 modelType: props.modelType, // 使用传入的 modelType
}; };
const res: any = await getModelModuleList(params); const res: any = await getModelModuleList(params);
modelList.value = res.data?.list || []; modelList.value = res.data?.list || [];

View File

@@ -342,22 +342,8 @@
<el-input v-model="userInput" placeholder="说点什么..." class="chat-input" @keydown.enter="sendMessage" /> <el-input v-model="userInput" placeholder="说点什么..." class="chat-input" @keydown.enter="sendMessage" />
<!-- 右侧发送/暂停按钮 --> <!-- 右侧发送/暂停按钮 -->
<el-button <el-button v-if="!isCreating" type="primary" :icon="Promotion" @click="sendMessage" class="send-btn" circle />
v-if="!isCreating" <el-button v-else type="danger" :icon="VideoPause" @click="stopExecution" class="send-btn" circle />
type="primary"
:icon="Promotion"
@click="sendMessage"
class="send-btn"
circle
/>
<el-button
v-else
type="danger"
:icon="VideoPause"
@click="stopExecution"
class="send-btn"
circle
/>
</div> </div>
<!-- 已选技能标签 --> <!-- 已选技能标签 -->
@@ -513,7 +499,7 @@
<SkillSelector v-model="showCreationSkillSelector" :default-skill="selectedCreationSkill" @confirm="handleCreationSkillConfirm" /> <SkillSelector v-model="showCreationSkillSelector" :default-skill="selectedCreationSkill" @confirm="handleCreationSkillConfirm" />
<!-- 模型选择器 --> <!-- 模型选择器 -->
<ModelSelector v-model="showModelSelector" :default-model="selectedModelData" @confirm="handleModelConfirm" /> <ModelSelector v-model="showModelSelector" :default-model="selectedModelData" :model-type="currentNodeModelType" @confirm="handleModelConfirm" />
<!-- 对话模型选择器 --> <!-- 对话模型选择器 -->
<el-dialog v-model="showChatModelSelector" title="设置对话模型" width="900px" :close-on-click-modal="false"> <el-dialog v-model="showChatModelSelector" title="设置对话模型" width="900px" :close-on-click-modal="false">
@@ -758,6 +744,18 @@ const currentNodeSkillOption = computed(() => {
}); });
return skillOption; return skillOption;
}); });
// 获取当前节点的模型类型
const currentNodeModelType = computed(() => {
let modelType = 1; // 默认为推理模型
nodeLibraryGroups.value.forEach((group) => {
(group.items || []).forEach((item) => {
if (item.nodeCode === formState.nodeCode) {
modelType = item.modelType || 1;
}
});
});
return modelType;
});
// 获取当前选中模型的表单字段 // 获取当前选中模型的表单字段
const currentModelForm = computed<NodeLibraryFormItem[]>(() => { const currentModelForm = computed<NodeLibraryFormItem[]>(() => {
// 不显示模型的表单字段,返回空数组 // 不显示模型的表单字段,返回空数组
@@ -1314,9 +1312,9 @@ const stopExecution = async () => {
try { try {
// TODO: 调用终止执行的接口 // TODO: 调用终止执行的接口
// await stopExecutionApi({ sessionId: getSessionId() }); // await stopExecutionApi({ sessionId: getSessionId() });
ElMessage.warning('终止执行功能开发中...'); ElMessage.warning('终止执行功能开发中...');
// 暂时直接停止加载状态 // 暂时直接停止加载状态
isCreating.value = false; isCreating.value = false;
} catch (error) { } catch (error) {
@@ -1347,7 +1345,7 @@ const handleTreeNodeClick = async (data: TreeNode) => {
currentSessionId.value = data.sessionId || null; currentSessionId.value = data.sessionId || null;
// 标记为从工作空间进入 // 标记为从工作空间进入
isFromWorkspace.value = true; isFromWorkspace.value = true;
// 切换到创作模式 // 切换到创作模式
isCreationMode.value = true; isCreationMode.value = true;
currentWorkflowForCreation.value = res.data; currentWorkflowForCreation.value = res.data;