picoclaw/pkg/channels/feishu
ywj 8b3e502690
fix(feishu): enrich reply context for card and file replies (#2144)
* fix(feishu): enrich reply context for card and file replies

* refactor(feishu): extract reply functions to feishu_reply.go

- Move reply-related functions to new feishu_reply.go
- Move corresponding tests to feishu_reply_test.go
- Extract magic number 600 to maxReplyContextLen constant
- Unify replyTargetID/replyTargetFromMessage (prefer parent_id, fallback root_id)
- Add source comment for containsFeishuUpgradePlaceholder

* fix(feishu): skip API fallback for non-thread messages, prepend replied media refs

- resolveReplyTargetMessageID: only call fetchMessageByID fallback when
  ThreadId is set, avoiding unnecessary API calls for non-reply messages
- prependReplyContext: prepend replied media refs before current media refs
  to maintain correct ordering

* fix(feishu): add message cache for fetchMessageByID to avoid repeated downloads

- Add messageCache (sync.Map) to FeishuChannel struct
- Cache fetched messages with 30s TTL to avoid re-downloading attachments
  when multiple users reply to the same parent message in a thread
- Cleanup expired entries on read access (no background goroutine needed)

* fix(feishu): early-return for non-reply messages, add cache and fetchMessageByID comment

* fix: remove duplicate test and fix gci import order

* fix(feishu): remove duplicate prependReplyContext call
2026-04-08 14:26:17 +08:00
..
common.go Refactor/asr tts (#1939) 2026-04-01 12:21:21 +08:00
common_test.go Feat/feishu card parsing (#1534) 2026-03-20 12:59:43 +08:00
feishu_32.go feat(channels): make Channel.Send return delivered message IDs (#2190) 2026-03-31 11:07:32 +08:00
feishu_64.go fix(feishu): enrich reply context for card and file replies (#2144) 2026-04-08 14:26:17 +08:00
feishu_64_test.go Feat/feishu card parsing (#1534) 2026-03-20 12:59:43 +08:00
feishu_reply.go fix(feishu): enrich reply context for card and file replies (#2144) 2026-04-08 14:26:17 +08:00
feishu_reply_test.go fix(feishu): enrich reply context for card and file replies (#2144) 2026-04-08 14:26:17 +08:00
init.go refactor(channels): add channel subpackages and update gateway imports 2026-02-20 23:25:44 +08:00
token_cache.go fix(feishu): invalidate cached token on auth error to enable retry recovery (#1318) 2026-03-18 19:07:49 +08:00