mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-14 17:08:31 +08:00
### What problem does this PR solve? Refactor: UmiJs -> Vite+React ### Type of change - [x] Refactoring --------- Co-authored-by: Liu An <asiro@qq.com>
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { useTheme } from '@/components/theme-provider';
|
|
import { IRewriteNode } from '@/interfaces/database/flow';
|
|
import { Handle, NodeProps, Position } from '@xyflow/react';
|
|
import classNames from 'classnames';
|
|
import { get } from 'lodash';
|
|
import { memo } from 'react';
|
|
import { LLMLabelCard } from './card';
|
|
import { LeftHandleStyle, RightHandleStyle } from './handle-icon';
|
|
import styles from './index.module.less';
|
|
import NodeHeader from './node-header';
|
|
|
|
function InnerRewriteNode({
|
|
id,
|
|
data,
|
|
isConnectable = true,
|
|
selected,
|
|
}: NodeProps<IRewriteNode>) {
|
|
const { theme } = useTheme();
|
|
return (
|
|
<section
|
|
className={classNames(
|
|
styles.logicNode,
|
|
theme === 'dark' ? styles.dark : '',
|
|
{
|
|
[styles.selectedNode]: selected,
|
|
},
|
|
)}
|
|
>
|
|
<Handle
|
|
id="c"
|
|
type="source"
|
|
position={Position.Left}
|
|
isConnectable={isConnectable}
|
|
className={styles.handle}
|
|
style={LeftHandleStyle}
|
|
></Handle>
|
|
<Handle
|
|
type="source"
|
|
position={Position.Right}
|
|
isConnectable={isConnectable}
|
|
className={styles.handle}
|
|
style={RightHandleStyle}
|
|
id="b"
|
|
></Handle>
|
|
|
|
<NodeHeader
|
|
id={id}
|
|
name={data.name}
|
|
label={data.label}
|
|
className={styles.nodeHeader}
|
|
></NodeHeader>
|
|
|
|
<LLMLabelCard llmId={get(data, 'form.llm_id')}></LLMLabelCard>
|
|
</section>
|
|
);
|
|
}
|
|
|
|
export const RewriteNode = memo(InnerRewriteNode);
|