diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs index 0473e6246..689dec1fc 100644 --- a/web/.eslintrc.cjs +++ b/web/.eslintrc.cjs @@ -53,10 +53,7 @@ module.exports = { ], }, ], - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], + 'react-refresh/only-export-components': 'off', 'no-console': ['warn', { allow: ['warn', 'error'] }], 'check-file/filename-naming-convention': [ 'error', diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx index 845450ab3..869f247c0 100644 --- a/web/src/pages/agent/constant/index.tsx +++ b/web/src/pages/agent/constant/index.tsx @@ -1075,3 +1075,13 @@ export enum WebhookStatus { Live = 'live', Stopped = 'stopped', } + +// Map BeginQueryType to TypesWithArray +export const BeginQueryTypeMap = { + [BeginQueryType.Line]: TypesWithArray.String, + [BeginQueryType.Paragraph]: TypesWithArray.String, + [BeginQueryType.Options]: TypesWithArray.ArrayString, + [BeginQueryType.File]: 'File', + [BeginQueryType.Integer]: TypesWithArray.Number, + [BeginQueryType.Boolean]: TypesWithArray.Boolean, +}; diff --git a/web/src/pages/agent/form/begin-form/parameter-dialog.tsx b/web/src/pages/agent/form/begin-form/parameter-dialog.tsx index 88f239a4e..c56f7a1f1 100644 --- a/web/src/pages/agent/form/begin-form/parameter-dialog.tsx +++ b/web/src/pages/agent/form/begin-form/parameter-dialog.tsx @@ -96,7 +96,7 @@ function ParameterForm({ }, [], ); - }, []); + }, [t]); const type = useWatch({ control: form.control, 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 5de22e0e9..9588ee90f 100644 --- a/web/src/pages/agent/hooks/use-get-begin-query.tsx +++ b/web/src/pages/agent/hooks/use-get-begin-query.tsx @@ -18,6 +18,7 @@ import { AgentVariableType, BeginId, BeginQueryType, + BeginQueryTypeMap, JsonSchemaDataType, Operator, VariableType, @@ -463,7 +464,14 @@ export function useGetVariableLabelOrTypeByValue({ const getType = useCallback( (val?: string) => { - return getItem(val)?.type || findAgentStructuredOutputTypeByValue(val); + const currentType = + getItem(val)?.type || findAgentStructuredOutputTypeByValue(val); + + if (currentType && currentType in BeginQueryTypeMap) { + return BeginQueryTypeMap[currentType as BeginQueryType]; + } + + return currentType; }, [findAgentStructuredOutputTypeByValue, getItem], );