mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32:30 +08:00
Fix: Fixed an issue where adding session variables multiple times would overwrite them. (#11308)
### What problem does this PR solve? Fix: Fixed an issue where adding session variables multiple times would overwrite them. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -15,27 +15,30 @@ export const useHandleForm = () => {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleSubmit = useCallback(async (fieldValue: FieldValues) => {
|
const handleSubmit = useCallback(
|
||||||
const param = {
|
async (fieldValue: FieldValues) => {
|
||||||
...(data.dsl?.variables || {}),
|
const param = {
|
||||||
[fieldValue.name]: {
|
...(data.dsl?.variables || {}),
|
||||||
...fieldValue,
|
[fieldValue.name]: {
|
||||||
value:
|
...fieldValue,
|
||||||
fieldValue.type === TypesWithArray.Object ||
|
value:
|
||||||
fieldValue.type === TypesWithArray.ArrayObject
|
fieldValue.type === TypesWithArray.Object ||
|
||||||
? handleObjectData(fieldValue.value)
|
fieldValue.type === TypesWithArray.ArrayObject
|
||||||
: fieldValue.value,
|
? handleObjectData(fieldValue.value)
|
||||||
},
|
: fieldValue.value,
|
||||||
} as Record<string, GlobalVariableType>;
|
},
|
||||||
|
} as Record<string, GlobalVariableType>;
|
||||||
|
|
||||||
const res = await saveGraph(undefined, {
|
const res = await saveGraph(undefined, {
|
||||||
globalVariables: param,
|
globalVariables: param,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
refetch();
|
refetch();
|
||||||
}
|
}
|
||||||
}, []);
|
},
|
||||||
|
[data.dsl?.variables, refetch, saveGraph],
|
||||||
|
);
|
||||||
|
|
||||||
return { handleSubmit, loading };
|
return { handleSubmit, loading };
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user