diff --git a/web/src/pages/agent/canvas/node/data-operations-node.tsx b/web/src/pages/agent/canvas/node/data-operations-node.tsx index efd9f4e56..cb029a504 100644 --- a/web/src/pages/agent/canvas/node/data-operations-node.tsx +++ b/web/src/pages/agent/canvas/node/data-operations-node.tsx @@ -1,11 +1,22 @@ -import { IRagNode } from '@/interfaces/database/agent'; +import { BaseNode } from '@/interfaces/database/agent'; import { NodeProps } from '@xyflow/react'; +import { camelCase } from 'lodash'; +import { useTranslation } from 'react-i18next'; import { RagNode } from '.'; +import { DataOperationsFormSchemaType } from '../../form/data-operations-form'; +import { LabelCard } from './card'; + +export function DataOperationsNode({ + ...props +}: NodeProps>) { + const { data } = props; + const { t } = useTranslation(); -export function DataOperationsNode({ ...props }: NodeProps) { return ( -
select
+ + {t(`flow.operationsOptions.${camelCase(data.form?.operations)}`)} +
); } diff --git a/web/src/pages/agent/canvas/node/variable-aggregator-node.tsx b/web/src/pages/agent/canvas/node/variable-aggregator-node.tsx index a6f9ff493..1643dc600 100644 --- a/web/src/pages/agent/canvas/node/variable-aggregator-node.tsx +++ b/web/src/pages/agent/canvas/node/variable-aggregator-node.tsx @@ -1,11 +1,36 @@ -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 { VariableAggregatorFormSchemaType } from '../../form/variable-aggregator-form/schema'; +import { useGetVariableLabelOrTypeByValue } from '../../hooks/use-get-begin-query'; +import { LabelCard } from './card'; + +export function VariableAggregatorNode({ + ...props +}: NodeProps>) { + const { data } = props; + const { getLabel } = useGetVariableLabelOrTypeByValue(); -export function VariableAggregatorNode({ ...props }: NodeProps) { return ( -
VariableAggregatorNode
+ + {(x, idx) => ( +
+
+ {x.group_name} + {x.type} +
+
+ {x.variables.map((y, index) => ( + + {getLabel(y.value)} + + ))} +
+
+ )} +
); } diff --git a/web/src/pages/agent/hooks/use-build-structured-output.ts b/web/src/pages/agent/hooks/use-build-structured-output.ts index 37e4231c7..94597d348 100644 --- a/web/src/pages/agent/hooks/use-build-structured-output.ts +++ b/web/src/pages/agent/hooks/use-build-structured-output.ts @@ -153,3 +153,24 @@ export function useFindAgentStructuredOutputTypeByValue() { return findAgentStructuredOutputTypeByValue; } + +export function useFindAgentStructuredOutputLabelByValue() { + const { getNode } = useGraphStore((state) => state); + + const findAgentStructuredOutputLabel = useCallback( + (value?: string) => { + if (value) { + const operatorName = getNode(getNodeId(value ?? ''))?.data.name; + + if (operatorName) { + return operatorName + ' / ' + value?.split('@').at(1); + } + } + + return ''; + }, + [getNode], + ); + + return findAgentStructuredOutputLabel; +} diff --git a/web/src/pages/agent/hooks/use-get-begin-query.tsx b/web/src/pages/agent/hooks/use-get-begin-query.tsx index 28fd722d8..56e3216e6 100644 --- a/web/src/pages/agent/hooks/use-get-begin-query.tsx +++ b/web/src/pages/agent/hooks/use-get-begin-query.tsx @@ -20,7 +20,10 @@ import { buildBeginInputListFromObject } from '../form/begin-form/utils'; import { BeginQuery } from '../interface'; import OperatorIcon from '../operator-icon'; import useGraphStore from '../store'; -import { useFindAgentStructuredOutputTypeByValue } from './use-build-structured-output'; +import { + useFindAgentStructuredOutputLabelByValue, + useFindAgentStructuredOutputTypeByValue, +} from './use-build-structured-output'; export function useSelectBeginNodeDataInputs() { const getNode = useGraphStore((state) => state.getNode); @@ -281,6 +284,8 @@ export function useGetVariableLabelOrTypeByValue(nodeId?: string) { const flattenOptions = useFlattenQueryVariableOptions(nodeId); const findAgentStructuredOutputTypeByValue = useFindAgentStructuredOutputTypeByValue(); + const findAgentStructuredOutputLabel = + useFindAgentStructuredOutputLabelByValue(); const getItem = useCallback( (val?: string) => { @@ -291,9 +296,17 @@ export function useGetVariableLabelOrTypeByValue(nodeId?: string) { const getLabel = useCallback( (val?: string) => { - return getItem(val)?.label; + const item = getItem(val); + if (item) { + return ( +
+ {item.parentLabel} / {item.label} +
+ ); + } + return getItem(val)?.label || findAgentStructuredOutputLabel(val); }, - [getItem], + [findAgentStructuredOutputLabel, getItem], ); const getType = useCallback(