feat: 聊天历史和用户消息注入时间戳 - #132
Merged
Merged
Conversation
飞书消息的 create_time 时间戳之前在 parseMessage 中被丢弃, 导致 Claude 无法知道当前时间。现在将时间信息注入到 user prompt 侧(非 system prompt),避免 cache miss: - fetchRecentMessages 返回 createTime 字段 - ParsedMessage / QueueTask 传递 createTime - 历史消息格式化为 [HH:MM] [姓名]: 内容(跨天/跨年显示日期) - 当前消息末尾附带 <msg-time> 元数据标签 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
覆盖同一天、跨天同年、跨年、UTC+8 日期边界等场景 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @lishuceo's task in 1m 16s —— View job PR Review: feat: 聊天历史和用户消息注入时间戳
✅ ApprovedClean, well-scoped PR. The timestamp injection approach is sound — adding time to the user prompt side rather than system prompt avoids cache misses while giving Claude temporal awareness. What I reviewed:
Minor observations (not blocking, confidence < 75):
No bugs, security issues, or architectural concerns found. |
lishuceo
added a commit
that referenced
this pull request
Apr 8, 2026
* feat: 在聊天历史和用户消息中注入时间戳 飞书消息的 create_time 时间戳之前在 parseMessage 中被丢弃, 导致 Claude 无法知道当前时间。现在将时间信息注入到 user prompt 侧(非 system prompt),避免 cache miss: - fetchRecentMessages 返回 createTime 字段 - ParsedMessage / QueueTask 传递 createTime - 历史消息格式化为 [HH:MM] [姓名]: 内容(跨天/跨年显示日期) - 当前消息末尾附带 <msg-time> 元数据标签 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: formatCreateTime 时间格式化单元测试 覆盖同一天、跨天同年、跨年、UTC+8 日期边界等场景 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
create_time时间戳之前在 parseMessage 中被丢弃,Claude 完全不知道当前时间[HH:MM] [姓名]: 内容(跨天显示日期,跨年显示完整日期)<msg-time>元数据标签改动文件
src/feishu/client.ts— fetchRecentMessages 返回 createTimesrc/feishu/event-handler.ts— formatCreateTime 函数 + 历史消息时间前缀 + 当前消息时间元数据src/session/queue.ts+types.ts— QueueTask 传递 createTimesrc/__tests__/message-time.test.ts— formatCreateTime 单元测试Test plan
🤖 Generated with Claude Code