Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(bots): 群聊头像沿圆周均匀聚拢叠放

Dash6d984b2d9621
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx b/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx
index b42d0d4594..f83eea49d2 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx
@@ -11,7 +11,7 @@ import { BotAvatar } from './BotAvatar';
type AvatarMember = Pick<BotGroupMemberView, 'botId' | 'name' | 'avatar' | 'avatarColor'>;
-/** 固定头像区域:双人斜向叠放,多人错位重叠,描边区分前后层次。 */
+/** 固定头像区域:双人斜向叠放,多人沿圆周聚拢,描边区分前后层次。 */
export function BotGroupSidebarAvatar({
members,
selected = false,
@@ -38,32 +38,35 @@ export function BotGroupSidebarAvatar({
}
if (!second) return <BotAvatar bot={first} size={compact ? 'sm' : 'md'} />;
if (members.length >= 3) {
- const positions =
- members.length === 3
- ? ['left-0 top-0', 'right-0 top-[15%]', 'bottom-0 left-[15%]']
- : ['left-0 top-0', 'right-0 top-[5%]', 'bottom-[5%] left-0', 'bottom-0 right-0'];
+ const visible = members.slice(0, 5);
+ // 以 40px 头像区为基准:3/4/5 人分别用 24/22/20px,收起时同比缩放。
+ const diameter = visible.length === 3 ? 60 : visible.length === 4 ? 55 : 50;
+ const radius = (100 - diameter) / 2;
return (
<span aria-hidden className={cn('relative flex shrink-0', frameClass)}>
- {members.slice(0, 4).map((member, index) => (
- <span
- key={member.botId}
- className={cn(
- 'absolute flex rounded-full',
- compact ? 'border-[1.5px]' : 'border-2',
- members.length === 3 ? 'h-[65%] w-[65%]' : 'h-[60%] w-[60%]',
- selected
- ? 'border-sidebar-item-active'
- : 'border-sidebar group-hover:border-sidebar-item-hover',
- positions[index],
- )}
- >
- <BotAvatar
- bot={member}
- size="xs"
- className={cn('h-full w-full', compact ? 'text-10' : 'text-12')}
- />
- </span>
- ))}
+ {visible.map((member, index) => {
+ const angle = (-3 * Math.PI) / 4 + (index * 2 * Math.PI) / visible.length;
+ return (
+ <span
+ key={member.botId}
+ className={cn(
+ 'absolute flex rounded-full',
+ compact ? 'border-[1.5px]' : 'border-2',
+ selected
+ ? 'border-sidebar-item-active'
+ : 'border-sidebar group-hover:border-sidebar-item-hover',
+ )}
+ style={{
+ width: `${diameter}%`,
+ height: `${diameter}%`,
+ left: `${radius * (1 + Math.cos(angle))}%`,
+ top: `${radius * (1 + Math.sin(angle))}%`,
+ }}
+ >
+ <BotAvatar bot={member} size="xs" className="h-full w-full text-11" />
+ </span>
+ );
+ })}
</span>
);
}
diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.md
index 538282bab5..ed6c6cc9e2 100644
--- a/docs/product-rules/bot-group-chat.md
+++ b/docs/product-rules/bot-group-chat.md
@@ -192,7 +192,8 @@
- 群聊行与伙伴私聊混排在侧栏「伙伴」段(置顶上方,与任务列表共用一个侧栏,见
[cindy-bots-runtime.md](cindy-bots-runtime.md#导航未读与系统角标));段头加号提供新建伙伴与新建群聊。群行显示成员组合头像、群名与最近一条消息:
- 两人斜向叠放、三人错位重叠、四人及以上显示前四人的错位叠放,沿用与侧栏背景同色的描边区分前后层次。
+ 两人斜向叠放;三人及以上围绕同一圆心等角度重叠,最多展示前五人,整体呈圆形聚拢。
+ 头像随展示人数适度缩小,沿用与侧栏背景同色的描边区分前后层次。
展开列表与收起头像行使用相同规则,头像区域和行高不随人数增加。
有伙伴正在发言时显示运行中标记。未读角标是真实条数:宿主随摘要给出最近(至多 99 条)别人发来的消息时间
(`incomingMessageTimes`),与本机读位比较;旧宿主没有这份列表时只显示 1。伙伴发的安排卡与回复同样算来信: