-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from Algoture/main
feat: add AI agent management page
- Loading branch information
Showing
8 changed files
with
237 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
"use client"; | ||
|
||
import AgentsCreateDialog from "@/components/custom/agents/AgentsCreateDialog"; | ||
import { Badge } from "@/components/ui/badge"; | ||
import { Card } from "@/components/ui/card"; | ||
import { ImagePlus } from "lucide-react"; | ||
type Agent = { | ||
id: string; | ||
img: JSX.Element; | ||
state: string; | ||
name: string; | ||
description: string; | ||
}; | ||
|
||
const agents: Agent[] = [ | ||
{ | ||
id: "1", | ||
name: "AI Assistant", | ||
description: | ||
"A conversational AI for answering customer queries. A conversational AI for answering customer queries. A conversational AI for answering customer queries.", | ||
img: <ImagePlus className="size-6 text-gray-900 " />, | ||
state: "Active", | ||
}, | ||
{ | ||
id: "2", | ||
name: "NLP", | ||
description: "An AI agent that provides product recommendations.", | ||
img: <ImagePlus className="size-6 text-gray-900 " />, | ||
state: "Inactive", | ||
}, | ||
{ | ||
id: "3", | ||
name: "Vision AI", | ||
description: "An AI agent for image recognition tasks.", | ||
img: <ImagePlus className="size-6 text-gray-900 " />, | ||
state: "Active", | ||
}, | ||
{ | ||
id: "4", | ||
name: "Sentiment Analyzer", | ||
description: "Analyzes customer feedback and determines sentiment.", | ||
img: <ImagePlus className="size-6 text-gray-900 " />, | ||
state: "Active", | ||
}, | ||
]; | ||
export default function page() { | ||
return ( | ||
<div className="flex flex-col h-full w-full items-start overflow-hidden px-5 md:px-2"> | ||
<AgentsCreateDialog /> | ||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 w-full"> | ||
{agents.map((ag) => { | ||
return ( | ||
<Card | ||
key={ag.id} | ||
className=" cursor-pointer p-2 sm:p-3 h-auto justify-between space-y-1.5 flex flex-col" | ||
> | ||
<div className="flex items-center gap-2"> | ||
<div className="rounded-lg w-fit bg-slate-100 p-1"> | ||
{ag.img} | ||
</div> | ||
<h3 className="text-sm font-semibold ">{ag.name}</h3> | ||
</div> | ||
<p className="text-xs line-clamp-3">{ag.description}</p> | ||
<div className="flex gap-2"> | ||
<Badge | ||
variant={`${ag.state === "Active" ? "secondary" : "destructive"}`} | ||
> | ||
{ag.state} | ||
</Badge> | ||
</div> | ||
</Card> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
apps/app/components/custom/agents/AgentsCreateDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
"use client"; | ||
import InfoBreadCrumb from "@/components/custom/infobar/bread-crumb"; | ||
import { useState } from "react"; | ||
import { | ||
AlertDialog, | ||
AlertDialogAction, | ||
AlertDialogCancel, | ||
AlertDialogContent, | ||
AlertDialogDescription, | ||
AlertDialogFooter, | ||
AlertDialogTitle, | ||
AlertDialogTrigger, | ||
} from "@/components/ui/alert-dialog"; | ||
|
||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuRadioGroup, | ||
DropdownMenuRadioItem, | ||
DropdownMenuTrigger, | ||
} from "@/components/ui/dropdown-menu"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import { Textarea } from "@/components/ui/textarea"; | ||
import { Plus } from "lucide-react"; | ||
export default function AgentsCreateDialog() { | ||
return ( | ||
<> | ||
<AlertDialog> | ||
<div className="flex w-full items-center justify-between"> | ||
<InfoBreadCrumb /> | ||
<AlertDialogTrigger asChild> | ||
<Button className="flex items-center gap-2"> | ||
Create | ||
<Plus/> | ||
</Button> | ||
</AlertDialogTrigger> | ||
</div> | ||
|
||
<AlertDialogContent> | ||
<AlertDialogTitle>Create Agent</AlertDialogTitle> | ||
<AlertDialogDescription> | ||
Fill in the details to create a new agent. | ||
</AlertDialogDescription> | ||
<div className="space-y-2"> | ||
<div> | ||
<Label htmlFor="agent-name">Agent Name</Label> | ||
<Input id="agent-name" placeholder="Enter agent name" /> | ||
</div> | ||
<div> | ||
<Label htmlFor="system-prompt">System Prompt</Label> | ||
<Textarea | ||
id="system-prompt" | ||
placeholder="Enter system prompt" | ||
className="border" | ||
/> | ||
</div> | ||
<div> | ||
<Label>Model</Label> | ||
<ModelDropDownMenu /> | ||
</div> | ||
<div> | ||
<Label htmlFor="api-key">API Key</Label> | ||
<Input id="api-key" placeholder="Enter API key" /> | ||
</div> | ||
<div> | ||
<Label htmlFor="image">Image</Label> | ||
<Input id="image" type="file" /> | ||
</div> | ||
</div> | ||
<AlertDialogFooter className="flex gap-4"> | ||
<AlertDialogCancel className="w-full">Cancel</AlertDialogCancel> | ||
<AlertDialogAction className="w-full">Create</AlertDialogAction> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
</> | ||
); | ||
} | ||
|
||
function ModelDropDownMenu() { | ||
const [model, setModel] = useState<string>("Claude"); | ||
const models = [ | ||
"Claude", | ||
"Bert", | ||
"Perplexity AI", | ||
"Bard", | ||
"Google Gemini", | ||
"OpenAI", | ||
]; | ||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button | ||
variant="outline" | ||
className="w-full flex items-center justify-between" | ||
> | ||
{model} | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent> | ||
<DropdownMenuRadioGroup | ||
value={model} | ||
onValueChange={(val) => setModel(val)} | ||
> | ||
{models.map((m) => ( | ||
<DropdownMenuRadioItem key={m} value={m}> | ||
{m} | ||
</DropdownMenuRadioItem> | ||
))} | ||
</DropdownMenuRadioGroup> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.