import { NodeCollapsible } from '@/components/collapse'; import { RAGFlowAvatar } from '@/components/ragflow-avatar'; import { useFetchKnowledgeList } from '@/hooks/use-knowledge-request'; import { IRetrievalNode } from '@/interfaces/database/flow'; import { NodeProps, Position } from '@xyflow/react'; import classNames from 'classnames'; import { get } from 'lodash'; import { memo } from 'react'; import { NodeHandleId } from '../../constant'; import { useGetVariableLabelOrTypeByValue } from '../../hooks/use-get-begin-query'; import { CommonHandle, LeftEndHandle } from './handle'; import styles from './index.less'; import NodeHeader from './node-header'; import { NodeWrapper } from './node-wrapper'; import { ToolBar } from './toolbar'; function InnerRetrievalNode({ id, data, isConnectable = true, selected, }: NodeProps) { const knowledgeBaseIds: string[] = get(data, 'form.kb_ids', []); const { list: knowledgeList } = useFetchKnowledgeList(true); const { getLabel } = useGetVariableLabelOrTypeByValue({ nodeId: id }); return ( 0, })} > {(id) => { const item = knowledgeList.find((y) => id === y.id); const label = getLabel(id); return (
{label || item?.name}
); }}
); } export const RetrievalNode = memo(InnerRetrievalNode);