Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: cover the expanded agent avatar palette on the release branch

AmAzing129a63a158db94d
diff --git a/src/features/AgentViewAll/coverColor.test.ts b/src/features/AgentViewAll/coverColor.test.ts
index aa3ba200079..4d701da5b64 100644
--- a/src/features/AgentViewAll/coverColor.test.ts
+++ b/src/features/AgentViewAll/coverColor.test.ts
@@ -1,5 +1,6 @@
import { DEFAULT_AVATAR } from '@lobechat/const';
import type { SidebarAgentItem } from '@lobechat/types';
+import { cssVar, getAgentAvatarTraits } from '@lobehub/ui';
import { describe, expect, it } from 'vitest';
import {
@@ -71,6 +72,16 @@ describe('coverImageSrc', () => {
});
describe('seedCoverColor', () => {
+ it('uses the theme token for the generated avatar color', () => {
+ for (let i = 0; i < 64; i++) {
+ const item = agent({ id: `agt_${i}` });
+ const { color } = getAgentAvatarTraits(item.id);
+ expect(seedCoverColor(item), `cover for ${color}`).toBe(
+ cssVar[color === 'ink' ? 'gray' : color],
+ );
+ }
+ });
+
it('is stable per agent id', () => {
expect(seedCoverColor(agent())).toBe(seedCoverColor(agent({ title: 'Renamed' })));
});
diff --git a/src/features/AgentViewAll/coverColor.ts b/src/features/AgentViewAll/coverColor.ts
index 16ab0e1e533..2480419a87a 100644
--- a/src/features/AgentViewAll/coverColor.ts
+++ b/src/features/AgentViewAll/coverColor.ts
@@ -1,5 +1,5 @@
import type { SidebarAgentItem } from '@lobechat/types';
-import { type AgentAvatarColor, cssVar, getAgentAvatarTraits } from '@lobehub/ui';
+import { cssVar, getAgentAvatarTraits } from '@lobehub/ui';
import { isDefaultAgentAvatar } from '@/components/AgentAvatar';
import { remoteAvatarSrc } from '@/components/Avatar/fallback';
@@ -9,13 +9,16 @@ import { remoteAvatarSrc } from '@/components/Avatar/fallback';
* gray scale: the cover is mixed toward the container color, which keeps both
* readable in either theme.
*/
-const SEED_COLORS: Record<AgentAvatarColor, string> = {
+const SEED_COLORS = {
+ cyan: cssVar.cyan,
geekblue: cssVar.geekblue,
gray: cssVar.gray,
+ green: cssVar.green,
ink: cssVar.gray,
magenta: cssVar.magenta,
orange: cssVar.orange,
purple: cssVar.purple,
+ red: cssVar.red,
volcano: cssVar.volcano,
};