Merge branch 'demo' into refactor/nodes-match-functionality
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
import '@xyflow/react/dist/style.css';
|
||||
import {useEffect} from "react";
|
||||
import {useShallow} from 'zustand/react/shallow';
|
||||
import useProgramStore from "../../utils/programStore.ts";
|
||||
import {DndToolbar} from './visualProgrammingUI/components/DragDropSidebar.tsx';
|
||||
import useFlowStore from './visualProgrammingUI/VisProgStores.tsx';
|
||||
import type {FlowState} from './visualProgrammingUI/VisProgTypes.tsx';
|
||||
@@ -155,6 +156,10 @@ function runProgram() {
|
||||
).then((res) => {
|
||||
if (!res.ok) throw new Error("Failed communicating with the backend.")
|
||||
console.log("Successfully sent the program to the backend.");
|
||||
|
||||
// store reduced program in global program store for further use in the UI
|
||||
// when the program was sent to the backend successfully:
|
||||
useProgramStore.getState().setProgramState(structuredClone(program));
|
||||
}).catch(() => console.log("Failed to send program to the backend."));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ export type BasicBeliefNodeData = {
|
||||
};
|
||||
|
||||
// These are all the types a basic belief could be.
|
||||
type BasicBeliefType = Keyword | Semantic | Object | Emotion
|
||||
type BasicBeliefType = Keyword | Semantic | DetectedObject | Emotion
|
||||
type Keyword = { type: "keyword", id: string, value: string, label: "Keyword said:"};
|
||||
type Semantic = { type: "semantic", id: string, value: string, label: "Detected with LLM:"};
|
||||
type Object = { type: "object", id: string, value: string, label: "Object found:"};
|
||||
type DetectedObject = { type: "object", id: string, value: string, label: "Object found:"};
|
||||
type Emotion = { type: "emotion", id: string, value: string, label: "Emotion recognised:"};
|
||||
|
||||
export type BasicBeliefNode = Node<BasicBeliefNodeData>
|
||||
@@ -93,6 +93,10 @@ export default function BasicBeliefNode(props: NodeProps<BasicBeliefNode>) {
|
||||
belief: {
|
||||
...data.belief,
|
||||
type: newType,
|
||||
value:
|
||||
newType === "emotion"
|
||||
? emotionOptions[0]
|
||||
: data.belief.value,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -202,13 +206,4 @@ export function BasicBeliefReduce(node: Node, _nodes: Node[]) {
|
||||
break;
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called whenever a connection is made with this node type (BasicBelief)
|
||||
* @param _thisNode the node of this node type which function is called
|
||||
* @param _otherNode the other node which was part of the connection
|
||||
* @param _isThisSource whether this instance of the node was the source in the connection, true = yes.
|
||||
*/
|
||||
export function BasicBeliefConnects(_thisNode: Node, _otherNode: Node, _isThisSource: boolean) {
|
||||
}
|
||||
Reference in New Issue
Block a user