Skip to content

PRG-07: Media & image context bundle (from #343 #334)#370

Closed
nap-liu wants to merge 2 commits intodataelement:mainfrom
nap-liu:prg/07-media-imagectx__from-p343-p334
Closed

PRG-07: Media & image context bundle (from #343 #334)#370
nap-liu wants to merge 2 commits intodataelement:mainfrom
nap-liu:prg/07-media-imagectx__from-p343-p334

Conversation

@nap-liu
Copy link
Copy Markdown

@nap-liu nap-liu commented Apr 10, 2026

This regrouped PR combines the original changes from:\n- #343 image-context-rehydration\n- #334 dingtalk-media-support\n\nScope: media ingestion and image-context recovery behavior.

nap.liu and others added 2 commits April 10, 2026 11:28
…models

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@wisdomqin wisdomqin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for combining these two features into a single, well-structured PR — the commit history and scope description are clean.

After reviewing both parts carefully, here is our decision:


DingTalk Media Support (#334) — Accepted

The DingTalk media message support is a solid contribution. The new dingtalk_token.py global cache manager, the dingtalk_reaction.py thinking indicator, the reconnect-with-backoff logic in dingtalk_stream.py, and the media download+dispatch pipeline are all well-implemented and production-ready.

Action needed: We have merged several changes to main recently (including standalone search engine tools and a seeder fix). Please rebase your branch on the latest main and open a new PR containing only the DingTalk media support files:

  • backend/app/api/dingtalk.py
  • backend/app/services/dingtalk_stream.py
  • backend/app/services/dingtalk_token.py (new)
  • backend/app/services/dingtalk_reaction.py (new)

We will prioritize reviewing and merging that PR.


Image Context Rehydration (#343) — We will implement this ourselves

We appreciate the thinking behind this feature. However, after discussion, we believe the read-time rehydration approach (scanning history and re-reading from disk on every LLM call) has some architectural concerns:

  • Disk dependency: if the file is moved or cleaned up, context silently breaks
  • Coverage gap: only handles workspace/uploads/ — images from tool execution or channel messages are not covered
  • Repeated disk I/O on every LLM call as conversation history grows

We plan to address this at the write path instead: when saving a message that contains an image, we will persist the [image_data:data:image/...;base64,...] marker directly in the DB alongside the message content. This way, history is self-contained and no rehydration step is needed at inference time.

We will implement this change ourselves and it will apply to all channels (web chat, Feishu, DingTalk) uniformly.

No action needed from you on this part — we will close this item once our implementation lands.


Thank you again for the high-quality contributions. Looking forward to the DingTalk-only PR!

@nap-liu
Copy link
Copy Markdown
Author

nap-liu commented Apr 13, 2026

Superseded by #392 — DingTalk media support extracted into a standalone PR per reviewer feedback. Image context rehydration (#343) excluded as requested.

@nap-liu nap-liu closed this Apr 13, 2026
@nap-liu
Copy link
Copy Markdown
Author

nap-liu commented Apr 13, 2026

Thanks for the detailed review!

I've extracted the DingTalk media support into a standalone PR rebased on latest main:

#392

It includes:

  • dingtalk_token.py (new)
  • dingtalk_reaction.py (new)
  • dingtalk_stream.py (media pipeline + auto-reconnect with backoff)
  • dingtalk.py (media message processing)
  • dingtalk_service.py (download wrapper)

Image context rehydration (#343) has been excluded as requested.

This also supersedes PR #369 (reconnect-only), since the reconnect logic is already included here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants