mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-29 16:05:35 +08:00
Iframe should support input variables (#5156)
### What problem does this PR solve? Right now we cannot embed a chat in website when it has variables in the begin component. This PR tries to read the variables values from the query string via a data_ prefixed variable. #5016 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: gstrat88 <gstrat@innews.gr>
This commit is contained in:
@ -16,18 +16,19 @@ export const useGetBeginNodeDataQuery = () => {
|
||||
return getBeginNodeDataQuery;
|
||||
};
|
||||
|
||||
export const useGetBeginNodeDataQueryIsEmpty = () => {
|
||||
const [isBeginNodeDataQueryEmpty, setIsBeginNodeDataQueryEmpty] =
|
||||
export const useGetBeginNodeDataQueryIsSafe = () => {
|
||||
const [isBeginNodeDataQuerySafe, setIsBeginNodeDataQuerySafe] =
|
||||
useState(false);
|
||||
const getBeginNodeDataQuery = useGetBeginNodeDataQuery();
|
||||
const nodes = useGraphStore((state) => state.nodes);
|
||||
|
||||
useEffect(() => {
|
||||
const query: BeginQuery[] = getBeginNodeDataQuery();
|
||||
setIsBeginNodeDataQueryEmpty(query.length === 0);
|
||||
const isSafe = !query.some((q) => !q.optional && q.type === 'file');
|
||||
setIsBeginNodeDataQuerySafe(isSafe);
|
||||
}, [getBeginNodeDataQuery, nodes]);
|
||||
|
||||
return isBeginNodeDataQueryEmpty;
|
||||
return isBeginNodeDataQuerySafe;
|
||||
};
|
||||
|
||||
// exclude nodes with branches
|
||||
|
||||
Reference in New Issue
Block a user