-
Notifications
You must be signed in to change notification settings - Fork 44
Implement Agent Card UI for multi-agent configuration #99
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
Open
adishchowdhury
wants to merge
12
commits into
NexGenStudioDev:master
Choose a base branch
from
adishchowdhury:agent-card-ui-ecwoc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
dadfff3
Add AgentCard component for agent management
adishchowdhury 5a52b0f
Add Agents page for multi-agent UI
adishchowdhury ef68468
Import Agents component in UserRoutes
adishchowdhury 095fe76
Add Agents route to AppRoutes
adishchowdhury 798847b
Update LocalMind-Frontend/src/features/Dashboard/V1/Component/Pages/A…
adishchowdhury cc89ff5
Update LocalMind-Frontend/src/features/Dashboard/V1/Component/AgentCa…
adishchowdhury 5c5087b
Refactor Agent type to use string for id and AgentType
adishchowdhury d6b48c4
Import Agent type from types file
adishchowdhury 05e87bc
Add Agent and AgentType types for dashboard
adishchowdhury 48d304c
Refactor removeAgent to use agent ID instead of index
adishchowdhury 55c8ccb
Refactor updateAgent to use id instead of index
adishchowdhury de7ab97
Update agent change and remove handlers to use ID
adishchowdhury File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
| import Agents from "../features/Dashboard/V1/Component/Pages/Agents"; | ||
83 changes: 83 additions & 0 deletions
83
LocalMind-Frontend/src/features/Dashboard/V1/Component/AgentCard.tsx
This file contains hidden or 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,83 @@ | ||
| import React from "react"; | ||
|
|
||
| export type AgentType = "" | "planner" | "executor"; | ||
|
|
||
| export type Agent = { | ||
| id: string; | ||
| name: string; | ||
| type: AgentType; | ||
| systemPrompt: string; | ||
| task: string; | ||
| priority: number; | ||
| active: boolean; | ||
| tools: string[]; | ||
| }; | ||
|
|
||
|
|
||
| type Props = { | ||
| agent: Agent; | ||
| onChange: (agent: Agent) => void; | ||
| onRemove: () => void; | ||
| }; | ||
|
|
||
| const AgentCard: React.FC<Props> = ({ agent, onChange, onRemove }) => { | ||
| return ( | ||
| <div style={{ border: "1px solid #333", padding: 12, marginBottom: 12 }}> | ||
adishchowdhury marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <input | ||
| placeholder="Agent name" | ||
| value={agent.name} | ||
| onChange={(e) => onChange({ ...agent, name: e.target.value })} | ||
| /> | ||
|
|
||
| <br /> | ||
adishchowdhury marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <select | ||
| value={agent.type} | ||
| onChange={(e) => onChange({ ...agent, type: e.target.value })} | ||
| > | ||
| <option value="">Select type</option> | ||
| <option value="planner">Planner</option> | ||
| <option value="executor">Executor</option> | ||
| </select> | ||
|
|
||
| <br /> | ||
|
|
||
| <textarea | ||
| placeholder="System prompt" | ||
| value={agent.systemPrompt} | ||
| onChange={(e) => | ||
| onChange({ ...agent, systemPrompt: e.target.value }) | ||
| } | ||
| /> | ||
|
|
||
| <br /> | ||
|
|
||
| <input | ||
| type="number" | ||
| value={agent.priority} | ||
| onChange={(e) => | ||
| onChange({ ...agent, priority: Number(e.target.value) }) | ||
| } | ||
| /> | ||
|
|
||
| <br /> | ||
|
|
||
| <label> | ||
| <input | ||
| type="checkbox" | ||
| checked={agent.active} | ||
| onChange={(e) => | ||
| onChange({ ...agent, active: e.target.checked }) | ||
| } | ||
| /> | ||
| Enabled | ||
| </label> | ||
|
|
||
| <br /> | ||
|
|
||
| <button onClick={onRemove}>Remove</button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AgentCard; | ||
77 changes: 77 additions & 0 deletions
77
LocalMind-Frontend/src/features/Dashboard/V1/Component/Pages/Agents.tsx
This file contains hidden or 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 @@ | ||
| import { useMemo, useState } from "react"; | ||
| import AgentCard from "../AgentCard"; | ||
|
|
||
| type AgentType = "" | "planner" | "executor"; | ||
|
|
||
| import type { Agent } from "./types"; | ||
|
|
||
| const MAX_AGENTS = 7; | ||
|
|
||
| function createAgent(): Agent { | ||
| return { | ||
| id: typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`, | ||
|
|
||
| name: "", | ||
| type: "", | ||
| systemPrompt: "", | ||
| task: "", | ||
| priority: 1, | ||
| active: true, | ||
| tools: [], | ||
| }; | ||
| } | ||
|
|
||
| export default function Agents() { | ||
| const [agents, setAgents] = useState<Agent[]>([]); | ||
|
|
||
| const canAddMore = agents.length < MAX_AGENTS; | ||
|
|
||
| const headerText = useMemo(() => { | ||
| return `Agents (${agents.length}/${MAX_AGENTS})`; | ||
| }, [agents.length]); | ||
|
|
||
| const addAgent = () => { | ||
| setAgents((prev) => { | ||
| if (prev.length >= MAX_AGENTS) return prev; | ||
| return [...prev, createAgent()]; | ||
| }); | ||
| }; | ||
|
|
||
| const updateAgent = (id: string, updated: Agent) => { | ||
| setAgents((prev) => | ||
| prev.map((a) => (a.id === id ? updated : a)) | ||
| ); | ||
| }; | ||
| const removeAgent = (id: string) => { | ||
| setAgents((prev) => prev.filter((a) => a.id !== id)); | ||
| }; | ||
|
|
||
| return ( | ||
| <div style={{ display: "grid", gap: 12 }}> | ||
| <div style={{ display: "flex", alignItems: "center", gap: 12 }}> | ||
| <h1 style={{ margin: 0 }}>{headerText}</h1> | ||
|
|
||
| <div style={{ marginLeft: "auto" }}> | ||
| <button onClick={addAgent} disabled={!canAddMore}> | ||
| Add Agent | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| {agents.length === 0 ? ( | ||
| <p style={{ opacity: 0.75, margin: 0 }}> | ||
| No agents yet. Click “Add Agent” to create one. | ||
| </p> | ||
| ) : ( | ||
| agents.map((agent, index) => ( | ||
| <AgentCard | ||
| key={agent.id} | ||
| agent={agent} | ||
| onChange={(updated: Agent) => updateAgent(agent.id, updated)} | ||
| onRemove={() => removeAgent(agent.id)} | ||
| /> | ||
| )) | ||
| )} | ||
| </div> | ||
| ); | ||
| } |
12 changes: 12 additions & 0 deletions
12
LocalMind-Frontend/src/features/Dashboard/V1/Component/types.ts
This file contains hidden or 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,12 @@ | ||
| export type AgentType = "" | "planner" | "executor"; | ||
|
|
||
| export type Agent = { | ||
| id: string; | ||
| name: string; | ||
| type: AgentType; | ||
| systemPrompt: string; | ||
| task: string; | ||
| priority: number; | ||
| active: boolean; | ||
| tools: string[]; | ||
| }; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.