Skip to content

en AI Translation and Image Search

Surfire edited this page Dec 6, 2026 · 2 revisions

← Back to Home · 简体中文

Translation (tr), Local Folder RAG (qa), Local AI & Offline Image Search (img)

Lumen requires zero subscriptions and zero cloud accounts. Configure local models (oMLX / Ollama), any OpenAI-compatible HTTPS endpoint, and completely offline EmbeddingGemma 2 semantic document & image search inside Settings → AI & Models.

Privacy Boundary: tr and qa requests are sent only when you explicitly press Enter, strictly to the endpoint you configured. Pure filename search and previews load zero AI models.


1. Streaming Translation: tr

Supported Prefixes

Style Examples Behavior
Auto-direction (zh ↔ en) tr Hello world / translate ... / 译 你好 / 翻译 ... Automatically detects Chinese ↔ English
With selected/fresh text Select text and type tr or tr:ja Translates attached selection or 60s-fresh clipboard text
Explicit target language tr:zh Launch notes, tr:ja Good morning, tr French Hello, 译日 早上好 Supports :, :, space, or compact Chinese prefix

12 Supported Target Languages

Simplified Chinese (zh), Traditional Chinese (zh-tw), English (en), French (fr), German (de), Japanese (ja), Russian (ru), Korean (ko), Spanish (es), Portuguese (pt), Italian (it), and Arabic (ar).

Tip for Italian: Use tr:it <text> or tr Italian <text> (bare tr it ... avoids misreading the English pronoun "it" as a language code).

Actions

  • ↩ (Enter): Start streaming translation; press ↩ again when finished to copy the translated text.
  • ⌘↩ (macOS) / Ctrl+↩ (Windows): Replace the original text in place when captured from an editable field.
  • Esc: Cancel an in-flight stream immediately.
  • You can also open the dedicated side-by-side Translation Panel from the menu bar / system tray for longer passages.

2. Zero-Cloud Local Folder RAG & Markdown Q&A: qa (New in v0.9.0)

Two Modes

  • General Prompt Q&A: Type qa <question> (e.g., qa How does Rust atomic file replacement work?), or summon with selected text and type qa / qa summarize key risks. Prompt-only Q&A never browses the web or attaches unscoped files.
  • Grounded Local Folder / File RAG (v0.9.0):
    1. Highlight any folder and press Tab to enter folder scope (or select a local file), then type qa <question> (e.g., qa late-delivery penalty? or qa summarize this folder).
    2. The shared Rust RAG engine retrieves only local indexed text (0.11–0.22 ms median recall) or safely reads local documents on demand (Markdown, text, code, Office, PDF pages) while strictly enforcing SF_DATALESS / OneDrive zero cloud downloads and credential hard blocks.
    3. Scanned PDF & Photo Inventory Fallback (scope_inventory): When a folder contains no extractable text (e.g., scanned PDFs, ID photos, or cloud placeholders), Lumen builds a zero-hydration, credential-filtered directory inventory citation so qa summarize this folder accurately describes its contents.

Native Markdown Rendering & Clickable [1] PDF Page Jumps

  • Rich Markdown by Default: macOS renders headings, bold/italic (including CJK + emoji adjacency), horizontal rules, lists, blockquotes, fenced code blocks, tables, and [1] accent citations natively in NSTextView (QaMarkdownRenderer); Windows renders them via pure zero-innerHTML DOM under strict CSP. Pressing ↩ Copy preserves clean raw Markdown.
  • Clickable Local Citations: Citation chips appear beneath the answer—click [1] contract.pdf · P.2 to jump straight to that PDF page in inline preview, or click a folder inventory chip to open the folder directly.
  • Controls: ↩ submits via SSE (and copies when finished); PgUp / PgDn scrolls; Esc cancels immediately.

Configuring Providers for tr and qa

Open Settings → AI & Models → Translation & Q&A Providers:

  1. Free Local Providers (Recommended):
    • oMLX: preset http://127.0.0.1:8000/v1
    • Ollama: preset http://127.0.0.1:11434/v1
    • Plain HTTP is permitted strictly for loopback addresses (127.0.0.1, [::1], localhost).
  2. Custom OpenAI-Compatible HTTPS API: Click New Provider, enter your https://.../v1 base URL and API key, click Test Connection or List Models to pick a chat model, and save.
  3. Key Isolation: Saved API keys are strictly bound to both the provider and its endpoint URL (changing an endpoint never leaks the old key to the new host). Keys live in user-only 0600 / Keychain storage on macOS and current-user DACL storage on Windows.

3. Offline Semantic Document Search

Enable semantic search to find indexed document passages by meaning—even when you don't remember the filename or exact keywords.

Option A: Built-In EmbeddingGemma 2 (100% Offline)

  1. Under Settings → Index, add the document folders you want indexed for content and semantics.
  2. Under Settings → AI & Models, select Built-in Gemma 2 as your text embedding engine.
  3. Pick a download source: HuggingFace or HF-Mirror (auto-selected in Mainland China timezones).
    • Windows Offline Import: Air-gapped or slow-network Windows hosts can import pre-downloaded embeddinggemma-2-Q8_0.gguf and mmproj-embeddinggemma-2-Q8_0.gguf directly inside Settings (verified by exact byte size + SHA-256).
  4. Once downloaded and verified, Lumen backfills text embeddings automatically in the background with a live embedded / limit progress bar.

Option B: Local Loopback oMLX / Ollama Embedding Server

  1. Switch the text embedding engine to Local Server (oMLX / Ollama).
  2. Enter your loopback endpoint (http://127.0.0.1:8000/v1, http://127.0.0.1:11434/v1, or unix:///... on macOS) and pick an embedding model.
  3. Vectors are partitioned by model_name + dimension, so switching models or ports stays clean—and stopping the local server never breaks filename search, FTS5 content search, or built-in image search.

4. 100% Offline Image Search (img) & Local OCR

Find screenshots and photos by describing what's inside them—completely offline.

Using img

  1. Download/enable the Gemma 2 Vision Projector (mmproj-embeddinggemma-2-Q8_0.gguf) in Settings → AI & Models.
  2. Choose local photo/screenshot folders under Settings → Index.
  3. Supported formats: PNG, JPEG/JPG, HEIC/HEIF, WebP (up to 12 MiB / 32 MP per image; cloud-only placeholders are never downloaded).
  4. Newest images are indexed first (mtime DESC) automatically in the background. On incremental restarts, Settings clearly displays existing total + newly added (your existing visual index is preserved, never wiped).
  5. Search:
    • Explicit image mode: img red sailboat, img whiteboard architecture, img receipt screenshot
    • Main bar auto-recall: natural keywords typed in the main bar also surface high-confidence visual matches below exact filename hits.

Offline Image OCR

Toggle Image OCR under Settings → Index to extract text from local screenshots and scanned images into full-text search:

  • macOS: Native Apple Vision OCR.
  • Windows: Native WinRT Windows.Media.Ocr using your installed Windows OCR language packs (e.g., en-US, zh-Hans-CN).

5. 3-Tier RAM Budgets & Battery-Quiet Power Pacing (Upgraded in v0.9.0)

  • 3 Adaptive RAM Tiers (Low / Balanced / High): Without AI models loaded, the 8 GB Low-RAM tier indexes 500K files in 70.1 MiB on macOS (0.36 ms p50) and 42.6 MiB on Windows x64 (0.93 ms p50), while 1.67M real files stay in ~144.7 MiB.
  • Automatic RAM-Scaled Vector Ceilings & Idle Unload: Compact f16 vectors cap automatically at 2.5% of physical RAM for text (~410 MiB on 16 GB, max 1,024 MiB) and 1% for images (max 512 MiB), auto-unloading when idle.
  • ~265× Lower Idle Background CPU on Battery: Zero-polling OS power & thermal observers (macOS PowerStateMonitor, Windows WM_POWERBROADCAST + EcoQoS) pause heavy embedding on battery/low power/thermal load and tighten idle unload windows—achieving 0% steady idle CPU on both OSes. Windows auto-selects Vulkan GPU or CPU AVX2 inside a Job Object for clean teardown.

Next Guide: Permanent Snippets, Clipboard History & Daily Utilities →

Clone this wiki locally