Skip to content

Commit

Permalink
feat: click on a blank area of ​​the canvas to hide the form drawer #918
Browse files Browse the repository at this point in the history
 (#1384)

### What problem does this PR solve?
feat: click on a blank area of ​​the canvas to hide the form drawer #918

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
  • Loading branch information
cike8899 authored Jul 5, 2024
1 parent cf542e8 commit a3f4258
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions web/src/pages/flow/canvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
[showDrawer],
);

const onPaneClick = useCallback(() => {
hideDrawer();
}, [hideDrawer]);

const { onDrop, onDragOver, setReactFlowInstance } = useHandleDrop();

const { handleKeyUp } = useHandleKeyUp();
Expand Down Expand Up @@ -101,6 +105,7 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
onDrop={onDrop}
onDragOver={onDragOver}
onNodeClick={onNodeClick}
onPaneClick={onPaneClick}
onInit={setReactFlowInstance}
onKeyUp={handleKeyUp}
onSelectionChange={onSelectionChange}
Expand Down
16 changes: 11 additions & 5 deletions web/src/pages/flow/constant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/flow/list/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
}

.templatesBox {
// max-height: 500px;
max-height: 70vh;
overflow: auto;
}

0 comments on commit a3f4258

Please sign in to comment.