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)
This commit is contained in:
@ -1,11 +1,31 @@
|
||||
import { IRagNode } from '@/interfaces/database/agent';
|
||||
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();
|
||||
|
||||
export function VariableAssignerNode({ ...props }: NodeProps<IRagNode>) {
|
||||
return (
|
||||
<RagNode {...props}>
|
||||
<section>select</section>
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user