mirror of
https://git.mirrors.martin98.com/https://github.com/bytedance/deer-flow
synced 2025-08-20 01:59:12 +08:00
feat: add icons
This commit is contained in:
parent
0b6b9793c1
commit
7501f40296
@ -11,8 +11,17 @@ import {
|
|||||||
Handle,
|
Handle,
|
||||||
Position,
|
Position,
|
||||||
} from "@xyflow/react";
|
} from "@xyflow/react";
|
||||||
|
|
||||||
import "@xyflow/react/dist/style.css";
|
import "@xyflow/react/dist/style.css";
|
||||||
|
import {
|
||||||
|
ArrowLeftRight,
|
||||||
|
Brain,
|
||||||
|
UserCheck,
|
||||||
|
UserCog,
|
||||||
|
UserPen,
|
||||||
|
Users,
|
||||||
|
UserSearch,
|
||||||
|
type LucideIcon,
|
||||||
|
} from "lucide-react";
|
||||||
|
|
||||||
const ROW_HEIGHT = 75;
|
const ROW_HEIGHT = 75;
|
||||||
const ROW_1 = 0;
|
const ROW_1 = 0;
|
||||||
@ -26,48 +35,48 @@ const initialNodes = [
|
|||||||
id: "Start",
|
id: "Start",
|
||||||
type: "circle",
|
type: "circle",
|
||||||
data: { label: "Start" },
|
data: { label: "Start" },
|
||||||
position: { x: 80, y: ROW_1 },
|
position: { x: 25, y: ROW_1 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Coordinator",
|
id: "Coordinator",
|
||||||
data: { label: "Coordinator" },
|
data: { icon: ArrowLeftRight, label: "Coordinator" },
|
||||||
position: { x: 150, y: ROW_1 },
|
position: { x: 150, y: ROW_1 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Planner",
|
id: "Planner",
|
||||||
data: { label: "Planner" },
|
data: { icon: Brain, label: "Planner" },
|
||||||
position: { x: 150, y: ROW_2 },
|
position: { x: 150, y: ROW_2 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Reporter",
|
id: "Reporter",
|
||||||
data: { label: "Reporter" },
|
data: { icon: UserPen, label: "Reporter" },
|
||||||
position: { x: 25, y: ROW_3 },
|
position: { x: 275, y: ROW_3 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Human Feedback",
|
id: "HumanFeedback",
|
||||||
data: { label: "Human Feedback" },
|
data: { icon: UserCheck, label: "Human Feedback" },
|
||||||
position: { x: 275, y: ROW_4 },
|
position: { x: 25, y: ROW_4 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Research Team",
|
id: "ResearchTeam",
|
||||||
data: { label: "Research Team" },
|
data: { icon: Users, label: "Research Team" },
|
||||||
position: { x: 275, y: ROW_5 },
|
position: { x: 25, y: ROW_5 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Researcher",
|
id: "Researcher",
|
||||||
data: { label: "Researcher" },
|
data: { icon: UserSearch, label: "Researcher" },
|
||||||
position: { x: 175, y: ROW_6 },
|
position: { x: -75, y: ROW_6 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Coder",
|
id: "Coder",
|
||||||
data: { label: "Coder" },
|
data: { icon: UserCog, label: "Coder" },
|
||||||
position: { x: 375, y: ROW_6 },
|
position: { x: 125, y: ROW_6 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "End",
|
id: "End",
|
||||||
type: "circle",
|
type: "circle",
|
||||||
data: { label: "End" },
|
data: { label: "End" },
|
||||||
position: { x: 80, y: ROW_6 },
|
position: { x: 330, y: ROW_6 },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -92,30 +101,30 @@ const initialEdges = [
|
|||||||
id: "Planner->Reporter",
|
id: "Planner->Reporter",
|
||||||
source: "Planner",
|
source: "Planner",
|
||||||
target: "Reporter",
|
target: "Reporter",
|
||||||
|
sourceHandle: "right",
|
||||||
|
targetHandle: "top",
|
||||||
|
animated: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "Planner->HumanFeedback",
|
||||||
|
source: "Planner",
|
||||||
|
target: "HumanFeedback",
|
||||||
sourceHandle: "left",
|
sourceHandle: "left",
|
||||||
targetHandle: "top",
|
targetHandle: "top",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Planner->Human Feedback",
|
id: "HumanFeedback->Planner",
|
||||||
source: "Planner",
|
source: "HumanFeedback",
|
||||||
target: "Human Feedback",
|
|
||||||
sourceHandle: "bottom",
|
|
||||||
targetHandle: "left",
|
|
||||||
animated: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "Human Feedback->Planner",
|
|
||||||
source: "Human Feedback",
|
|
||||||
target: "Planner",
|
target: "Planner",
|
||||||
sourceHandle: "top",
|
sourceHandle: "right",
|
||||||
targetHandle: "right",
|
targetHandle: "bottom",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Human Feedback->Research Team",
|
id: "HumanFeedback->ResearchTeam",
|
||||||
source: "Human Feedback",
|
source: "HumanFeedback",
|
||||||
target: "Research Team",
|
target: "ResearchTeam",
|
||||||
sourceHandle: "bottom",
|
sourceHandle: "bottom",
|
||||||
targetHandle: "top",
|
targetHandle: "top",
|
||||||
animated: true,
|
animated: true,
|
||||||
@ -129,41 +138,41 @@ const initialEdges = [
|
|||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Research Team->Researcher",
|
id: "ResearchTeam->Researcher",
|
||||||
source: "Research Team",
|
source: "ResearchTeam",
|
||||||
target: "Researcher",
|
target: "Researcher",
|
||||||
sourceHandle: "left",
|
sourceHandle: "left",
|
||||||
targetHandle: "top",
|
targetHandle: "top",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Research Team->Coder",
|
id: "ResearchTeam->Coder",
|
||||||
source: "Research Team",
|
source: "ResearchTeam",
|
||||||
target: "Coder",
|
target: "Coder",
|
||||||
sourceHandle: "bottom",
|
sourceHandle: "bottom",
|
||||||
targetHandle: "left",
|
targetHandle: "left",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Research Team->Planner",
|
id: "ResearchTeam->Planner",
|
||||||
source: "Research Team",
|
source: "ResearchTeam",
|
||||||
target: "Planner",
|
target: "Planner",
|
||||||
sourceHandle: "left",
|
|
||||||
targetHandle: "bottom",
|
|
||||||
animated: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "Researcher->Research Team",
|
|
||||||
source: "Researcher",
|
|
||||||
target: "Research Team",
|
|
||||||
sourceHandle: "right",
|
sourceHandle: "right",
|
||||||
targetHandle: "bottom",
|
targetHandle: "bottom",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "Coder->Research Team",
|
id: "Researcher->ResearchTeam",
|
||||||
|
source: "Researcher",
|
||||||
|
target: "ResearchTeam",
|
||||||
|
sourceHandle: "right",
|
||||||
|
targetHandle: "bottom",
|
||||||
|
animated: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "Coder->ResearchTeam",
|
||||||
source: "Coder",
|
source: "Coder",
|
||||||
target: "Research Team",
|
target: "ResearchTeam",
|
||||||
sourceHandle: "top",
|
sourceHandle: "top",
|
||||||
targetHandle: "right",
|
targetHandle: "right",
|
||||||
animated: true,
|
animated: true,
|
||||||
@ -231,10 +240,15 @@ function CircleNode({ data }: { data: { label: string } }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AgentNode({ data }: { data: { label: string } }) {
|
function AgentNode({ data }: { data: { icon?: LucideIcon; label: string } }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="text-xs">{data.label}</div>
|
<div className="flex w-full items-center justify-center text-xs">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
{data.icon && <data.icon className="h-[1rem] w-[1rem]" />}
|
||||||
|
<span>{data.label}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<Handle
|
<Handle
|
||||||
className="invisible"
|
className="invisible"
|
||||||
type="source"
|
type="source"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user