mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Display variables in the variable assignment node. #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { NodeCollapsible } from '@/components/collapse';
|
|
import { BaseNode } from '@/interfaces/database/agent';
|
|
import { NodeProps } from '@xyflow/react';
|
|
import { RagNode } from '.';
|
|
import { VariableAssignerFormSchemaType } from '../../form/variable-assigner-form';
|
|
import { useGetVariableLabelOrTypeByValue } from '../../hooks/use-get-begin-query';
|
|
import { LabelCard } from './card';
|
|
|
|
export function VariableAssignerNode({
|
|
...props
|
|
}: NodeProps<BaseNode<VariableAssignerFormSchemaType>>) {
|
|
const { data } = props;
|
|
const { getLabel } = useGetVariableLabelOrTypeByValue();
|
|
|
|
return (
|
|
<RagNode {...props}>
|
|
<NodeCollapsible items={data.form?.variables}>
|
|
{(x, idx) => (
|
|
<section key={idx} className="space-y-1">
|
|
<LabelCard key={idx} className="flex justify-between gap-2">
|
|
<span className="flex truncate min-w-0">
|
|
{getLabel(x.variable)}
|
|
</span>
|
|
<span className="border px-1 rounded-sm">{x.operator}</span>
|
|
</LabelCard>
|
|
</section>
|
|
)}
|
|
</NodeCollapsible>
|
|
</RagNode>
|
|
);
|
|
}
|