From 121197215dee0a4c41fc11e52723bc22964c0e2e Mon Sep 17 00:00:00 2001 From: bill Date: Fri, 5 Jul 2024 10:43:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20click=20on=20a=20blank=20area=20of=20?= =?UTF-8?q?=E2=80=8B=E2=80=8Bthe=20canvas=20to=20hide=20the=20form=20drawe?= =?UTF-8?q?r=20#918?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/flow/canvas/index.tsx | 5 +++++ web/src/pages/flow/constant.tsx | 16 +++++++++++----- web/src/pages/flow/list/index.less | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/web/src/pages/flow/canvas/index.tsx b/web/src/pages/flow/canvas/index.tsx index ed674b3576..00029a77b3 100644 --- a/web/src/pages/flow/canvas/index.tsx +++ b/web/src/pages/flow/canvas/index.tsx @@ -62,6 +62,10 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) { [showDrawer], ); + const onPaneClick = useCallback(() => { + hideDrawer(); + }, [hideDrawer]); + const { onDrop, onDragOver, setReactFlowInstance } = useHandleDrop(); const { handleKeyUp } = useHandleKeyUp(); @@ -101,6 +105,7 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) { onDrop={onDrop} onDragOver={onDragOver} onNodeClick={onNodeClick} + onPaneClick={onPaneClick} onInit={setReactFlowInstance} onKeyUp={handleKeyUp} onSelectionChange={onSelectionChange} diff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsx index a266db7ae0..ab8bfb13ee 100644 --- a/web/src/pages/flow/constant.tsx +++ b/web/src/pages/flow/constant.tsx @@ -203,9 +203,9 @@ export const CategorizeAnchorPointPositions = [ export const RestrictedUpstreamMap = { [Operator.Begin]: [], [Operator.Categorize]: [Operator.Begin, Operator.Categorize, Operator.Answer], - [Operator.Answer]: [], - [Operator.Retrieval]: [], - [Operator.Generate]: [], + [Operator.Answer]: [Operator.Begin, Operator.Answer, Operator.Message], + [Operator.Retrieval]: [Operator.Begin, Operator.Relevant], + [Operator.Generate]: [Operator.Begin], [Operator.Message]: [ Operator.Begin, Operator.Message, @@ -214,8 +214,14 @@ export const RestrictedUpstreamMap = { Operator.RewriteQuestion, Operator.Categorize, ], - [Operator.Relevant]: [], - [Operator.RewriteQuestion]: [], + [Operator.Relevant]: [Operator.Begin, Operator.Answer], + [Operator.RewriteQuestion]: [ + Operator.Begin, + Operator.Message, + Operator.Generate, + Operator.RewriteQuestion, + Operator.Categorize, + ], }; export const NodeMap = { diff --git a/web/src/pages/flow/list/index.less b/web/src/pages/flow/list/index.less index 17f646dab1..112e57d32f 100644 --- a/web/src/pages/flow/list/index.less +++ b/web/src/pages/flow/list/index.less @@ -56,6 +56,6 @@ } .templatesBox { - // max-height: 500px; + max-height: 70vh; overflow: auto; }