feat: added reduce and connection logic
A rule still needs to be added to the inferred belief handles to prevent cyclical inferredBeliefs, but aside from that logic ifs finished. ref: N25B-433
This commit is contained in:
@@ -9,7 +9,7 @@ import { TextField } from '../../../../components/TextField';
|
||||
import {MultiConnectionHandle, SingleConnectionHandle} from "../components/RuleBasedHandle.tsx";
|
||||
import {allowOnlyConnectionsFromHandle, allowOnlyConnectionsFromType} from "../HandleRules.ts";
|
||||
import useFlowStore from '../VisProgStores';
|
||||
import { BasicBeliefReduce } from './BasicBeliefNode.tsx';
|
||||
import {BeliefReduce} from "./BeliefReduce.ts";
|
||||
|
||||
/**
|
||||
* The default data dot a phase node
|
||||
@@ -81,7 +81,7 @@ export default function NormNode(props: NodeProps<NormNode>) {
|
||||
allowOnlyConnectionsFromHandle([{nodeType:"phase",handleId:"data"}])
|
||||
]}/>
|
||||
<SingleConnectionHandle type="target" position={Position.Bottom} id="beliefs" rules={[
|
||||
allowOnlyConnectionsFromType(["basic_belief, inferred_belief"])
|
||||
allowOnlyConnectionsFromType(["basic_belief", "inferred_belief"])
|
||||
]}/>
|
||||
</div>
|
||||
</>;
|
||||
@@ -105,11 +105,10 @@ export function NormReduce(node: Node, nodes: Node[]) {
|
||||
};
|
||||
|
||||
if (data.condition) {
|
||||
const reducer = BasicBeliefReduce; // TODO: also add inferred.
|
||||
const conditionNode = nodes.find((node) => node.id === data.condition);
|
||||
// In case something went wrong, and our condition doesn't actually exist;
|
||||
if (conditionNode == undefined) return result;
|
||||
result["condition"] = reducer(conditionNode, nodes)
|
||||
result["condition"] = BeliefReduce(conditionNode, nodes)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user