From 0d3f6f1e14e4d09a65307fcbdc324b1789d86a9c Mon Sep 17 00:00:00 2001 From: zhaoying Date: Tue, 7 Apr 2026 20:55:55 +0800 Subject: [PATCH 1/2] fix(web): open_statement enabled --- web/src/views/Conversation/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/views/Conversation/index.tsx b/web/src/views/Conversation/index.tsx index 9507982a..f323c7dc 100644 --- a/web/src/views/Conversation/index.tsx +++ b/web/src/views/Conversation/index.tsx @@ -178,7 +178,7 @@ const Conversation: FC = () => { })) }) } else { - if (features?.opening_statement.enabled && features?.opening_statement?.statement) { + if (features?.opening_statement?.enabled && features?.opening_statement?.statement) { setChatList([{ role: 'assistant', content: features.opening_statement.statement, @@ -436,7 +436,7 @@ const Conversation: FC = () => { setChatList(prev => { const firstMsg = prev[0] console.log('firstMsg', firstMsg) - if (firstMsg && firstMsg.role === 'assistant' && firstMsg.content && features?.opening_statement.enabled && features?.opening_statement.statement && variables.length > 0) { + if (firstMsg && firstMsg.role === 'assistant' && firstMsg.content && features?.opening_statement?.enabled && features?.opening_statement.statement && variables.length > 0) { firstMsg.content = replaceVariables(features?.opening_statement.statement, variables as unknown as AppVariable[]) } return [firstMsg, ...prev.slice(1)] From 49bcc6131b70e69dca6bbdaca464f41b6a179646 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Tue, 7 Apr 2026 20:57:52 +0800 Subject: [PATCH 2/2] fix(web): if parent is iteration/loop and only cycle-start remains, add add-node connected to it --- .../views/Workflow/hooks/useWorkflowGraph.ts | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/web/src/views/Workflow/hooks/useWorkflowGraph.ts b/web/src/views/Workflow/hooks/useWorkflowGraph.ts index 86d6007f..98e05b25 100644 --- a/web/src/views/Workflow/hooks/useWorkflowGraph.ts +++ b/web/src/views/Workflow/hooks/useWorkflowGraph.ts @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 15:17:48 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-04-07 16:47:09 + * @Last Modified time: 2026-04-07 20:56:46 */ import { useRef, useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; @@ -725,6 +725,41 @@ export const useWorkflowGraph = ({ // Delete all collected nodes and edges if (cells.length > 0) { graphRef.current?.removeCells(cells); + + // If parent is iteration/loop and only cycle-start remains, add add-node connected to it + parentNodesToUpdate.forEach(parentNode => { + const parentShape = parentNode.shape; + if (parentShape !== 'loop-node' && parentShape !== 'iteration-node') return; + const parentData = parentNode.getData(); + const remainingChildren = graphRef.current!.getNodes().filter( + n => n.getData()?.cycle === parentData.id + ); + const cycleStartNodes = remainingChildren.filter(n => n.getData()?.type === 'cycle-start'); + if (cycleStartNodes.length === 1 && remainingChildren.length === 1) { + const cycleStartNode = cycleStartNodes[0]; + const bbox = cycleStartNode.getBBox(); + const addNode = graphRef.current!.addNode({ + ...graphNodeLibrary.addStart, + x: bbox.x + 84, + y: bbox.y + 4, + data: { + type: 'add-node', + parentId: parentNode.id, + cycle: parentData.id, + label: t('workflow.addNode'), + icon: '+', + }, + }); + parentNode.addChild(addNode); + const sourcePort = cycleStartNode.getPorts().find(p => p.group === 'right')?.id || 'right'; + const targetPort = addNode.getPorts().find(p => p.group === 'left')?.id || 'left'; + graphRef.current!.addEdge({ + source: { cell: cycleStartNode.id, port: sourcePort }, + target: { cell: addNode.id, port: targetPort }, + ...edgeAttrs, + }); + } + }); } return false; };