fix: avoid duplicate pixel office agent labels

This commit is contained in:
xmanrui
2026-03-16 22:23:20 +08:00
parent 6e5e862dda
commit bba9c449e3
2 changed files with 5 additions and 12 deletions
-10
View File
@@ -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
}'
+5 -2
View File
@@ -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) {