Expand description
Pre-extraction endpoint for file attachments.
POST /attachments/preprocess fires background extraction tasks the moment
a user attaches a file — so by the time they hit Send the content is already
cached and injection is zero-overhead.
Hardware-adaptive concurrency:
- Plain-text formats (code, JSON, CSV, Markdown, …) bypass the semaphore —
they are just an
fs::read+ UTF-8 decode, essentially free. - Binary formats (PDF, DOCX, XLSX, PPTX, …) acquire a semaphore permit first.
The semaphore is sized to
num_cpus / 2(min 1, max 8) so the LLM server is never starved of CPU/RAM on low-spec hardware.
Structs§
Constants§
- CACHE_
TTL_ SECS - TTL for cached pre-extracted entries (30 minutes). The background eviction task checks every 5 minutes.
Functions§
- attachment_
cache_ key - Build a stable, unique cache key for an attachment.
- preprocess_
attachments POST /attachments/preprocess