diff --git a/ui/admin/app/components/agent/Agent.tsx b/ui/admin/app/components/agent/Agent.tsx index ec58fde9..39bb3c37 100644 --- a/ui/admin/app/components/agent/Agent.tsx +++ b/ui/admin/app/components/agent/Agent.tsx @@ -1,5 +1,5 @@ import { LibraryIcon, PlusIcon, WrenchIcon } from "lucide-react"; -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { Agent as AgentType } from "~/lib/model/agents"; import { cn } from "~/lib/utils"; @@ -27,6 +27,15 @@ export function Agent({ className, onRefresh }: AgentProps) { const [agentUpdates, setAgentUpdates] = useState(agent); + useEffect(() => { + if (agent.id === agentUpdates.id) { + setAgentUpdates({ + ...agentUpdates, + aliasAssigned: agent.aliasAssigned ?? false, + }); + } + }, [agent]); + const partialSetAgent = useCallback( (changes: Partial) => { const updatedAgent = { ...agent, ...agentUpdates, ...changes }; diff --git a/ui/admin/app/components/agent/AgentContext.tsx b/ui/admin/app/components/agent/AgentContext.tsx index 1f56e8a5..cba85c70 100644 --- a/ui/admin/app/components/agent/AgentContext.tsx +++ b/ui/admin/app/components/agent/AgentContext.tsx @@ -58,7 +58,7 @@ export function AgentProvider({ AssistantApiService.getAssistants() ); - const refAgent = useMemo(() => { + const refAssistant = useMemo(() => { if (!getAssistants.data) return null; return getAssistants.data.find(({ id }) => id === agent.alias); @@ -53,14 +53,14 @@ export function AgentPublishStatus({ function renderAgentRef() { if (!agent.alias) return
; - if (refAgent && refAgent.id !== agent.id) { + if (refAssistant && refAssistant.entityID !== agent.id) { const route = - refAgent.type === "agent" + refAssistant.type === "agent" ? $path("/agents/:agent", { - agent: refAgent.entityID, + agent: refAssistant.entityID, }) : $path("/workflows/:workflow", { - workflow: refAgent.entityID, + workflow: refAssistant.entityID, }); return ( @@ -72,13 +72,13 @@ export function AgentPublishStatus({ - Ref name {refAgent.id} used by{" "} + Ref name {refAssistant.id} used by{" "} - {refAgent.name} + {refAssistant.name}