{label || item?.name}
diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx
index 3a161d87d..87217a999 100644
--- a/web/src/pages/agent/constant/index.tsx
+++ b/web/src/pages/agent/constant/index.tsx
@@ -5,6 +5,7 @@ import {
import {
AgentGlobals,
AgentGlobalsSysQueryWithBrace,
+ AgentStructuredOutputField,
CodeTemplateStrMap,
ComparisonOperator,
Operator,
@@ -12,7 +13,11 @@ import {
SwitchOperatorOptions,
initialLlmBaseValues,
} from '@/constants/agent';
-export { Operator } from '@/constants/agent';
+export {
+ AgentStructuredOutputField,
+ JsonSchemaDataType,
+ Operator,
+} from '@/constants/agent';
export * from './pipeline';
@@ -441,8 +446,6 @@ export const initialCodeValues = {
export const initialWaitingDialogueValues = {};
-export const AgentStructuredOutputField = 'structured';
-
export const initialAgentValues = {
...initialLlmBaseValues,
description: '',
@@ -839,12 +842,29 @@ export const DROPDOWN_HORIZONTAL_OFFSET = 28;
export const DROPDOWN_VERTICAL_OFFSET = 74;
export const PREVENT_CLOSE_DELAY = 300;
-export enum JsonSchemaDataType {
- String = 'string',
- Number = 'number',
- Boolean = 'boolean',
- Array = 'array',
- Object = 'object',
+export enum VariableAssignerLogicalOperator {
+ Overwrite = 'overwrite',
+ Clear = 'clear',
+ Set = 'set',
+}
+
+export enum VariableAssignerLogicalNumberOperator {
+ Overwrite = VariableAssignerLogicalOperator.Overwrite,
+ Clear = VariableAssignerLogicalOperator.Clear,
+ Set = VariableAssignerLogicalOperator.Set,
+ Add = '+=',
+ Subtract = '-=',
+ Multiply = '*=',
+ Divide = '/=',
+}
+
+export enum VariableAssignerLogicalArrayOperator {
+ Overwrite = VariableAssignerLogicalOperator.Overwrite,
+ Clear = VariableAssignerLogicalOperator.Clear,
+ Append = 'append',
+ Extend = 'extend',
+ RemoveFirst = 'remove_first',
+ RemoveLast = 'remove_last',
}
export enum ExportFileType {
diff --git a/web/src/pages/agent/form/components/query-variable.tsx b/web/src/pages/agent/form/components/query-variable.tsx
index 92b1c82d4..fc76c2554 100644
--- a/web/src/pages/agent/form/components/query-variable.tsx
+++ b/web/src/pages/agent/form/components/query-variable.tsx
@@ -19,6 +19,8 @@ type QueryVariableProps = {
hideLabel?: boolean;
className?: string;
onChange?: (value: string) => void;
+ pureQuery?: boolean;
+ value?: string;
};
export function QueryVariable({
@@ -28,12 +30,34 @@ export function QueryVariable({
hideLabel = false,
className,
onChange,
+ pureQuery = false,
+ value,
}: QueryVariableProps) {
const { t } = useTranslation();
const form = useFormContext();
const finalOptions = useFilterQueryVariableOptionsByTypes(types);
+ const renderWidget = (
+ value?: string,
+ handleChange?: (value: string) => void,
+ ) => (
+
{
+ handleChange?.(val);
+ onChange?.(val);
+ }}
+ // allowClear
+ types={types}
+ >
+ );
+
+ if (pureQuery) {
+ renderWidget(value, onChange);
+ }
+
return (
)}
-
- {
- field.onChange(val);
- onChange?.(val);
- }}
- // allowClear
- types={types}
- >
-
+ {renderWidget(field.value, field.onChange)}
)}
diff --git a/web/src/pages/agent/form/components/structured-output-secondary-menu.tsx b/web/src/pages/agent/form/components/structured-output-secondary-menu.tsx
index f2ecd9191..2e7a34390 100644
--- a/web/src/pages/agent/form/components/structured-output-secondary-menu.tsx
+++ b/web/src/pages/agent/form/components/structured-output-secondary-menu.tsx
@@ -10,10 +10,7 @@ import { PropsWithChildren, ReactNode, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { JsonSchemaDataType } from '../../constant';
import { useGetStructuredOutputByValue } from '../../hooks/use-build-structured-output';
-import {
- hasJsonSchemaChild,
- hasSpecificTypeChild,
-} from '../../utils/filter-agent-structured-output';
+import { hasSpecificTypeChild } from '../../utils/filter-agent-structured-output';
type DataItem = { label: ReactNode; value: string; parentLabel?: ReactNode };
@@ -101,8 +98,9 @@ export function StructuredOutputSecondaryMenu({
);
if (
- !hasJsonSchemaChild(structuredOutput) ||
- (!isEmpty(types) && !hasSpecificTypeChild(structuredOutput, types))
+ !isEmpty(types) &&
+ !hasSpecificTypeChild(structuredOutput, types) &&
+ !types.some((x) => x === JsonSchemaDataType.Object)
) {
return null;
}
diff --git a/web/src/pages/agent/form/variable-assigner-form/dynamic-variables.tsx b/web/src/pages/agent/form/variable-assigner-form/dynamic-variables.tsx
new file mode 100644
index 000000000..8a01a7c07
--- /dev/null
+++ b/web/src/pages/agent/form/variable-assigner-form/dynamic-variables.tsx
@@ -0,0 +1,265 @@
+import { SelectWithSearch } from '@/components/originui/select-with-search';
+import { RAGFlowFormItem } from '@/components/ragflow-form';
+import { useIsDarkTheme } from '@/components/theme-provider';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
+import { Separator } from '@/components/ui/separator';
+import { Textarea } from '@/components/ui/textarea';
+import Editor, { loader } from '@monaco-editor/react';
+import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
+import { X } from 'lucide-react';
+import { ReactNode, useCallback } from 'react';
+import { useFieldArray, useFormContext } from 'react-hook-form';
+import {
+ JsonSchemaDataType,
+ VariableAssignerLogicalArrayOperator,
+ VariableAssignerLogicalNumberOperator,
+ VariableAssignerLogicalOperator,
+} from '../../constant';
+import { useGetVariableLabelOrTypeByValue } from '../../hooks/use-get-begin-query';
+import { DynamicFormHeader } from '../components/dynamic-fom-header';
+import { QueryVariable } from '../components/query-variable';
+import { useBuildLogicalOptions } from './use-build-logical-options';
+
+loader.config({ paths: { vs: '/vs' } });
+
+type SelectKeysProps = {
+ name: string;
+ label: ReactNode;
+ tooltip?: string;
+ keyField?: string;
+ valueField?: string;
+ operatorField?: string;
+};
+
+type RadioGroupProps = React.ComponentProps;
+
+type RadioButtonProps = Partial<
+ Omit & {
+ onChange: RadioGroupProps['onValueChange'];
+ }
+>;
+
+function RadioButton({ value, onChange }: RadioButtonProps) {
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+const EmptyFields = [
+ VariableAssignerLogicalOperator.Clear,
+ VariableAssignerLogicalArrayOperator.RemoveFirst,
+ VariableAssignerLogicalArrayOperator.RemoveLast,
+];
+
+const EmptyValueMap = {
+ [JsonSchemaDataType.String]: '',
+ [JsonSchemaDataType.Number]: 0,
+ [JsonSchemaDataType.Boolean]: 'yes',
+ [JsonSchemaDataType.Object]: '{}',
+ [JsonSchemaDataType.Array]: [],
+};
+
+export function DynamicVariables({
+ name,
+ label,
+ tooltip,
+ keyField = 'variable',
+ valueField = 'parameter',
+ operatorField = 'operator',
+}: SelectKeysProps) {
+ const form = useFormContext();
+ const { getType } = useGetVariableLabelOrTypeByValue();
+ const isDarkTheme = useIsDarkTheme();
+
+ const { fields, remove, append } = useFieldArray({
+ name: name,
+ control: form.control,
+ });
+
+ const { buildLogicalOptions } = useBuildLogicalOptions();
+
+ const getVariableType = useCallback(
+ (keyFieldName: string) => {
+ const key = form.getValues(keyFieldName);
+ return getType(key);
+ },
+ [form, getType],
+ );
+
+ const renderParameter = useCallback(
+ (keyFieldName: string, operatorFieldName: string) => {
+ const logicalOperator = form.getValues(operatorFieldName);
+ const type = getVariableType(keyFieldName);
+
+ if (EmptyFields.includes(logicalOperator)) {
+ return null;
+ } else if (
+ logicalOperator === VariableAssignerLogicalOperator.Overwrite ||
+ VariableAssignerLogicalArrayOperator.Extend === logicalOperator
+ ) {
+ return (
+
+ );
+ } else if (logicalOperator === VariableAssignerLogicalOperator.Set) {
+ if (type === JsonSchemaDataType.Boolean) {
+ return ;
+ }
+
+ if (type === JsonSchemaDataType.Number) {
+ return ;
+ }
+
+ if (type === JsonSchemaDataType.Object) {
+ return (
+
+ );
+ }
+
+ if (type === JsonSchemaDataType.String) {
+ return ;
+ }
+ } else if (
+ Object.values(VariableAssignerLogicalNumberOperator).some(
+ (x) => logicalOperator === x,
+ )
+ ) {
+ return ;
+ } else if (
+ logicalOperator === VariableAssignerLogicalArrayOperator.Append
+ ) {
+ const subType = type.match(/<([^>]+)>/).at(1);
+ return (
+
+ );
+ }
+ },
+ [form, getVariableType, isDarkTheme],
+ );
+
+ const handleVariableChange = useCallback(
+ (operatorFieldAlias: string, valueFieldAlias: string) => {
+ return () => {
+ form.setValue(
+ operatorFieldAlias,
+ VariableAssignerLogicalOperator.Overwrite,
+ { shouldDirty: true, shouldValidate: true },
+ );
+
+ form.setValue(valueFieldAlias, '', {
+ shouldDirty: true,
+ shouldValidate: true,
+ });
+ };
+ },
+ [form],
+ );
+
+ const handleOperatorChange = useCallback(
+ (valueFieldAlias: string, keyFieldAlias: string, value: string) => {
+ const type = getVariableType(keyFieldAlias);
+
+ let parameter = EmptyValueMap[type as keyof typeof EmptyValueMap];
+
+ if (value === VariableAssignerLogicalOperator.Overwrite) {
+ parameter = '';
+ }
+
+ if (value !== VariableAssignerLogicalOperator.Clear) {
+ form.setValue(valueFieldAlias, parameter, {
+ shouldDirty: true,
+ shouldValidate: true,
+ });
+ }
+ },
+ [form, getVariableType],
+ );
+
+ return (
+
+ append({ [keyField]: '', [valueField]: '' })}
+ >
+
+
+ {fields.map((field, index) => {
+ const keyFieldAlias = `${name}.${index}.${keyField}`;
+ const valueFieldAlias = `${name}.${index}.${valueField}`;
+ const operatorFieldAlias = `${name}.${index}.${operatorField}`;
+
+ return (
+
+
+
+
+
+
+
+
+ {({ onChange, value }) => (
+ {
+ handleOperatorChange(
+ valueFieldAlias,
+ keyFieldAlias,
+ val,
+ );
+ onChange(val);
+ }}
+ options={buildLogicalOptions(
+ getVariableType(keyFieldAlias),
+ )}
+ >
+ )}
+
+
+
+ {renderParameter(keyFieldAlias, operatorFieldAlias)}
+
+
+
+
+
+ );
+ })}
+
+
+ );
+}
diff --git a/web/src/pages/agent/form/variable-assigner-form/index.tsx b/web/src/pages/agent/form/variable-assigner-form/index.tsx
index 97695f877..6d717ebc7 100644
--- a/web/src/pages/agent/form/variable-assigner-form/index.tsx
+++ b/web/src/pages/agent/form/variable-assigner-form/index.tsx
@@ -1,98 +1,50 @@
-import { SelectWithSearch } from '@/components/originui/select-with-search';
-import { RAGFlowFormItem } from '@/components/ragflow-form';
import { Form } from '@/components/ui/form';
-import { Separator } from '@/components/ui/separator';
-import { buildOptions } from '@/utils/form';
import { zodResolver } from '@hookform/resolvers/zod';
import { memo } from 'react';
import { useForm } from 'react-hook-form';
-import { useTranslation } from 'react-i18next';
import { z } from 'zod';
-import {
- JsonSchemaDataType,
- Operations,
- initialDataOperationsValues,
-} from '../../constant';
+import { initialDataOperationsValues } from '../../constant';
import { useFormValues } from '../../hooks/use-form-values';
import { useWatchFormChange } from '../../hooks/use-watch-form-change';
import { INextOperatorForm } from '../../interface';
-import { buildOutputList } from '../../utils/build-output-list';
import { FormWrapper } from '../components/form-wrapper';
-import { Output, OutputSchema } from '../components/output';
-import { QueryVariableList } from '../components/query-variable-list';
+import { DynamicVariables } from './dynamic-variables';
-export const RetrievalPartialSchema = {
- query: z.array(z.object({ input: z.string().optional() })),
- operations: z.string(),
- select_keys: z.array(z.object({ name: z.string().optional() })).optional(),
- remove_keys: z.array(z.object({ name: z.string().optional() })).optional(),
- updates: z
- .array(
- z.object({ key: z.string().optional(), value: z.string().optional() }),
- )
- .optional(),
- rename_keys: z
- .array(
- z.object({
- old_key: z.string().optional(),
- new_key: z.string().optional(),
- }),
- )
- .optional(),
- filter_values: z
- .array(
- z.object({
- key: z.string().optional(),
- value: z.string().optional(),
- operator: z.string().optional(),
- }),
- )
- .optional(),
- ...OutputSchema,
+export const VariableAssignerSchema = {
+ variables: z.array(
+ z.object({
+ variable: z.string().optional(),
+ operator: z.string().optional(),
+ parameter: z.string().or(z.number()).or(z.boolean()).optional(),
+ }),
+ ),
};
-export const FormSchema = z.object(RetrievalPartialSchema);
+export const FormSchema = z.object(VariableAssignerSchema);
-export type DataOperationsFormSchemaType = z.infer;
+export type VariableAssignerFormSchemaType = z.infer;
-const outputList = buildOutputList(initialDataOperationsValues.outputs);
+// const outputList = buildOutputList(initialVariableAssignerValues.outputs);
function VariableAssignerForm({ node }: INextOperatorForm) {
- const { t } = useTranslation();
-
const defaultValues = useFormValues(initialDataOperationsValues, node);
- const form = useForm({
+ const form = useForm({
defaultValues: defaultValues,
mode: 'onChange',
resolver: zodResolver(FormSchema),
- shouldUnregister: true,
});
- const OperationsOptions = buildOptions(
- Operations,
- t,
- `flow.operationsOptions`,
- true,
- );
-
useWatchFormChange(node?.id, form, true);
return (
);
}
diff --git a/web/src/pages/agent/form/variable-assigner-form/use-build-logical-options.ts b/web/src/pages/agent/form/variable-assigner-form/use-build-logical-options.ts
new file mode 100644
index 000000000..a27ea20d5
--- /dev/null
+++ b/web/src/pages/agent/form/variable-assigner-form/use-build-logical-options.ts
@@ -0,0 +1,28 @@
+import { buildOptions } from '@/utils/form';
+import { useCallback } from 'react';
+import {
+ JsonSchemaDataType,
+ VariableAssignerLogicalArrayOperator,
+ VariableAssignerLogicalNumberOperator,
+ VariableAssignerLogicalOperator,
+} from '../../constant';
+
+export function useBuildLogicalOptions() {
+ const buildLogicalOptions = useCallback((type: string) => {
+ if (
+ type?.toLowerCase().startsWith(JsonSchemaDataType.Array.toLowerCase())
+ ) {
+ return buildOptions(VariableAssignerLogicalArrayOperator);
+ }
+
+ if (type === JsonSchemaDataType.Number) {
+ return buildOptions(VariableAssignerLogicalNumberOperator);
+ }
+
+ return buildOptions(VariableAssignerLogicalOperator);
+ }, []);
+
+ return {
+ buildLogicalOptions,
+ };
+}
diff --git a/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx b/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx
index cb38012f3..54d37957a 100644
--- a/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx
+++ b/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx
@@ -15,27 +15,30 @@ export const useHandleForm = () => {
return value;
}
};
- const handleSubmit = useCallback(async (fieldValue: FieldValues) => {
- const param = {
- ...(data.dsl?.variables || {}),
- [fieldValue.name]: {
- ...fieldValue,
- value:
- fieldValue.type === TypesWithArray.Object ||
- fieldValue.type === TypesWithArray.ArrayObject
- ? handleObjectData(fieldValue.value)
- : fieldValue.value,
- },
- } as Record;
+ const handleSubmit = useCallback(
+ async (fieldValue: FieldValues) => {
+ const param = {
+ ...(data.dsl?.variables || {}),
+ [fieldValue.name]: {
+ ...fieldValue,
+ value:
+ fieldValue.type === TypesWithArray.Object ||
+ fieldValue.type === TypesWithArray.ArrayObject
+ ? handleObjectData(fieldValue.value)
+ : fieldValue.value,
+ },
+ } as Record;
- const res = await saveGraph(undefined, {
- globalVariables: param,
- });
+ const res = await saveGraph(undefined, {
+ globalVariables: param,
+ });
- if (res.code === 0) {
- refetch();
- }
- }, []);
+ if (res.code === 0) {
+ refetch();
+ }
+ },
+ [data.dsl?.variables, refetch, saveGraph],
+ );
return { handleSubmit, loading };
};
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 94597d348..891c2dfa9 100644
--- a/web/src/pages/agent/hooks/use-build-structured-output.ts
+++ b/web/src/pages/agent/hooks/use-build-structured-output.ts
@@ -7,8 +7,11 @@ import {
} from '../constant';
import useGraphStore from '../store';
+function splitValue(value?: string) {
+ return typeof value === 'string' ? value?.split('@') : [];
+}
function getNodeId(value: string) {
- return value.split('@').at(0);
+ return splitValue(value).at(0);
}
export function useShowSecondaryMenu() {
@@ -63,7 +66,7 @@ export function useFindAgentStructuredOutputLabel() {
}>,
) => {
// agent structured output
- const fields = value.split('@');
+ const fields = splitValue(value);
if (
getOperatorTypeFromId(fields.at(0)) === Operator.Agent &&
fields.at(1)?.startsWith(AgentStructuredOutputField)
@@ -130,7 +133,7 @@ export function useFindAgentStructuredOutputTypeByValue() {
if (!value) {
return;
}
- const fields = value.split('@');
+ const fields = splitValue(value);
const nodeId = fields.at(0);
const jsonSchema = filterStructuredOutput(value);
@@ -163,7 +166,7 @@ export function useFindAgentStructuredOutputLabelByValue() {
const operatorName = getNode(getNodeId(value ?? ''))?.data.name;
if (operatorName) {
- return operatorName + ' / ' + value?.split('@').at(1);
+ return operatorName + ' / ' + splitValue(value).at(1);
}
}
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 9b9a6f6ba..d3a0953c8 100644
--- a/web/src/pages/agent/hooks/use-get-begin-query.tsx
+++ b/web/src/pages/agent/hooks/use-get-begin-query.tsx
@@ -1,7 +1,7 @@
-import { AgentGlobals } from '@/constants/agent';
+import { AgentGlobals, AgentStructuredOutputField } from '@/constants/agent';
import { useFetchAgent } from '@/hooks/use-agent-request';
import { RAGFlowNodeType } from '@/interfaces/database/flow';
-import { buildNodeOutputOptions } from '@/utils/canvas-util';
+import { buildNodeOutputOptions, isAgentStructured } from '@/utils/canvas-util';
import { DefaultOptionType } from 'antd/es/select';
import { t } from 'i18next';
import { isEmpty, toLower } from 'lodash';
@@ -232,8 +232,15 @@ export function useFilterQueryVariableOptionsByTypes(
...x,
options: x.options.filter(
(y) =>
- types?.some((x) => toLower(y.type).includes(x)) ||
- y.type === undefined, // agent structured output
+ types?.some((x) =>
+ toLower(x).startsWith('array')
+ ? toLower(y.type).includes(toLower(x))
+ : toLower(y.type) === toLower(x),
+ ) ||
+ isAgentStructured(
+ y.value,
+ y.value.slice(-AgentStructuredOutputField.length),
+ ), // agent structured output
),
};
})
diff --git a/web/src/pages/agent/utils/filter-agent-structured-output.ts b/web/src/pages/agent/utils/filter-agent-structured-output.ts
index b83193036..40db6b4fe 100644
--- a/web/src/pages/agent/utils/filter-agent-structured-output.ts
+++ b/web/src/pages/agent/utils/filter-agent-structured-output.ts
@@ -1,14 +1,18 @@
import { JSONSchema } from '@/components/jsonjoy-builder';
-import { get, isPlainObject } from 'lodash';
+import { get, isPlainObject, toLower } from 'lodash';
import { JsonSchemaDataType } from '../constant';
+function predicate(types: string[], type: string) {
+ return types.some((x) => toLower(x) === toLower(type));
+}
+
export function hasSpecificTypeChild(
data: Record | Array,
types: string[] = [],
) {
if (Array.isArray(data)) {
for (const value of data) {
- if (isPlainObject(value) && types.some((x) => x === value.type)) {
+ if (isPlainObject(value) && predicate(types, value.type)) {
return true;
}
if (hasSpecificTypeChild(value, types)) {
@@ -19,7 +23,7 @@ export function hasSpecificTypeChild(
if (isPlainObject(data)) {
for (const value of Object.values(data)) {
- if (isPlainObject(value) && types.some((x) => x === value.type)) {
+ if (isPlainObject(value) && predicate(types, value.type)) {
return true;
}
diff --git a/web/src/pages/user-setting/data-source/contant.tsx b/web/src/pages/user-setting/data-source/contant.tsx
index 3c8c55826..65788464c 100644
--- a/web/src/pages/user-setting/data-source/contant.tsx
+++ b/web/src/pages/user-setting/data-source/contant.tsx
@@ -105,9 +105,21 @@ export const DataSourceFormFields = {
{ label: 'R2', value: 'r2' },
{ label: 'Google Cloud Storage', value: 'google_cloud_storage' },
{ label: 'OCI Storage', value: 'oci_storage' },
+ { label: 'S3 Compatible', value: 's3_compatible' },
],
required: true,
},
+ {
+ label: 'Endpoint URL',
+ name: 'config.credentials.endpoint_url',
+ type: FormFieldType.Text,
+ required: false,
+ placeholder: 'https://fsn1.your-objectstorage.com',
+ tooltip: t('setting.S3CompatibleEndpointUrlTip'),
+ shouldRender: (formValues) => {
+ return formValues?.config?.bucket_type === 's3_compatible';
+ },
+ },
{
label: 'Prefix',
name: 'config.prefix',
@@ -483,6 +495,7 @@ export const DataSourceFormDefaultValues = {
credentials: {
aws_access_key_id: '',
aws_secret_access_key: '',
+ endpoint_url: '',
},
},
},
diff --git a/web/src/utils/canvas-util.tsx b/web/src/utils/canvas-util.tsx
index bfe6165b1..f59c4c195 100644
--- a/web/src/utils/canvas-util.tsx
+++ b/web/src/utils/canvas-util.tsx
@@ -1,4 +1,10 @@
+import {
+ AgentStructuredOutputField,
+ JsonSchemaDataType,
+ Operator,
+} from '@/constants/agent';
import { BaseNode } from '@/interfaces/database/agent';
+
import { Edge } from '@xyflow/react';
import { isEmpty } from 'lodash';
import { ComponentType, ReactNode } from 'react';
@@ -23,6 +29,12 @@ export function filterAllUpstreamNodeIds(edges: Edge[], nodeIds: string[]) {
}, []);
}
+export function isAgentStructured(id?: string, label?: string) {
+ return (
+ label === AgentStructuredOutputField && id?.startsWith(`${Operator.Agent}:`)
+ );
+}
+
export function buildOutputOptions(
outputs: Record = {},
nodeId?: string,
@@ -34,7 +46,9 @@ export function buildOutputOptions(
value: `${nodeId}@${x}`,
parentLabel,
icon,
- type: outputs[x]?.type,
+ type: isAgentStructured(nodeId, x)
+ ? JsonSchemaDataType.Object
+ : outputs[x]?.type,
}));
}
diff --git a/web/src/utils/common-util.ts b/web/src/utils/common-util.ts
index b88e870fa..12b6d0d8e 100644
--- a/web/src/utils/common-util.ts
+++ b/web/src/utils/common-util.ts
@@ -46,6 +46,7 @@ const orderFactoryList = [
LLMFactory.Ai302,
LLMFactory.CometAPI,
LLMFactory.DeerAPI,
+ LLMFactory.JiekouAI,
];
export const sortLLmFactoryListBySpecifiedOrder = (list: IFactory[]) => {