RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Feat: Upgrade react-hook-form to the latest version to solve the problem that appending a useFieldArray entry cannot trigger the watch callback function #3221 (#7849)
balibabu78fa37f8aecd
diff --git a/web/package-lock.json b/web/package-lock.jsonindex b55ee249ae..beab1974f0 100644--- a/web/package-lock.json+++ b/web/package-lock.json@@ -72,7 +72,7 @@"react-copy-to-clipboard": "^5.1.0","react-dropzone": "^14.3.5","react-error-boundary": "^4.0.13",- "react-hook-form": "^7.53.1",+ "react-hook-form": "^7.56.4","react-i18next": "^14.0.0","react-infinite-scroll-component": "^6.1.0","react-markdown": "^9.0.1",@@ -27245,9 +27245,10 @@}},"node_modules/react-hook-form": {- "version": "7.53.1",- "resolved": "https://registry.npmmirror.com/react-hook-form/-/react-hook-form-7.53.1.tgz",- "integrity": "sha512-6aiQeBda4zjcuaugWvim9WsGqisoUk+etmFEsSUMm451/Ic8L/UAb7sRtMj3V+Hdzm6mMjU1VhiSzYUZeBm0Vg==",+ "version": "7.56.4",+ "resolved": "https://registry.npmmirror.com/react-hook-form/-/react-hook-form-7.56.4.tgz",+ "integrity": "sha512-Rob7Ftz2vyZ/ZGsQZPaRdIefkgOSrQSPXfqBdvOPwJfoGnjwRJUs7EM7Kc1mcoDv3NOtqBzPGbcMB8CGn9CKgw==",+ "license": "MIT","engines": {"node": ">=18.0.0"},diff --git a/web/package.json b/web/package.jsonindex 6a2faf96a8..4d58a20c48 100644--- a/web/package.json+++ b/web/package.json@@ -83,7 +83,7 @@"react-copy-to-clipboard": "^5.1.0","react-dropzone": "^14.3.5","react-error-boundary": "^4.0.13",- "react-hook-form": "^7.53.1",+ "react-hook-form": "^7.56.4","react-i18next": "^14.0.0","react-infinite-scroll-component": "^6.1.0","react-markdown": "^9.0.1",diff --git a/web/src/pages/agent/form-sheet/use-form-config-map.tsx b/web/src/pages/agent/form-sheet/use-form-config-map.tsxindex 335e90cf9b..412891100c 100644--- a/web/src/pages/agent/form-sheet/use-form-config-map.tsx+++ b/web/src/pages/agent/form-sheet/use-form-config-map.tsx@@ -126,9 +126,17 @@ export function useFormConfigMap() {},[Operator.Message]: {component: MessageForm,- defaultValues: {},+ defaultValues: {+ content: [],+ },schema: z.object({- content: z.array(z.string()).optional(),+ content: z+ .array(+ z.object({+ value: z.string(),+ }),+ )+ .optional(),}),},[Operator.Relevant]: {diff --git a/web/src/pages/agent/form/message-form/index.tsx b/web/src/pages/agent/form/message-form/index.tsxindex 2013229290..628d4dcebc 100644--- a/web/src/pages/agent/form/message-form/index.tsx+++ b/web/src/pages/agent/form/message-form/index.tsx@@ -43,6 +43,7 @@ const MessageForm = ({ form }: INextOperatorForm) => {render={({ field }) => (<FormItem className="flex-1"><FormControl>+ {/* <Input {...field}></Input> */}<PromptEditor{...field}placeholder={t('flow.messagePlaceholder')}diff --git a/web/src/pages/agent/hooks/use-watch-form-change.ts b/web/src/pages/agent/hooks/use-watch-form-change.tsindex c3e73aa8d8..498cac911f 100644--- a/web/src/pages/agent/hooks/use-watch-form-change.ts+++ b/web/src/pages/agent/hooks/use-watch-form-change.ts@@ -40,6 +40,7 @@ export const useHandleFormValuesChange = (useEffect(() => {const subscription = form?.watch((value, { name, type, values }) => {console.log('π ~ subscription ~ value:', value);+if (id && name) {console.log('π ~ useEffect ~ value:',@@ -84,8 +85,12 @@ export const useHandleFormValuesChange = (script: CodeTemplateStrMap[value.lang as ProgrammingLanguage],};}++ if (operatorName === Operator.Message) {+ }+// Manually triggered form updates are synchronized to the canvas- if (type) {+ if (form.formState.isDirty) {// run(id, nextValues);updateNodeForm(id, nextValues);}