From bba9c449e3f2c0c14333d613fdbe458cbfbf4732 Mon Sep 17 00:00:00 2001 From: xmanrui <841206367@qq.com> Date: Mon, 16 Mar 2026 22:23:20 +0800 Subject: [PATCH] fix: avoid duplicate pixel office agent labels --- docs/test.txt | 10 ---------- lib/pixel-office/agentBridge.ts | 7 +++++-- 2 files changed, 5 insertions(+), 12 deletions(-) delete mode 100644 docs/test.txt diff --git a/docs/test.txt b/docs/test.txt deleted file mode 100644 index 369a2b1..0000000 --- a/docs/test.txt +++ /dev/null @@ -1,10 +0,0 @@ - curl https://gpt.qt.cool/v1/chat/completions \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer sk-qt-cool-rAesCG1982qKfefUDoKa2zREJMkMTDMY" \ - -d '{ - "model": "gpt-5.3-codex", - "messages": [ - {"role": "user", "content": "hi"} - ], - "max_tokens": 16 - }' \ No newline at end of file diff --git a/lib/pixel-office/agentBridge.ts b/lib/pixel-office/agentBridge.ts index 44c66d2..af38344 100644 --- a/lib/pixel-office/agentBridge.ts +++ b/lib/pixel-office/agentBridge.ts @@ -66,10 +66,13 @@ export function syncAgentsToOffice( office.addAgent(charId, undefined, undefined, undefined, undefined, wasOffline || isNew) } - // Set label (agent name with id in parentheses) + // Set label, avoiding duplicated values like "main (main)" const ch = office.characters.get(charId) if (ch) { - ch.label = activity.name ? `${activity.name} (${activity.agentId})` : activity.agentId + const displayName = activity.name?.trim() + ch.label = displayName && displayName !== activity.agentId + ? `${displayName} (${activity.agentId})` + : activity.agentId } switch (activity.state) {