Repository navigation
Conversation
Extract text from PDFs sent on Telegram, Slack and WhatsApp, feed it through the shared inbound pipeline like voice transcripts, and reply clearly for oversized, encrypted, empty or corrupt files. Co-authored-by: Emanuilo Jovanovic <emanuilo@users.noreply.github.com>
Store a received PDF the same way a photo is stored (Telegram file id, or a file under the Slack/WhatsApp media dir) and link it to a memory note. The agent can find it with pdf_search and send it with pdf_send on Telegram, Slack, and WhatsApp. Co-authored-by: Emanuilo Jovanovic <emanuilo@users.noreply.github.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
Memclaw accepts PDF files in Telegram, Slack, and WhatsApp, extracts their text for the agent, keeps the original file, and can send that file back when asked.
How it works
application/pdf, WhatsApp document).memclaw/bot/pdf.py(pypdf) extracts the text, or returns a clear error.file_id(the file stays on Telegram).~/.memclaw/slack/or~/.memclaw/whatsapp/).platform_images,kind="pdf"), plus a one-line daily notePDF file kept: name (pdf id N)so the file is linked to memory.memory_savethe extracted text. The prompt is marked[PDF]and says the file is already saved and can be returned.pdf_search, thenpdf_send(same shape asimage_search/image_send). The platform sends a document, not a photo:send_document(by file id)files_upload_v2send_documentWhat is kept
Encrypted and image-only files are still real PDFs the user may want back, so they are stored even though there is no text to remember. Corrupt and oversized files are not useful or not safe to keep, so they are still rejected with no file left behind.
Try it
Dependency
pypdf>=7.2.0(pure Python).Tests / checks
tests/bot/test_pdf.py, parity coverage intests/bot/test_parity.py, index and tool testspytest: 652 passed, 20 skippedruff checkandcode-shape checkpass