Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Fixed an issue where adding session variables multiple times would overwrite them. (#11308)

chanx1dba6b5bf957
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 cb38012f37..54d37957a2 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<string, GlobalVariableType>;
+ 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<string, GlobalVariableType>;
- 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 };
};