Commit aee5de29 by heheer Committed by GitHub

fix: tool node fold (#2811)

* fix: tool node fold

* delete console
parent 78d15c2a
...@@ -34,8 +34,6 @@ const NodeTools = ({ data, selected }: NodeProps<FlowNodeItemType>) => { ...@@ -34,8 +34,6 @@ const NodeTools = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
text={t('common:core.workflow.tool.Select Tool')} text={t('common:core.workflow.tool.Select Tool')}
/> />
</Box> </Box>
<ToolSourceHandle />
</Box> </Box>
</NodeCard> </NodeCard>
); );
......
...@@ -9,7 +9,7 @@ import { useToast } from '@fastgpt/web/hooks/useToast'; ...@@ -9,7 +9,7 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant'; import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
import { useConfirm } from '@fastgpt/web/hooks/useConfirm'; import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
import { LOGO_ICON } from '@fastgpt/global/common/system/constants'; import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
import { ToolTargetHandle } from './Handle/ToolHandle'; import { ToolSourceHandle, ToolTargetHandle } from './Handle/ToolHandle';
import { useEditTextarea } from '@fastgpt/web/hooks/useEditTextarea'; import { useEditTextarea } from '@fastgpt/web/hooks/useEditTextarea';
import { ConnectionSourceHandle, ConnectionTargetHandle } from './Handle/ConnectionHandle'; import { ConnectionSourceHandle, ConnectionTargetHandle } from './Handle/ConnectionHandle';
import { useDebug } from '../../hooks/useDebug'; import { useDebug } from '../../hooks/useDebug';
...@@ -165,6 +165,7 @@ const NodeCard = (props: Props) => { ...@@ -165,6 +165,7 @@ const NodeCard = (props: Props) => {
{/* avatar and name */} {/* avatar and name */}
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
{node?.flowNodeType !== FlowNodeTypeEnum.stopTool && (
<Box <Box
mr={2} mr={2}
cursor={'pointer'} cursor={'pointer'}
...@@ -180,7 +181,12 @@ const NodeCard = (props: Props) => { ...@@ -180,7 +181,12 @@ const NodeCard = (props: Props) => {
}} }}
> >
{!isFolded ? ( {!isFolded ? (
<MyIcon name={'core/chat/chevronDown'} w={'24px'} h={'24px'} color={'myGray.500'} /> <MyIcon
name={'core/chat/chevronDown'}
w={'24px'}
h={'24px'}
color={'myGray.500'}
/>
) : ( ) : (
<MyIcon <MyIcon
name={'core/chat/chevronRight'} name={'core/chat/chevronRight'}
...@@ -190,6 +196,7 @@ const NodeCard = (props: Props) => { ...@@ -190,6 +196,7 @@ const NodeCard = (props: Props) => {
/> />
)} )}
</Box> </Box>
)}
<Avatar src={avatar} borderRadius={'sm'} objectFit={'contain'} w={'30px'} h={'30px'} /> <Avatar src={avatar} borderRadius={'sm'} objectFit={'contain'} w={'30px'} h={'30px'} />
<Box ml={3} fontSize={'md'} fontWeight={'medium'}> <Box ml={3} fontSize={'md'} fontWeight={'medium'}>
{t(name as any)} {t(name as any)}
...@@ -272,6 +279,8 @@ const NodeCard = (props: Props) => { ...@@ -272,6 +279,8 @@ const NodeCard = (props: Props) => {
}, [ }, [
showToolHandle, showToolHandle,
nodeId, nodeId,
node?.flowNodeType,
isFolded,
avatar, avatar,
t, t,
name, name,
...@@ -283,10 +292,9 @@ const NodeCard = (props: Props) => { ...@@ -283,10 +292,9 @@ const NodeCard = (props: Props) => {
nodeList, nodeList,
intro, intro,
ConfirmSyncModal, ConfirmSyncModal,
onOpenCustomTitleModal,
onChangeNode, onChangeNode,
toast, onOpenCustomTitleModal,
isFolded toast
]); ]);
const RenderHandle = useMemo(() => { const RenderHandle = useMemo(() => {
return ( return (
...@@ -296,6 +304,10 @@ const NodeCard = (props: Props) => { ...@@ -296,6 +304,10 @@ const NodeCard = (props: Props) => {
</> </>
); );
}, [nodeId, isFolded]); }, [nodeId, isFolded]);
const RenderToolHandle = useMemo(
() => (node?.flowNodeType === FlowNodeTypeEnum.tools ? <ToolSourceHandle /> : null),
[node?.flowNodeType]
);
return ( return (
<Flex <Flex
...@@ -337,6 +349,7 @@ const NodeCard = (props: Props) => { ...@@ -337,6 +349,7 @@ const NodeCard = (props: Props) => {
{Header} {Header}
{!isFolded && children} {!isFolded && children}
{RenderHandle} {RenderHandle}
{RenderToolHandle}
<EditTitleModal maxLength={20} /> <EditTitleModal maxLength={20} />
</Flex> </Flex>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment