@@ -279,53 +279,6 @@ export function resolveAssistantTextAvatar(value: string | null | undefined): st
|
279 | 279 | return trimmed; |
280 | 280 | } |
281 | 281 | |
282 | | -function isLikelyEmoji(value: string) { |
283 | | -const trimmed = value.trim(); |
284 | | -if (!trimmed) { |
285 | | -return false; |
286 | | -} |
287 | | -if (trimmed.length > 16) { |
288 | | -return false; |
289 | | -} |
290 | | -let hasNonAscii = false; |
291 | | -for (let i = 0; i < trimmed.length; i += 1) { |
292 | | -if (trimmed.charCodeAt(i) > 127) { |
293 | | -hasNonAscii = true; |
294 | | -break; |
295 | | -} |
296 | | -} |
297 | | -if (!hasNonAscii) { |
298 | | -return false; |
299 | | -} |
300 | | -if (trimmed.includes("://") || trimmed.includes("/") || trimmed.includes(".")) { |
301 | | -return false; |
302 | | -} |
303 | | -return true; |
304 | | -} |
305 | | - |
306 | | -export function resolveAgentEmoji( |
307 | | -agent: { identity?: { emoji?: string; avatar?: string } }, |
308 | | -agentIdentity?: AgentIdentityResult | null, |
309 | | -) { |
310 | | -const identityEmoji = normalizeOptionalString(agentIdentity?.emoji); |
311 | | -if (identityEmoji && isLikelyEmoji(identityEmoji)) { |
312 | | -return identityEmoji; |
313 | | -} |
314 | | -const agentEmoji = normalizeOptionalString(agent.identity?.emoji); |
315 | | -if (agentEmoji && isLikelyEmoji(agentEmoji)) { |
316 | | -return agentEmoji; |
317 | | -} |
318 | | -const identityAvatar = normalizeOptionalString(agentIdentity?.avatar); |
319 | | -if (identityAvatar && isLikelyEmoji(identityAvatar)) { |
320 | | -return identityAvatar; |
321 | | -} |
322 | | -const avatar = normalizeOptionalString(agent.identity?.avatar); |
323 | | -if (avatar && isLikelyEmoji(avatar)) { |
324 | | -return avatar; |
325 | | -} |
326 | | -return ""; |
327 | | -} |
328 | | - |
329 | 282 | function resolveAgentTextAvatar( |
330 | 283 | agent: { identity?: { emoji?: string; avatar?: string } }, |
331 | 284 | agentIdentity?: AgentIdentityResult | null, |
@@ -349,14 +302,6 @@ export function agentBadgeText(agentId: string, defaultId: string | null) {
|
349 | 302 | return defaultId && agentId === defaultId ? "default" : null; |
350 | 303 | } |
351 | 304 | |
352 | | -export function agentAvatarHue(id: string): number { |
353 | | -let hash = 0; |
354 | | -for (let i = 0; i < id.length; i += 1) { |
355 | | -hash = (hash * 31 + id.charCodeAt(i)) | 0; |
356 | | -} |
357 | | -return ((hash % 360) + 360) % 360; |
358 | | -} |
359 | | - |
360 | 305 | export function formatBytes(bytes?: number) { |
361 | 306 | if (bytes == null || !Number.isFinite(bytes)) { |
362 | 307 | return "-"; |
|