feat: made a basic version of inferredBeliefNode without all functionality

full reduce and connection logic is still missing

ref: N25B-433
This commit is contained in:
JGerla
2026-01-12 15:34:44 +01:00
parent 5385bd72b1
commit 0a4940bdd0
11 changed files with 303 additions and 17 deletions

View File

@@ -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';
import { BasicBeliefReduce } from './BasicBeliefNode.tsx';
/**
* 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"])
allowOnlyConnectionsFromType(["basic_belief, inferred_belief"])
]}/>
</div>
</>;
@@ -122,7 +122,7 @@ export function NormReduce(node: Node, nodes: Node[]) {
export function NormConnectionTarget(_thisNode: Node, _sourceNodeId: string) {
const data = _thisNode.data as NormNodeData;
// If we got a belief connected, this is the condition for the norm.
if ((useFlowStore.getState().nodes.find((node) => node.id === _sourceNodeId && node.type === 'basic_belief' /* TODO: Add the option for an inferred belief */))) {
if ((useFlowStore.getState().nodes.find((node) => node.id === _sourceNodeId && ['basic_belief', 'inferred_belief'].includes(node.type!)))) {
data.condition = _sourceNodeId;
}
}