Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add v1 Drag and Drop Team Composition to AGS #4609

Merged
merged 17 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@
import aiofiles
import yaml
from autogen_agentchat.agents import AssistantAgent, UserProxyAgent
from autogen_agentchat.conditions import MaxMessageTermination, StopMessageTermination, TextMentionTermination
from autogen_agentchat.conditions import (
ExternalTermination,
HandoffTermination,
MaxMessageTermination,
SourceMatchTermination,
StopMessageTermination,
TextMentionTermination,
TimeoutTermination,
TokenUsageTermination,
)
from autogen_agentchat.teams import MagenticOneGroupChat, RoundRobinGroupChat, SelectorGroupChat
from autogen_core.tools import FunctionTool
from autogen_core.components.tools import FunctionTool
from autogen_ext.agents.file_surfer import FileSurfer
from autogen_ext.agents.magentic_one import MagenticOneCoderAgent
from autogen_ext.agents.web_surfer import MultimodalWebSurfer
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.models import OpenAIChatCompletionClient

from ..datamodel.types import (
AgentConfig,
Expand All @@ -38,7 +47,17 @@
AgentComponent = Union[AssistantAgent, MultimodalWebSurfer, UserProxyAgent, FileSurfer, MagenticOneCoderAgent]
ModelComponent = Union[OpenAIChatCompletionClient]
ToolComponent = Union[FunctionTool] # Will grow with more tool types
TerminationComponent = Union[MaxMessageTermination, StopMessageTermination, TextMentionTermination]
TerminationComponent = Union[
MaxMessageTermination,
StopMessageTermination,
TextMentionTermination,
TimeoutTermination,
ExternalTermination,
TokenUsageTermination,
HandoffTermination,
SourceMatchTermination,
StopMessageTermination,
]

Component = Union[TeamComponent, AgentComponent, ModelComponent, ToolComponent, TerminationComponent]

Expand Down
2 changes: 1 addition & 1 deletion python/packages/autogen-studio/autogenstudio/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = "0.4.0.dev38"
VERSION = "0.4.0.dev41"
__version__ = VERSION
APP_NAME = "autogenstudio"
1 change: 1 addition & 0 deletions python/packages/autogen-studio/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"@dagrejs/dagre": "^1.1.4",
"@dnd-kit/core": "^6.2.0",
"@headlessui/react": "^2.2.0",
"@heroicons/react": "^2.0.18",
"@mdx-js/react": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ContentHeader = ({
</button>

{/* Desktop Sidebar Toggle - Hidden on Mobile */}
<div className="hidden md:block">
{/* <div className="hidden md:block">
<Tooltip title={isExpanded ? "Close Sidebar" : "Open Sidebar"}>
<button
onClick={() => setSidebarState({ isExpanded: !isExpanded })}
Expand All @@ -65,7 +65,7 @@ const ContentHeader = ({
)}
</button>
</Tooltip>
</div>
</div> */}

<div className="flex flex-1 gap-x-4 self-stretch lg:gap-x-6">
{/* Breadcrumbs */}
Expand Down
13 changes: 11 additions & 2 deletions python/packages/autogen-studio/frontend/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Footer from "./footer";
import "antd/dist/reset.css";
import SideBar from "./sidebar";
import ContentHeader from "./contentheader";
import { ConfigProvider, theme } from "antd";

const classNames = (...classes: (string | undefined | boolean)[]) => {
return classes.filter(Boolean).join(" ");
Expand Down Expand Up @@ -91,13 +92,21 @@ const Layout = ({
>
{showHeader && (
<ContentHeader
title={title}
isMobileMenuOpen={isMobileMenuOpen}
onMobileMenuToggle={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
/>
)}

<main className="flex-1 p-2 text-primary">{children}</main>
<ConfigProvider
theme={{
algorithm:
darkMode === "dark"
? theme.darkAlgorithm
: theme.defaultAlgorithm,
}}
>
<main className="flex-1 p-2 text-primary">{children}</main>
</ConfigProvider>

<Footer />
</div>
Expand Down
110 changes: 79 additions & 31 deletions python/packages/autogen-studio/frontend/src/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import React from "react";
import { Link } from "gatsby";
import { useConfigStore } from "../hooks/store";
import { Tooltip } from "antd";
import { Settings, MessagesSquare } from "lucide-react";
import {
Settings,
MessagesSquare,
Blocks,
Bot,
PanelLeftClose,
PanelLeftOpen,
} from "lucide-react";
import Icon from "./icons";

interface INavItem {
Expand All @@ -23,6 +30,12 @@ const navigation: INavItem[] = [
icon: MessagesSquare,
breadcrumbs: [{ name: "Playground", href: "/", current: true }],
},
{
name: "Agent Teams",
href: "/build",
icon: Bot,
breadcrumbs: [{ name: "Build", href: "/build", current: true }],
},
];

const classNames = (...classes: (string | undefined | boolean)[]) => {
Expand Down Expand Up @@ -51,9 +64,9 @@ const Sidebar = ({ link, meta, isMobile }: SidebarProps) => {
const showFull = isMobile || isExpanded;

const handleNavClick = (item: INavItem) => {
if (!isExpanded) {
setSidebarState({ isExpanded: true });
}
// if (!isExpanded) {
// setSidebarState({ isExpanded: true });
// }
setHeader({
title: item.name,
breadcrumbs: item.breadcrumbs,
Expand Down Expand Up @@ -126,12 +139,12 @@ const Sidebar = ({ link, meta, isMobile }: SidebarProps) => {
onClick={() => handleNavClick(item)}
className={classNames(
// Base styles
"group flex gap-x-3 rounded-md p-2 text-sm font-medium",
"group flex gap-x-3 rounded-md mr-2 p-2 text-sm font-medium",
!showFull && "justify-center",
// Color states
isActive
? "bg-secondary/50 text-accent"
: "text-secondary hover:bg-secondary/50 hover:text-accent"
? "bg-tertiary text-accent "
: "text-secondary hover:bg-tertiary hover:text-accent"
)}
>
<IconComponent
Expand Down Expand Up @@ -165,11 +178,53 @@ const Sidebar = ({ link, meta, isMobile }: SidebarProps) => {
<li
className={classNames(
"mt-auto -mx-2 mb-4",
!showFull && "flex justify-center"
!showFull && "flex flex-col items-center gap-1"
)}
>
{!showFull && !isMobile ? (
<Tooltip title="Settings" placement="right">
<>
<Tooltip title="Settings" placement="right">
<Link
to="/settings"
onClick={() =>
setHeader({
title: "Settings",
breadcrumbs: [
{
name: "Settings",
href: "/settings",
current: true,
},
],
})
}
className="group flex gap-x-3 rounded-md p-2 text-sm font-medium text-primary hover:text-accent hover:bg-secondary justify-center"
>
<Settings className="h-6 w-6 shrink-0 text-secondary group-hover:text-accent" />
</Link>
</Tooltip>
<div className="hidden md:block">
<Tooltip
title={isExpanded ? "Close Sidebar" : "Open Sidebar"}
placement="right"
>
<button
onClick={() =>
setSidebarState({ isExpanded: !isExpanded })
}
className="p-2 rounded-md hover:bg-secondary hover:text-accent text-secondary transition-colors focus:outline-none focus:ring-2 focus:ring-accent focus:ring-opacity-50"
>
{isExpanded ? (
<PanelLeftClose strokeWidth={1.5} className="h-6 w-6" />
) : (
<PanelLeftOpen strokeWidth={1.5} className="h-6 w-6" />
)}
</button>
</Tooltip>
</div>
</>
) : (
<div className="flex items-center gap-2">
<Link
to="/settings"
onClick={() =>
Expand All @@ -180,31 +235,24 @@ const Sidebar = ({ link, meta, isMobile }: SidebarProps) => {
],
})
}
className={classNames(
"group flex gap-x-3 rounded-md p-2 text-sm font-medium",
"text-primary hover:text-accent hover:bg-secondary",
!showFull && "justify-center"
)}
className="group flex flex-1 gap-x-3 rounded-md p-2 text-sm font-medium text-primary hover:text-accent hover:bg-secondary"
>
<Settings className="h-6 w-6 shrink-0 text-secondary group-hover:text-accent" />
{showFull && "Settings"}
</Link>
</Tooltip>
) : (
<Link
to="/settings"
onClick={() =>
setHeader({
title: "Settings",
breadcrumbs: [
{ name: "Settings", href: "/settings", current: true },
],
})
}
className="group flex gap-x-3 rounded-md p-2 text-sm font-medium text-primary hover:text-accent hover:bg-secondary"
>
<Settings className="h-6 w-6 shrink-0 text-secondary group-hover:text-accent" />
{showFull && "Settings"}
</Link>
<div className="hidden md:block">
<button
onClick={() => setSidebarState({ isExpanded: !isExpanded })}
className="p-2 rounded-md hover:bg-secondary hover:text-accent text-secondary transition-colors focus:outline-none focus:ring-2 focus:ring-accent focus:ring-opacity-50"
>
{isExpanded ? (
<PanelLeftClose strokeWidth={1.5} className="h-6 w-6" />
) : (
<PanelLeftOpen strokeWidth={1.5} className="h-6 w-6" />
)}
</button>
</div>
</div>
)}
</li>
</ul>
Expand Down
Loading
Loading