diff --git a/ui/web/src/components/chat/agent-selector.tsx b/ui/web/src/components/chat/agent-selector.tsx index 3d08db5c..8429929a 100644 --- a/ui/web/src/components/chat/agent-selector.tsx +++ b/ui/web/src/components/chat/agent-selector.tsx @@ -11,6 +11,11 @@ interface AgentSelectorProps { onChange: (agentId: string) => void; } +/** Extract emoji from agent's other_config JSONB */ +function agentEmoji(agent: AgentData): string | undefined { + return (agent.other_config?.emoji as string) || undefined; +} + export function AgentSelector({ value, onChange }: AgentSelectorProps) { const { t } = useTranslation("common"); const http = useHttp(); @@ -28,7 +33,6 @@ export function AgentSelector({ value, onChange }: AgentSelectorProps) { .then((res) => { const active = (res.agents ?? []).filter((a) => a.status === "active"); setAgents(active); - // Auto-select first agent if current value doesn't match any active agent if (active.length > 0 && !active.some((a) => a.agent_key === value)) { onChange(active[0]!.agent_key); } @@ -36,7 +40,6 @@ export function AgentSelector({ value, onChange }: AgentSelectorProps) { .catch(() => {}); }, [http, connected]); - // Compute dropdown position for portal rendering useLayoutEffect(() => { if (!open || !containerRef.current) return; const rect = containerRef.current.getBoundingClientRect(); @@ -49,7 +52,6 @@ export function AgentSelector({ value, onChange }: AgentSelectorProps) { }); }, [open]); - // Close on outside click useEffect(() => { if (!open) return; const handler = (e: MouseEvent) => { @@ -66,6 +68,7 @@ export function AgentSelector({ value, onChange }: AgentSelectorProps) { }, [open]); const selected = agents.find((a) => a.agent_key === value); + const selectedEmoji = selected ? agentEmoji(selected) : undefined; return (
- {content}
-
-