mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Synchronize the data of the tavily form to the canvas node #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -75,6 +75,7 @@ export type RFState = {
|
||||
generateNodeName: (name: string) => string;
|
||||
setClickedNodeId: (id?: string) => void;
|
||||
setClickedToolId: (id?: string) => void;
|
||||
findUpstreamNodeById: (id?: string | null) => RAGFlowNodeType | undefined;
|
||||
};
|
||||
|
||||
// this is our useStore hook that we can use in our components to get parts of the store and call actions
|
||||
@ -471,6 +472,11 @@ const useGraphStore = create<RFState>()(
|
||||
setClickedToolId: (id?: string) => {
|
||||
set({ clickedToolId: id });
|
||||
},
|
||||
findUpstreamNodeById: (id) => {
|
||||
const { edges, getNode } = get();
|
||||
const edge = edges.find((x) => x.target === id);
|
||||
return getNode(edge?.source);
|
||||
},
|
||||
})),
|
||||
{ name: 'graph', trace: true },
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user