Skip to content

feat(plugin): add user Library uploads and Ollama Cloud vision descriptions - #83

Open
kordless wants to merge 6 commits into
feat/plugin-embeddings-pickerfrom
feat/plugin-uploads-vision
Open

kordless wants to merge 6 commits into
feat/plugin-embeddings-pickerfrom
feat/plugin-uploads-vision

Conversation

@kordless

Copy link
Copy Markdown
Contributor

Summary

Implements PR C of the Lume TI 0.17.0 plan (feat/plugin-uploads-vision, stacked on #82):

  • Streamed admin-only uploads (POST /api/library/upload):
    • Enforces Signal K administrator check (adminStatus), streams directly to disk with a 50 MB cap (413 on oversize stream, never buffering the full file in memory), checks extension allowlist (.pdf, .md, .txt, .png, .jpg/.jpeg, .webp) and magic bytes (%PDF-, PNG, JPEG, RIFF....WEBP, and text NUL/binary checks), sanitizes names to [A-Za-z0-9._-], saves under <library>/files/user/, and never overwrites existing files (409).
    • Always preserves original files untouched; vision descriptions are written as sidecar <name>.md files beside them, and both the Library list and search results link directly to the original file (/plugins/signalk-lume-ti/api/library/file/user/<name>, opening PDFs at #page=N).
    • Runs an incremental lume index update after upload.
  • Ollama Cloud vision descriptions for images:
    • Uses Ollama Cloud vision (glm-5.3:cloud default) only; local gemma4 is rejected.
    • When offline or without a cloud API key, marks uploads as "waiting for a description" (visionStatus: 'waiting_for_description') and automatically retries when internet connectivity returns (retryPendingVision).
  • Scanned / unreadable PDF pages:
    • Prefers extracting embedded page JPEGs (/DCTDecode streams per /Type /Page in pure Node, which works in the Signal K container without external binaries) and falls back to pdftoppm when installed.
    • Describes up to the first 5 unreadable pages at upload/index time.
    • Supports reading the back-of-book alphabetical index backwards from the last page until the index ends and normal book prose starts (readBookIndex=1 or POST /api/library/pdf-book-index).
    • Supports on-demand page description (POST /api/library/pdf-page) only for pages without extracted text, caching every described page in <library>/vision-cache/<name>.json so no page is ever described twice.
  • Web UI (public/index.html, public/library.js, public/style.css):
    • Admin-only Add files dropzone/picker in the Library tab with back-of-book index option and "Added by you" section + "waiting for a description" badge.

Verification

  • npm test in plugins/signalk-lume-ti: 111/111 passing (including test/uploads.test.js).

@kordless
kordless force-pushed the feat/plugin-embeddings-picker branch from 615c78a to f621d24 Compare October 15, 2026 00:37
@kordless
kordless force-pushed the feat/plugin-uploads-vision branch from 2311cce to ed75ad9 Compare October 15, 2026 00:39
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.

1 participant