diff --git a/space_flow/src/CustomNodes/ChatInputNode/index.tsx b/space_flow/src/CustomNodes/ChatInputNode/index.tsx
new file mode 100644
index 000000000..bcc837733
--- /dev/null
+++ b/space_flow/src/CustomNodes/ChatInputNode/index.tsx
@@ -0,0 +1,21 @@
+import { ChatBubbleBottomCenterTextIcon } from "@heroicons/react/24/outline";
+import Input from "../../components/inputComponent";
+import { snakeToNormalCase } from "../../utils";
+import { Handle, Position } from "reactflow";
+
+export default function ChatInputNode({ data }) {
+ return (
+
+ );
+}
diff --git a/space_flow/src/CustomNodes/ChatOutputNode/index.tsx b/space_flow/src/CustomNodes/ChatOutputNode/index.tsx
new file mode 100644
index 000000000..ecf8a652d
--- /dev/null
+++ b/space_flow/src/CustomNodes/ChatOutputNode/index.tsx
@@ -0,0 +1,23 @@
+import { ChatBubbleBottomCenterTextIcon } from "@heroicons/react/24/outline";
+import { Handle, Position } from "reactflow";
+import Input from "../../components/inputComponent";
+import { snakeToNormalCase } from "../../utils";
+
+export default function ChatOutputNode({ data }) {
+
+ return (
+
+ );
+
+}
\ No newline at end of file
diff --git a/space_flow/src/CustomNodes/GenericNode/index.tsx b/space_flow/src/CustomNodes/GenericNode/index.tsx
index 8a19f6664..ae39d7675 100644
--- a/space_flow/src/CustomNodes/GenericNode/index.tsx
+++ b/space_flow/src/CustomNodes/GenericNode/index.tsx
@@ -18,7 +18,9 @@ export default function GenericNode({ data }) {
type="source"
position={Position.Left}
id="b"
- className="bg-gray-400 w-4 h-4 rounded-full"
+ isConnectable={false}
+ className="ml-1 bg-transparent border-solid border-l-8 border-y-transparent border-y-8 border-r-0 rounded-none"
+ style={{borderLeftColor: nodeColors[data.type]}}
>
@@ -29,7 +31,6 @@ export default function GenericNode({ data }) {
/>
{data.name}
-
@@ -46,7 +47,7 @@ export default function GenericNode({ data }) {
onSelect={() => {}}
/>
) : data.node.template[t].type === "str" ? (
-
{}} />
+ <>>
) : (
<>>
)}
@@ -59,16 +60,13 @@ export default function GenericNode({ data }) {
-
);
diff --git a/space_flow/src/CustomNodes/InputNode/index.tsx b/space_flow/src/CustomNodes/InputNode/index.tsx
new file mode 100644
index 000000000..d921d559a
--- /dev/null
+++ b/space_flow/src/CustomNodes/InputNode/index.tsx
@@ -0,0 +1,41 @@
+import { Bars3CenterLeftIcon, TrashIcon } from "@heroicons/react/24/outline";
+import Input from "../../components/inputComponent";
+import { nodeColors, nodeIcons, snakeToNormalCase } from "../../utils";
+import { Handle, Position } from "reactflow";
+
+export default function InputNode({ data }) {
+ return (
+
+
+
+ {
+ data.text = e;
+ }}
+ />
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/space_flow/src/components/chatComponent/index.tsx b/space_flow/src/components/chatComponent/index.tsx
index 380ff849c..504cbafd5 100644
--- a/space_flow/src/components/chatComponent/index.tsx
+++ b/space_flow/src/components/chatComponent/index.tsx
@@ -6,7 +6,7 @@ import {
} from "@heroicons/react/24/outline";
import { useState } from "react";
-export default function Chat() {
+export default function Chat({nodes, edges}) {
const [open, setOpen] = useState(true);
return (
<>
@@ -53,7 +53,7 @@ export default function Chat() {
placeholder="Send a message..."
/>
-
))}
+
+
+
+
+ onDragStart(event, {
+ type: 'elements',
+ name: 'str',
+ types: types
+ })
+ }
+ >
+
+ String
+
+
+
+
+
+
+ onDragStart(event, {
+ type: 'elements',
+ name: 'chatInput',
+ })
+ }
+ >
+
+ Chat Input
+
+
+
+
+
+
+ onDragStart(event, {
+ type: 'elements',
+ name: 'chatOutput',
+ })
+ }
+ >
+
+ Chat Output
+
+
+
+
+
+
);
}
diff --git a/space_flow/src/pages/FlowPage/index.tsx b/space_flow/src/pages/FlowPage/index.tsx
index 3fc06b404..6893e53a0 100644
--- a/space_flow/src/pages/FlowPage/index.tsx
+++ b/space_flow/src/pages/FlowPage/index.tsx
@@ -2,6 +2,7 @@ import { useCallback, useContext, useEffect, useRef, useState } from "react";
import ReactFlow, {
Background,
Controls,
+ Edge,
addEdge,
useEdgesState,
useNodesState,
@@ -12,8 +13,14 @@ import Chat from "../../components/chatComponent";
import GenericNode from "../../CustomNodes/GenericNode";
import connection from "./components/connection";
import { getConnectedNodes } from "../../utils";
+import ChatInputNode from "../../CustomNodes/ChatInputNode";
+import ChatOutputNode from "../../CustomNodes/ChatOutputNode";
+import InputNode from "../../CustomNodes/InputNode";
const nodeTypes = {
genericNode:GenericNode,
+ inputNode: InputNode,
+ chatInputNode:ChatInputNode,
+ chatOutputNode:ChatOutputNode,
};
export default function FlowPage() {
@@ -60,11 +67,12 @@ export default function FlowPage() {
x: event.clientX - reactflowBounds.left,
y: event.clientY - reactflowBounds.top,
});
+ let newId = getId();
const newNode = {
- id: getId(),
- type: 'genericNode',
+ id: newId,
+ type: data.name === 'str' ? 'inputNode' : (data.name === 'chatInput' ? 'chatInputNode' : (data.name === 'chatOutput' ? 'chatOutputNode' : 'genericNode')),
position,
- data: { ...data, onDelete: () => console.log("asdsdsadad"), onRun: () => {} },
+ data: { ...data, onDelete: () => {setNodes(reactFlowInstance.getNodes().filter((n)=>n.id !== newId))} },
};
setNodes((nds) => nds.concat(newNode));
},
@@ -89,7 +97,7 @@ export default function FlowPage() {
-
+
);
}
diff --git a/space_flow/src/utils.ts b/space_flow/src/utils.ts
index c53082219..343913ca1 100644
--- a/space_flow/src/utils.ts
+++ b/space_flow/src/utils.ts
@@ -1,4 +1,4 @@
-import { RocketLaunchIcon, LinkIcon, CpuChipIcon, LightBulbIcon, CommandLineIcon, WrenchScrewdriverIcon } from "@heroicons/react/24/outline";
+import { RocketLaunchIcon, LinkIcon, CpuChipIcon, LightBulbIcon, CommandLineIcon, WrenchScrewdriverIcon, ComputerDesktopIcon } from "@heroicons/react/24/outline";
import { Edge, Node } from "reactflow";
export function classNames(...classes) {
@@ -94,6 +94,7 @@ export function classNames(...classes) {
agents: "#903BBE",
tools: "#FF3434",
memories: "#FF9135",
+ elements: "#6344BE"
}
export const nodeNames = {
@@ -103,6 +104,7 @@ export function classNames(...classes) {
agents: "Agents",
tools: "Tools",
memories: "Memories",
+ elements: "Elements",
}
@@ -113,6 +115,7 @@ export function classNames(...classes) {
llms: LightBulbIcon,
prompts: CommandLineIcon,
tools: WrenchScrewdriverIcon,
+ elements: ComputerDesktopIcon
}
export const bgColors = {