From 52340fcd94f0519aacc0c926e321204f996210cd Mon Sep 17 00:00:00 2001 From: 2910410219 <2910410219@qq.com> Date: Tue, 9 Jun 2026 17:51:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8F=90=E7=A4=BA=E8=AF=8D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=9B=B8=E5=85=B3=E5=8F=98=E9=87=8F=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8F=90=E7=A4=BA=E8=AF=8D=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=8C=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=8F=90=E7=A4=BA=E8=AF=8D=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creation/component/PromptSelector.vue | 480 +----------------- src/views/settings/creation/index.vue | 49 +- 2 files changed, 36 insertions(+), 493 deletions(-) diff --git a/src/views/settings/creation/component/PromptSelector.vue b/src/views/settings/creation/component/PromptSelector.vue index 1694ef4..125ac92 100644 --- a/src/views/settings/creation/component/PromptSelector.vue +++ b/src/views/settings/creation/component/PromptSelector.vue @@ -1,218 +1,45 @@ diff --git a/src/views/settings/creation/index.vue b/src/views/settings/creation/index.vue index cb8fc63..b48070f 100644 --- a/src/views/settings/creation/index.vue +++ b/src/views/settings/creation/index.vue @@ -46,11 +46,11 @@ - 选择提示词 + 编辑提示词 -
+
- {{ selectedPrompt.prompt ? selectedPrompt.prompt.substring(0, 50) + '...' : '提示词' }} + {{ promptContent.length > 50 ? `${promptContent.substring(0, 50)}...` : promptContent }}
@@ -606,7 +606,7 @@ /> - + @@ -825,7 +825,6 @@ import SkillSelector from '/@/components/skill/NodeSkillSelector.vue'; import ModelSelector from '/@/components/model/ModelSelector.vue'; import SaveWorkflowDialog from './component/SaveWorkflowDialog.vue'; import PromptSelector from './component/PromptSelector.vue'; -import type { PromptItem } from '/@/api/settings/promptManager'; import type { SkillItem } from '/@/api/settings/skill'; import { downloadToFile, @@ -893,7 +892,7 @@ const selectedModel = ref(''); const showSkillSelector = ref(false); const selectedSkill = ref(null); const showPromptSelector = ref(false); -const selectedPrompt = ref(null); +const promptContent = ref(''); const isSaveFileEnabled = ref(false); const saving = ref(false); const leftPanelTab = ref('selected'); // 默认显示"当前选中"Tab @@ -1344,7 +1343,7 @@ const workflowDsl = computed(() => ({ : null, outputConfig: Array.isArray(n.properties?.outputConfig) ? n.properties.outputConfig : null, isSaveFile: n.properties?.isSaveFileEnabled ?? null, - promptContent: n.properties?.promptData?.prompt || null, + promptContent: n.properties?.promptContent || '', outputResult: null, })), edges: flowDsl.value.edges.map((e) => ({ @@ -1515,13 +1514,13 @@ const handleRemoveModel = () => { selectedModel.value = ''; selectedModelData.value = null; }; -// 处理提示词选择确认 -const handlePromptConfirm = (prompt: PromptItem) => { - selectedPrompt.value = prompt; +// 处理提示词输入确认 +const handlePromptConfirm = (value: string) => { + promptContent.value = value; }; -// 移除已选择的提示词 +// 移除已填写的提示词 const handleRemovePrompt = () => { - selectedPrompt.value = null; + promptContent.value = ''; }; // 获取对话模型列表 const fetchChatModelList = async () => { @@ -3401,12 +3400,8 @@ watch( selectedSkill.value = null; } - // 恢复提示词信息 - if (e?.properties?.promptData) { - selectedPrompt.value = e.properties.promptData; - } else { - selectedPrompt.value = null; - } + // 恢复提示词内容 + promptContent.value = String(e?.properties?.promptContent || ''); // 恢复对话模式状态 isSaveFileEnabled.value = e?.properties?.isSaveFileEnabled === true; @@ -3491,7 +3486,7 @@ const applySelected = () => { 'inputSource', 'formConfig', 'skillName', - 'promptData', + 'promptContent', 'isSaveFileEnabled', 'width', 'height', @@ -3547,11 +3542,11 @@ const applySelected = () => { delete p.skillName; } - // 保存提示词选择状态 - if (selectedPrompt.value) { - p.promptData = selectedPrompt.value; + // 保存提示词内容 + if (promptContent.value.trim()) { + p.promptContent = promptContent.value.trim(); } else { - delete p.promptData; + delete p.promptContent; } // 保存对话模式状态 @@ -3981,7 +3976,7 @@ const loadWorkflowFromDsl = (dsl: any) => { inputSource: n.inputSource || null, // 加载提示词和保存文件配置 isSaveFileEnabled: n.isSaveFile ?? false, - promptData: n.promptContent ? { id: 0, prompt: n.promptContent, nodeType: n.nodeCode } : null, + promptContent: n.promptContent || '', }, }; }); @@ -4033,8 +4028,8 @@ watch(selectedElement, (newElement) => { selectedSkill.value = null; } - // 从节点属性中恢复提示词选择状态 - selectedPrompt.value = newElement.properties.promptData || null; + // 从节点属性中恢复提示词内容 + promptContent.value = String(newElement.properties.promptContent || ''); // 从节点属性中恢复对话模式状态 isSaveFileEnabled.value = newElement.properties.isSaveFileEnabled === true; @@ -4043,7 +4038,7 @@ watch(selectedElement, (newElement) => { selectedModel.value = ''; selectedModelData.value = null; selectedSkill.value = null; - selectedPrompt.value = null; + promptContent.value = ''; isSaveFileEnabled.value = false; } });