diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx index 2e85f46c2..1f43093f6 100644 --- a/web/src/pages/agent/constant/index.tsx +++ b/web/src/pages/agent/constant/index.tsx @@ -598,7 +598,7 @@ export const initialDataOperationsValues = { export const initialVariableAssignerValues = {}; -export const initialVariableAggregatorValues = {}; +export const initialVariableAggregatorValues = { outputs: {}, groups: [] }; export const CategorizeAnchorPointPositions = [ { top: 1, right: 34 }, diff --git a/web/src/pages/agent/form/components/prompt-editor/variable-picker-plugin.tsx b/web/src/pages/agent/form/components/prompt-editor/variable-picker-plugin.tsx index 3f1d080b1..d80d0c2df 100644 --- a/web/src/pages/agent/form/components/prompt-editor/variable-picker-plugin.tsx +++ b/web/src/pages/agent/form/components/prompt-editor/variable-picker-plugin.tsx @@ -36,6 +36,7 @@ import { useShowSecondaryMenu, } from '@/pages/agent/hooks/use-build-structured-output'; import { useFilterQueryVariableOptionsByTypes } from '@/pages/agent/hooks/use-get-begin-query'; +import { get } from 'lodash'; import { PromptIdentity } from '../../agent-form/use-build-prompt-options'; import { StructuredOutputSecondaryMenu } from '../structured-output-secondary-menu'; import { ProgrammaticTag } from './constant'; @@ -45,18 +46,21 @@ class VariableInnerOption extends MenuOption { value: string; parentLabel: string | JSX.Element; icon?: ReactNode; + type?: string; constructor( label: string, value: string, parentLabel: string | JSX.Element, icon?: ReactNode, + type?: string, ) { super(value); this.label = label; this.value = value; this.parentLabel = parentLabel; this.icon = icon; + this.type = type; } } @@ -126,9 +130,10 @@ function VariablePickerMenuItem({
  • selectOptionAndCleanUp(x)} - className="hover:bg-bg-card p-1 text-text-primary rounded-sm" + className="hover:bg-bg-card p-1 text-text-primary rounded-sm flex justify-between items-center" > - {x.label} + {x.label} + {get(x, 'type')}
  • ); })} @@ -146,6 +151,7 @@ export type VariablePickerMenuOptionType = { label: string; value: string; icon: ReactNode; + type?: string; }>; }; @@ -214,7 +220,13 @@ export default function VariablePickerMenuPlugin({ x.label, x.title, x.options.map((y) => { - return new VariableInnerOption(y.label, y.value, x.label, y.icon); + return new VariableInnerOption( + y.label, + y.value, + x.label, + y.icon, + y.type, + ); }), ), ); @@ -378,7 +390,7 @@ export default function VariablePickerMenuPlugin({ const nextOptions = buildNextOptions(); return anchorElementRef.current && nextOptions.length ? ReactDOM.createPortal( -
    +