diff --git a/web/src/pages/agent/form/code-form/dynamic-input-variable.tsx b/web/src/pages/agent/form/code-form/dynamic-input-variable.tsx
deleted file mode 100644
index c207d2804..000000000
--- a/web/src/pages/agent/form/code-form/dynamic-input-variable.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-import { BlockButton } from '@/components/ui/button';
-import { RAGFlowNodeType } from '@/interfaces/database/flow';
-import { MinusCircleOutlined } from '@ant-design/icons';
-import { Form, Input, Select } from 'antd';
-import { useTranslation } from 'react-i18next';
-import { useBuildVariableOptions } from '../../hooks/use-get-begin-query';
-import { FormCollapse } from '../components/dynamic-input-variable';
-
-type DynamicInputVariableProps = {
- name?: string;
- node?: RAGFlowNodeType;
-};
-
-export const DynamicInputVariable = ({
- name = 'arguments',
- node,
-}: DynamicInputVariableProps) => {
- const { t } = useTranslation();
-
- const valueOptions = useBuildVariableOptions(node?.id, node?.parentId);
-
- return (
-
-
- {(fields, { add, remove }) => (
- <>
- {fields.map(({ key, name, ...restField }) => (
-
-
-
-
-
-
-
- remove(name)} />
-
- ))}
-
- add()}>
- {t('flow.addVariable')}
-
-
- >
- )}
-
-
- );
-};
diff --git a/web/src/pages/agent/form/code-form/next-variable.tsx b/web/src/pages/agent/form/code-form/next-variable.tsx
index fe668f41b..c3f0ac5a7 100644
--- a/web/src/pages/agent/form/code-form/next-variable.tsx
+++ b/web/src/pages/agent/form/code-form/next-variable.tsx
@@ -1,6 +1,7 @@
'use client';
import { FormContainer } from '@/components/form-container';
+import { SelectWithSearch } from '@/components/originui/select-with-search';
import { BlockButton, Button } from '@/components/ui/button';
import {
FormControl,
@@ -9,14 +10,13 @@ import {
FormMessage,
} from '@/components/ui/form';
import { BlurInput } from '@/components/ui/input';
-import { RAGFlowSelect } from '@/components/ui/select';
import { Separator } from '@/components/ui/separator';
import { RAGFlowNodeType } from '@/interfaces/database/flow';
import { X } from 'lucide-react';
import { ReactNode } from 'react';
import { useFieldArray, useFormContext } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
-import { useBuildVariableOptions } from '../../hooks/use-get-begin-query';
+import { useBuildQueryVariableOptions } from '../../hooks/use-get-begin-query';
interface IProps {
node?: RAGFlowNodeType;
@@ -32,7 +32,7 @@ export const TypeOptions = [
'Object',
].map((x) => ({ label: x, value: x }));
-export function DynamicVariableForm({ node, name = 'arguments' }: IProps) {
+export function DynamicVariableForm({ name = 'arguments' }: IProps) {
const { t } = useTranslation();
const form = useFormContext();
@@ -41,19 +41,19 @@ export function DynamicVariableForm({ node, name = 'arguments' }: IProps) {
control: form.control,
});
- const valueOptions = useBuildVariableOptions(node?.id, node?.parentId);
+ const nextOptions = useBuildQueryVariableOptions();
return (
{fields.map((field, index) => {
const typeField = `${name}.${index}.name`;
return (
-
+
(
-
+
(
-
+
-
+ >
diff --git a/web/src/pages/agent/form/code-form/use-watch-change.ts b/web/src/pages/agent/form/code-form/use-watch-change.ts
index 7c9759560..8f882b0a3 100644
--- a/web/src/pages/agent/form/code-form/use-watch-change.ts
+++ b/web/src/pages/agent/form/code-form/use-watch-change.ts
@@ -9,8 +9,8 @@ export function useWatchFormChange(id?: string, form?: UseFormReturn) {
useEffect(() => {
// Manually triggered form updates are synchronized to the canvas
- if (id && form?.formState.isDirty) {
- values = form?.getValues();
+ if (id) {
+ values = form?.getValues() || {};
let nextValues: any = values;
updateNodeForm(id, nextValues);