mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 16:33:49 +00:00
@@ -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';
|
|||||||
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,31 +165,38 @@ const NodeCard = (props: Props) => {
|
|||||||
|
|
||||||
{/* avatar and name */}
|
{/* avatar and name */}
|
||||||
<Flex alignItems={'center'}>
|
<Flex alignItems={'center'}>
|
||||||
<Box
|
{node?.flowNodeType !== FlowNodeTypeEnum.stopTool && (
|
||||||
mr={2}
|
<Box
|
||||||
cursor={'pointer'}
|
mr={2}
|
||||||
rounded={'sm'}
|
cursor={'pointer'}
|
||||||
_hover={{ bg: 'myGray.200' }}
|
rounded={'sm'}
|
||||||
onClick={() => {
|
_hover={{ bg: 'myGray.200' }}
|
||||||
onChangeNode({
|
onClick={() => {
|
||||||
nodeId,
|
onChangeNode({
|
||||||
type: 'attr',
|
nodeId,
|
||||||
key: 'isFolded',
|
type: 'attr',
|
||||||
value: !isFolded
|
key: 'isFolded',
|
||||||
});
|
value: !isFolded
|
||||||
}}
|
});
|
||||||
>
|
}}
|
||||||
{!isFolded ? (
|
>
|
||||||
<MyIcon name={'core/chat/chevronDown'} w={'24px'} h={'24px'} color={'myGray.500'} />
|
{!isFolded ? (
|
||||||
) : (
|
<MyIcon
|
||||||
<MyIcon
|
name={'core/chat/chevronDown'}
|
||||||
name={'core/chat/chevronRight'}
|
w={'24px'}
|
||||||
w={'24px'}
|
h={'24px'}
|
||||||
h={'24px'}
|
color={'myGray.500'}
|
||||||
color={'myGray.500'}
|
/>
|
||||||
/>
|
) : (
|
||||||
)}
|
<MyIcon
|
||||||
</Box>
|
name={'core/chat/chevronRight'}
|
||||||
|
w={'24px'}
|
||||||
|
h={'24px'}
|
||||||
|
color={'myGray.500'}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</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) => {
|
|||||||
}, [
|
}, [
|
||||||
showToolHandle,
|
showToolHandle,
|
||||||
nodeId,
|
nodeId,
|
||||||
|
node?.flowNodeType,
|
||||||
|
isFolded,
|
||||||
avatar,
|
avatar,
|
||||||
t,
|
t,
|
||||||
name,
|
name,
|
||||||
@@ -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) => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}, [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) => {
|
|||||||
{Header}
|
{Header}
|
||||||
{!isFolded && children}
|
{!isFolded && children}
|
||||||
{RenderHandle}
|
{RenderHandle}
|
||||||
|
{RenderToolHandle}
|
||||||
|
|
||||||
<EditTitleModal maxLength={20} />
|
<EditTitleModal maxLength={20} />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
Reference in New Issue
Block a user