OCR: one-click "managed local engine" — detect/install Ollama, pull the model, set the origin (desktop) #8
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Depends on
#26 OCR managed setup v1: "Set up local reading for me" (detect Ollama, pull model over HTTP with progress, fill settings, test)
daniel/obsidian-remarkable-round-trip
Reference
daniel/obsidian-remarkable-round-trip#8
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #2. Proposed by @daniel on #3: "can't we bundle the inference engine and model into the plugin so the user doesn't have to set up all the LLM stuff, but still give the endpoint option for advanced users?"
Unassigned on purpose — this is a proposal for @daniel to greenlight or close. It is the realistic near-term embodiment of that request (see the full analysis on #3): we cannot bundle a cursive-capable model (it is multi-GB and must be downloaded; a model small enough to embed does not read cursive), but we can collapse "set up all the LLM stuff" into one button by managing a local engine for the user while keeping the manual endpoint option for advanced users.
Sketch (desktop only)
A "Set up local reading for me" button in the OCR settings that, on desktop (Electron / Node child_process; not available on mobile):
http://localhost:11434). If not installed, link to the installer (or offer to run it).ollama pull qwen2.5vl:7bwith visible progress (it is a ~5 GB download — must be explicit, never silent).OLLAMA_ORIGINS=app://obsidian.mdso Obsidian's origin is accepted, and restarts/needs-restart guidance.Why not "bundle" instead
transformers.jsv4 runs vision models in-process via WebGPU with a WASM fallback and works in Electron. But a 7B VLM in the renderer is fragile (WASM address-space limits, inconsistent WebGPU, no mobile).Open questions for the implementer
ollamabinary acceptable in a community plugin (desktop-only capability, no mobile)? Obsidian discourages but does not forbidchild_process.Scope boundary
Depends on #3's Test-connection action and error mapping landing first (reuse them to verify). Does not touch #4 (built-in reader) or #5 (in-process reader R&D).
claude referenced this issue2026-10-20 15:21:52 +02:00
claude referenced this issue2026-10-20 16:33:19 +02:00
claude referenced this issue2026-10-20 16:34:09 +02:00
claude referenced this issue2026-10-20 16:34:09 +02:00
calling ollama is acceptable, but direct download would be preferred, model download at runtime is also fine
❌ Agent run failed
Agent failed ❌
exceeded pending task timeout
🤖 Agent is working on this — turn 13
Last activity: tool: mcp__gitlab__forge_close_issue — {} — updated 04:38:51 UTC
claude referenced this issue2026-10-20 19:00:28 +02:00
claude referenced this issue2026-10-20 19:00:28 +02:00
What I found
The prerequisites from #3 have landed: !6 (setup docs) and !7 (Test connection plus the 403 →
OLLAMA_ORIGINSerror mapping insrc/transport/ocr.ts). Nothing blocks this work.Following @daniel's note ("direct download preferred, runtime model download fine"), the plugin will not shell out to
ollama. Ollama's HTTP API already provides what the CLI would:/api/versiondetects whether Ollama is running;/api/tagslists the models already downloaded;/api/pulldownloads a model and streams NDJSON progress.This avoids
require("child_process"), whichscripts/check-bundle.mjsrejects to keep the mobile build working.Obsidian's
requestUrl(obsidianHttp,src/main.ts:2366) buffers the whole response, so it can't show progress. For the download, a desktop-only reader built on Nodehttpand loaded lazily viawindow.requirestreams the progress instead. It sends noapp://obsidian.mdorigin header, so the download works even beforeOLLAMA_ORIGINSis set. Mobile hides the button.Created
!27: "Set up local reading for me" (v1). It:
src/transport/ollama.tswith tests;Its validation contract has a failing check today,
vitest ollama.test.ts, plusnpm test,npm run build(which runs the bundle check) and lint.#26: tracking issue that !27 closes. It is not dispatched separately; it exists so that #28 can wait on it.
#28: v2 research and split, covering:
OLLAMA_ORIGINSis actually needed forrequestUrl, and if so whether to automate it or guide the user;#28 is linked as blocked by #26.
Follow-ups
child_processis unavoidable, for example to setOLLAMA_ORIGINSautomatically, it must get your explicit sign-off before the bundle guard is loosened.Since my last update: !27 has merged and closed #26, so version 1 is now on
main(7a021f8). It adds:src/settings.ts;src/ollamasetup.ts;src/transport/ollama.ts;docs/ocr-endpoint-setup.mdand README.Closing #26 released the blocked-by link, and #28 (version 2) has already been picked up by an agent. It covers downloading the Ollama installer directly, which you said you prefer, plus
OLLAMA_ORIGINSand LM Studio. So my Free-tier caveat doesn't apply here and no nudge is needed. I'm leaving #8 open until #28 and the work it splits off are done. Nothing new is needed from you, except sign-off if #28 concludes thatchild_processis unavoidable.claude referenced this issue2026-10-20 20:06:44 +02:00
claude referenced this issue2026-10-20 20:06:45 +02:00
@claude all done here?
@daniel Yes, all done here. Since my last update, #28 has closed and its three MRs are merged on
main:install.shcommand.OLLAMA_ORIGINSrequestUrlsends noOriginheader, and Ollama has allowedapp://*since v0.1.42. The docs and the 403 hint were reworded accordingly (!31). Nochild_processanywhere; the bundle guard is unchanged.Two things are left for you; neither needs an agent:
I'm closing #8. I haven't filed the optional idea of LM Studio downloading a vision model automatically (
POST /api/v1/models/download). Say the word if you want it tracked.