Create a basic belief node that can be used in further stages to create inferred belief and be inputs for other nodes. #32
@@ -46,7 +46,7 @@ import TriggerNode, {
|
|||||||
TriggerReduce
|
TriggerReduce
|
||||||
} from "./nodes/TriggerNode";
|
} from "./nodes/TriggerNode";
|
||||||
import { TriggerNodeDefaults } from "./nodes/TriggerNode.default";
|
import { TriggerNodeDefaults } from "./nodes/TriggerNode.default";
|
||||||
import BasicBeliefNode, { BasicBeliefConnects, BasicBeliefReduce } from "./nodes/BasicBeliefNode";
|
import BasicBeliefNode, { BasicBeliefConnectionSource, BasicBeliefConnectionTarget, BasicBeliefDisconnectionSource, BasicBeliefDisconnectionTarget, BasicBeliefReduce } from "./nodes/BasicBeliefNode";
|
||||||
import { BasicBeliefNodeDefaults } from "./nodes/BasicBeliefNode.default";
|
import { BasicBeliefNodeDefaults } from "./nodes/BasicBeliefNode.default";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,6 +112,7 @@ export const NodeConnections = {
|
|||||||
norm: NormConnectionTarget,
|
norm: NormConnectionTarget,
|
||||||
goal: GoalConnectionTarget,
|
goal: GoalConnectionTarget,
|
||||||
trigger: TriggerConnectionTarget,
|
trigger: TriggerConnectionTarget,
|
||||||
|
basic_belief: BasicBeliefConnectionTarget,
|
||||||
},
|
},
|
||||||
Sources: {
|
Sources: {
|
||||||
start: StartConnectionSource,
|
start: StartConnectionSource,
|
||||||
@@ -120,6 +121,7 @@ export const NodeConnections = {
|
|||||||
norm: NormConnectionSource,
|
norm: NormConnectionSource,
|
||||||
goal: GoalConnectionSource,
|
goal: GoalConnectionSource,
|
||||||
trigger: TriggerConnectionSource,
|
trigger: TriggerConnectionSource,
|
||||||
|
basic_belief: BasicBeliefConnectionSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +139,7 @@ export const NodeDisconnections = {
|
|||||||
norm: NormDisconnectionTarget,
|
norm: NormDisconnectionTarget,
|
||||||
goal: GoalDisconnectionTarget,
|
goal: GoalDisconnectionTarget,
|
||||||
trigger: TriggerDisconnectionTarget,
|
trigger: TriggerDisconnectionTarget,
|
||||||
|
basic_belief: BasicBeliefDisconnectionTarget,
|
||||||
},
|
},
|
||||||
Sources: {
|
Sources: {
|
||||||
start: StartDisconnectionSource,
|
start: StartDisconnectionSource,
|
||||||
@@ -145,6 +148,7 @@ export const NodeDisconnections = {
|
|||||||
norm: NormDisconnectionSource,
|
norm: NormDisconnectionSource,
|
||||||
goal: GoalDisconnectionSource,
|
goal: GoalDisconnectionSource,
|
||||||
trigger: TriggerDisconnectionSource,
|
trigger: TriggerDisconnectionSource,
|
||||||
|
basic_belief: BasicBeliefDisconnectionSource,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import {
|
|||||||
Handle,
|
Handle,
|
||||||
type NodeProps,
|
type NodeProps,
|
||||||
Position,
|
Position,
|
||||||
type Connection,
|
|
||||||
type Edge,
|
|
||||||
type Node,
|
type Node,
|
||||||
} from '@xyflow/react';
|
} from '@xyflow/react';
|
||||||
import { Toolbar } from '../components/NodeComponents';
|
import { Toolbar } from '../components/NodeComponents';
|
||||||
@@ -41,12 +39,39 @@ export type BasicBeliefNode = Node<BasicBeliefNodeData>
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether a BasicBelief node can connect to another node or edge.
|
* This function is called whenever a connection is made with this node type as the target
|
||||||
*
|
* @param _thisNode the node of this node type which function is called
|
||||||
* @param connection - The connection or edge being attempted to connect towards.
|
* @param _sourceNodeId the source of the received connection
|
||||||
* @returns `true` if the connection is defined; otherwise, `false`.
|
|
||||||
*/
|
*/
|
||||||
export function BasicBeliefNodeCanConnect(_connection: Connection | Edge) {
|
export function BasicBeliefConnectionTarget(_thisNode: Node, _sourceNodeId: string) {
|
||||||
|
// no additional connection logic exists yet
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called whenever a connection is made with this node type as the source
|
||||||
|
* @param _thisNode the node of this node type which function is called
|
||||||
|
* @param _targetNodeId the target of the created connection
|
||||||
|
*/
|
||||||
|
export function BasicBeliefConnectionSource(_thisNode: Node, _targetNodeId: string) {
|
||||||
|
// no additional connection logic exists yet
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called whenever a connection is disconnected with this node type as the target
|
||||||
|
* @param _thisNode the node of this node type which function is called
|
||||||
|
* @param _sourceNodeId the source of the disconnected connection
|
||||||
|
*/
|
||||||
|
export function BasicBeliefDisconnectionTarget(_thisNode: Node, _sourceNodeId: string) {
|
||||||
|
// no additional connection logic exists yet
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called whenever a connection is disconnected with this node type as the source
|
||||||
|
* @param _thisNode the node of this node type which function is called
|
||||||
|
* @param _targetNodeId the target of the diconnected connection
|
||||||
|
*/
|
||||||
|
export function BasicBeliefDisconnectionSource(_thisNode: Node, _targetNodeId: string) {
|
||||||
|
// no additional connection logic exists yet
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user