feat(im): render complete pretty chat transcripts - #2313
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe ChangesIM pretty transcript
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ImChatMessageListExecute
participant renderChatMessagesPretty
participant ThreadReplies
participant TranscriptOutput
ImChatMessageListExecute->>renderChatMessagesPretty: pass projected chat messages
renderChatMessagesPretty->>ThreadReplies: format loaded and unexpanded replies
renderChatMessagesPretty->>TranscriptOutput: write transcript and pagination footer
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@affordance/im.md`:
- Around line 62-63: Update the `--format pretty` guidance in `affordance/im.md`
lines 62-63 and the corresponding chat-message listing guidance in
`skills/lark-im/references/lark-im-chat-messages-list.md` line 155 to describe
bounded output, not complete transcripts or conversations. State that users must
continue with `--page-token` or `--page-all` for additional outer messages, and
use `+threads-messages-list` when all thread replies are needed.
In `@shortcuts/im/im_chat_messages_pretty.go`:
- Around line 28-39: De-duplicate non-empty root message IDs before the
rendering loop, preserving a single occurrence while retaining messages without
an ID. Update the loop and footer in the surrounding chat-message rendering
function to use the filtered slice, while continuing to accumulate reply counts
and pagination data normally. Add a nearby regression test containing the same
root message map twice and assert it renders once with the corrected footer
count.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e6b71b8e-e84f-462f-b701-41f340e99968
📒 Files selected for processing (6)
affordance/im.mdinternal/affordance/im_source_test.goshortcuts/im/im_chat_messages_list.goshortcuts/im/im_chat_messages_pretty.goshortcuts/im/im_chat_messages_pretty_test.goskills/lark-im/references/lark-im-chat-messages-list.md
背景
lark-cli im +chat-messages-list --format pretty原本只用表格展示主消息摘要:正文最多保留 40 个字符,也不展示已经获取到的thread_replies。但如果石头 raw json 模式,有超级超级大量的无关字段,格式非常非常非常 AI 不友好。改动前
从这个输出中只能看到一条截断摘要。完整背景、复现代码和话题里的 review 结论都丢失了。
改动后
pretty改为按主消息组织的完整会话记录。每条正文只占一行,原始换行等控制字符使用\n、\r、\t转义:现在可以直接读到完整正文和话题回复;根消息仍保留继续读取话题或翻页所需的信息,回复本身不再重复展示
message_id。具体改动
thread_replies缩进展示在对应根消息下;message_id过滤线程接口重复返回的根消息和重复回复;\\、\n、\r和\t;message_id、thread_id和普通回复的reply_to;话题回复只显示时间、发送者、正文和表情;表情:THUMBSUP×2、DONE×1;已撤回;text/post;has_more和page_token;pretty隐藏 tenant、position、AppLink、国际化发送者字段和编辑状态等 OpenAPI 传输噪音。兼容性
--format pretty的阅读体验;pretty不保证机器可逆解析,程序处理仍应使用 JSON。验证
make unit-testmake vetmake fmt-checkQUALITY_GATE_CHANGED_FROM=origin/main make quality-gatego mod tidy后go.mod/go.sum无变化message_id命中数为 0;根消息 ID 和分页状态仍保留真实验证只记录脱敏统计,不包含群名、成员姓名、消息正文、消息 ID、群 ID 或分页 token。
Related Issues
Summary by CodeRabbit
New Features
--format prettyoption for chat message lists.Documentation