Repository navigation
feat(dashboard): 数字员工与群组显示真实飞书头像 - #126
Merged
Merged
Conversation
- bot 头像:probeBotOpenId 抓取 /bot/v3/info 的 avatar_url,经 daemon 描述符 / IPC / /api/groups 透出;全站 8 个渲染点(概览数字员工卡、需要你处理、活跃会话、 会话列表、角色树、机器人默认页 roster/档案/错误卡)统一走 botAvatarHtml() - 群头像:listChats 抓取 im/v1/chats 的 avatar,群组页每行展示群头像;做成圆角 方形(orb-square)以区别于圆形的 bot 头像,便于区分群 - 防闪烁:头像 URL 存 localStorage 并在模块加载同步回灌,任意页面/刷新/切 tab 首屏即出图;移除淡入动画(SSE 重绘会重放);loading=lazy 改 decoding=async - 兜底:头像取不到 / 加载失败自动回退到原「数字生命球」渐变球 - 公开看板 redact 白名单放行群头像(与已公开的群名同敏感度) - 补 groups-store / public-redact 单测对 avatar 字段的断言 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
botAvatarUrlFor 原为 byAppId.get() ?? byName.get(),appId 落空时会串到 按名查;两个同名 bot 在 botAvatarByName 里 last-writer-wins,会互相借用 头像。核实 SessionRow.larkAppId 为必填、8 个渲染点全传真实 larkAppId, name 兜底在正常路径永不命中(appId/name 同源同写),唯一实际效果就是 这条碰撞。改为 appId 在场只认 appId(落空→渐变球兜底,绝不串名), 仅完全无 appId 的渲染点才退回按名查。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
dashboard 的「数字员工」卡此前用渐变「数字生命球」占位,群组列表只有文字。本次接入真实飞书头像,并解决头像刷新闪烁。
改动
bot 头像
probeBotOpenId抓取/bot/v3/info的avatar_url,经BotState→ daemon 描述符 → dashboard 注册表 →/api/groups透出botAvatarHtml(),全站 8 个渲染点统一接入(概览数字员工卡 / 需要你处理 / 活跃会话、会话列表、角色树、机器人默认页 roster/档案/错误卡)群头像
listChats抓取im/v1/chats的avatar(原本被丢弃),经/api/groups透出orb-square)以区别于圆形的 bot 头像,便于区分群防闪烁 / 缓存
<img>,动画会跟着重放,看着像头像在"刷新")loading="lazy"改decoding="async"cache-control: max-age=1209600, public(14 天),浏览器层已缓存测试
tsc --noEmit通过groups-store/dashboard-public-redact单测通过(补了avatar字段断言)/bot/v3/info返回avatar_url、im/v1/chats返回avatar,URL 公开可加载(HTTP 200 image/png)已知边界
dashboard 仍是「每次 SSE 推送整段
innerHTML重建」,头像<img>节点每次重建。本 PR 靠「图有 HTTP 缓存 + URL 有 localStorage + 去动画」做到重建即同帧出图、视觉不闪;若要在高频抖动下彻底零残影,需改成 DOM diff / keyed 更新(更大重构,未包含)。🤖 Generated with Claude Code