mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-03 05:20:01 +00:00
feat(agents): display emoji icon from other_config in agent list and detail views
Show the emoji from other_config.emoji instead of the default Bot icon in agent-card (grid), agent-list-row (list), and agent-detail-page (header). Falls back to Bot icon when no emoji is set.
This commit is contained in:
1 parent
473658450f
commit
633872cb98
3 files changed
+12
-5
No files matched your search
@@ -18,7 +18,9 @@ export function AgentCard({ agent, onClick, onResummon, onDelete }: AgentCardPro
|
||||
const { t } = useTranslation("agents");
|
||||
const displayName = agent.display_name
|
||||
|| (UUID_RE.test(agent.agent_key) ? t("card.unnamedAgent") : agent.agent_key);
|
||||
const selfEvolve = agent.agent_type === "predefined" && Boolean((agent.other_config as Record<string, unknown> | null)?.self_evolve);
|
||||
const otherCfg = (agent.other_config ?? {}) as Record<string, unknown>;
|
||||
const selfEvolve = agent.agent_type === "predefined" && Boolean(otherCfg.self_evolve);
|
||||
const emoji = typeof otherCfg.emoji === "string" ? otherCfg.emoji : "";
|
||||
|
||||
// Show agent_key as subtitle only if there's a display_name and agent_key is meaningful
|
||||
const showSubtitle = agent.display_name && !UUID_RE.test(agent.agent_key);
|
||||
@@ -32,7 +34,7 @@ export function AgentCard({ agent, onClick, onResummon, onDelete }: AgentCardPro
|
||||
{/* Top row: icon + name + status */}
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary">
|
||||
<Bot className="h-4.5 w-4.5" />
|
||||
{emoji ? <span className="text-lg leading-none">{emoji}</span> : <Bot className="h-4.5 w-4.5" />}
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -67,6 +67,9 @@ export function AgentDetailPage({ agentId, onBack }: AgentDetailPageProps) {
|
||||
|
||||
const title = agentDisplayName(agent, t("card.unnamedAgent"));
|
||||
const subtitle = agentSubtitle(agent);
|
||||
const emoji = typeof (agent.other_config as Record<string, unknown> | null)?.emoji === "string"
|
||||
? (agent.other_config as Record<string, unknown>).emoji as string
|
||||
: "";
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
@@ -77,7 +80,7 @@ export function AgentDetailPage({ agentId, onBack }: AgentDetailPageProps) {
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<div className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
|
||||
<Bot className="h-6 w-6" />
|
||||
{emoji ? <span className="text-2xl leading-none">{emoji}</span> : <Bot className="h-6 w-6" />}
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -19,7 +19,9 @@ export function AgentListRow({ agent, ownerName, onClick, onResummon, onDelete }
|
||||
const { t } = useTranslation("agents");
|
||||
const displayName = agent.display_name
|
||||
|| (UUID_RE.test(agent.agent_key) ? t("card.unnamedAgent") : agent.agent_key);
|
||||
const selfEvolve = agent.agent_type === "predefined" && Boolean((agent.other_config as Record<string, unknown> | null)?.self_evolve);
|
||||
const otherCfg = (agent.other_config ?? {}) as Record<string, unknown>;
|
||||
const selfEvolve = agent.agent_type === "predefined" && Boolean(otherCfg.self_evolve);
|
||||
const emoji = typeof otherCfg.emoji === "string" ? otherCfg.emoji : "";
|
||||
|
||||
return (
|
||||
<button
|
||||
@@ -29,7 +31,7 @@ export function AgentListRow({ agent, ownerName, onClick, onResummon, onDelete }
|
||||
>
|
||||
{/* Icon */}
|
||||
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary">
|
||||
<Bot className="h-4 w-4" />
|
||||
{emoji ? <span className="text-base leading-none">{emoji}</span> : <Bot className="h-4 w-4" />}
|
||||
</div>
|
||||
|
||||
{/* Name + key */}
|
||||
|
||||
Reference in new issue
Block a user