feat(web): 完成前序节点输出变量注入
This commit is contained in:
@@ -24,6 +24,7 @@ import KnowledgeNode from './node/KnowledgeNode.tsx'
|
||||
import LlmNode from './node/LlmNode.tsx'
|
||||
import OutputNode from './node/OutputNode.tsx'
|
||||
import SwitchNode from './node/SwitchNode.tsx'
|
||||
import {useContextStore} from './store/ContextStore.ts'
|
||||
import {useDataStore} from './store/DataStore.ts'
|
||||
import {useFlowStore} from './store/FlowStore.ts'
|
||||
|
||||
@@ -67,7 +68,7 @@ const FlowableDiv = styled.div`
|
||||
export type GraphData = { nodes: Node[], edges: Edge[], data: any }
|
||||
|
||||
export type FlowEditorProps = {
|
||||
// inputSchema: Record<string, Record<string, any>>,
|
||||
inputSchema: Record<string, Record<string, any>>,
|
||||
graphData: GraphData,
|
||||
onGraphDataChange: (graphData: GraphData) => void,
|
||||
}
|
||||
@@ -141,6 +142,10 @@ function FlowEditor(props: FlowEditorProps) {
|
||||
})),
|
||||
)
|
||||
|
||||
const {
|
||||
setInputSchema,
|
||||
} = useContextStore()
|
||||
|
||||
const [currentNodeForm, setCurrentNodeForm] = useState<JSX.Element>()
|
||||
const editNode = (id: string, columnSchema?: Schema[]) => {
|
||||
if (!isNil(columnSchema)) {
|
||||
@@ -219,7 +224,6 @@ function FlowEditor(props: FlowEditorProps) {
|
||||
|
||||
// 用于透传node操作到主流程
|
||||
const initialNodeHandlers = {
|
||||
// getInputSchema: () => props.inputSchema,
|
||||
editNode,
|
||||
}
|
||||
|
||||
@@ -238,6 +242,8 @@ function FlowEditor(props: FlowEditorProps) {
|
||||
}
|
||||
setNodes(initialNodes)
|
||||
setEdges(initialEdges)
|
||||
|
||||
setInputSchema(props.inputSchema)
|
||||
}, [props.graphData])
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user