Skip to content

Turn any document into clean, AI-ready Markdown. Local-first desktop app: reads scanned PDFs, batches folders, runs offline, and uses far fewer tokens than vision models.

MDFlux v0.2.0

ibrahimqureshaed6b607e17526
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ebe0144..0630c94 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,27 @@ All notable changes to this project are documented here. The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [0.1.0] — 2026-06-19
+## [0.2.0] - 2026-08-19
+
+### Added
+
+- Changes tab after cleanup, with added and removed lines.
+- Provider picker in Diagnostics (DeepSeek, OpenAI, Groq, OpenRouter, or a compatible endpoint). Test the key first. OpenAI and DeepSeek keys both start with `sk-`, so pick those yourself; other prefixes switch automatically.
+- Drop `.txt` and `.md` like any other file.
+- Banner when a file converted to nothing usable.
+- Type chip when dragging a file over the window.
+- Ctrl+C with nothing selected copies the full Markdown.
+- Clearer errors for damaged PDFs, unsupported types, and empty extracts.
+
+### Changed
+
+- Better conversion for PowerPoint charts, SVG, and Word equations.
+- Better on-device OCR for scans. Models still ship in the install.
+- JSON and XML show as fenced code in Preview.
+
+If you already had OCR from 0.1.0, reinstall it from Diagnostics.
+
+## [0.1.0] - 2026-06-19
First public release. Windows, portable (extract-and-run; no installer).
@@ -26,4 +46,5 @@ First public release. Windows, portable (extract-and-run; no installer).
- Dependencies are integrity-verified during the one-time setup, so first run is trustworthy. See
[`SECURITY.md`](SECURITY.md).
+[0.2.0]: https://github.com/ibrahimqureshae/mdflux/releases/tag/v0.2.0
[0.1.0]: https://github.com/ibrahimqureshae/mdflux/releases/tag/v0.1.0
diff --git a/README.md b/README.md
index 183ca76..ccea974 100644
--- a/README.md
+++ b/README.md
@@ -7,10 +7,10 @@
**Turn any document into clean, AI-ready Markdown.**
Local-first · reads scanned PDFs · up to 6× fewer tokens than vision models
-**Works with** PDF · DOCX · PPTX · XLSX · EPUB · HTML · CSV · JSON · XML · images · audio
+**Works with** PDF · DOCX · PPTX · XLSX · EPUB · HTML · CSV · JSON · XML · TXT · MD · images · audio
[![License: MIT](https://img.shields.io/badge/License-MIT-3b82f6.svg)](LICENSE)
-[![Download v0.1.0](https://img.shields.io/badge/download-v0.1.0-3b82f6)](https://github.com/ibrahimqureshae/mdflux/releases/latest)
+[![Download v0.2.0](https://img.shields.io/badge/download-v0.2.0-3b82f6)](https://github.com/ibrahimqureshae/mdflux/releases/latest)
[![Up to 6x fewer tokens](https://img.shields.io/badge/vs%20vision-up%20to%206%C3%97%20fewer%20tokens-3b82f6)](#the-proof-fewer-tokens-lower-cost)
[![Platform](https://img.shields.io/badge/platform-Windows-3b82f6.svg)](https://github.com/ibrahimqureshae/mdflux/releases)
[![Works offline](https://img.shields.io/badge/works-offline-3fb950)](#)
@@ -85,12 +85,23 @@ That's the full text recovered in about 5.7 times fewer tokens than the vision m
|---|---|
| 💸 **Fewer tokens, lower cost** | Clean Markdown costs about 2 to 6 times fewer tokens than sending pages to a vision model, so every LLM call that reads the document is cheaper. |
| 🔒 **Local and private** | Your documents never leave your machine. No cloud, no API key, no account. |
-| 🔍 **Reads scanned PDFs** | Built-in OCR recovers text that plain extractors return as zero characters. |
+| 🔍 **Reads scanned PDFs** | Built-in OCR recovers text from scans that other tools treat as blank. |
| 🧱 **Real structure** | Proper Markdown with headings, tables, and lists intact. Readable, greppable, diff-able. |
| 🖥️ **No terminal needed** | Portable app. Unzip, run, click through a one-time setup. Done. |
-| 📦 **Many formats** | PDF, DOCX, PPTX, XLSX, EPUB, HTML, CSV, JSON, XML, images, and audio. |
+| 📦 **Many formats** | PDF, DOCX, PPTX, XLSX, EPUB, HTML, CSV, JSON, XML, TXT, Markdown, images, and audio. |
| 🔁 **Batch a whole folder** | Convert everything at once, with progress, cancellation, and per-file diagnostics. |
-| 🧹 **Optional cleanup** | Off, rule-based, or an AI pass (local or API) to tidy up messy extractions. |
+| 🧹 **Optional cleanup** | Off, rule-based, or an AI pass (local or API). The **Changes** tab shows what cleanup added or removed. |
+
+---
+
+## What's new in 0.2.0
+
+- **Changes tab:** added and removed lines after cleanup.
+- **OCR:** newer on-device engine for scans.
+- **AI cleanup:** pick DeepSeek, OpenAI, Groq, or another provider in Diagnostics, then Test the key.
+- Drop `.txt` and `.md` like any other file.
+
+If you already had OCR from 0.1.0, reinstall it from Diagnostics.
---
@@ -113,13 +124,21 @@ That's the full text recovered in about 5.7 times fewer tokens than the vision m
```
1. Drop a file or folder → PDF, Office, EPUB, scans, audio, and more
2. Pick a cleanup mode → Off, rule-based, or AI (local or API)
-3. Get clean Markdown → Preview, copy, or save as .md. 100% offline.
+3. Get clean Markdown → Preview, Source, Split, or Changes. Copy or save as .md.
```
The first launch sets up a private, self-contained Python environment (one time, needs internet). Every conversion after that runs fully offline.
<div align="center">
<img src="docs/media/screenshot-cleanup-modes.png" width="560" alt="MDFlux cleanup mode selector: Off, Rule-based, Local AI, and API"/>
+<br/>
+<sub>Cleanup modes: Off, rule-based, or an AI pass, chosen per run.</sub>
+</div>
+
+<div align="center">
+<img src="docs/media/screenshot-changes.png" width="560" alt="Changes tab after cleanup, showing added and removed lines"/>
+<br/>
+<sub>The Changes tab after cleanup: what was added or removed, line by line.</sub>
</div>
---
@@ -215,6 +234,8 @@ To verify your download, check the SHA-256 posted on the [release page](https://
**The first launch is downloading for a while**: That's the one-time setup of the local Python environment. It only happens once, and every launch after is instant and offline.
+**AI cleanup says the key was rejected (401)**: The key is valid for a *provider*, not for "any API". In Diagnostics, set **Provider** to match the key (DeepSeek, Groq, OpenRouter, …) then Test. A DeepSeek key sent to OpenAI will always 401. Unambiguous prefixes (`sk-ant-`, `gsk_`, `sk-or-`, `AIza`, `xai-`, `pplx-`) switch the provider automatically; OpenAI and DeepSeek both start with `sk-`, so those you pick yourself.
+
**A conversion finished with a warning or looks empty**: Open the diagnostics panel. It tells you what's installed and healthy and what went wrong, so you get a clear next step instead of a silent empty file.
<div align="center">
diff --git a/SECURITY.md b/SECURITY.md
index d76d9dd..3b2ed8a 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -20,7 +20,7 @@ unverified code.
## Model weights (OCR / audio)
-- **OCR:** models ship inside the pinned, integrity-verified OCR package — no separate download.
+- **OCR:** models ship inside the pinned, integrity-verified `rapidocr` wheel (PP-OCRv6 small) — no separate download.
- **Audio (faster-whisper):** model weights download from the official Systran HuggingFace
repositories on first use of the opt-in audio engine. These are trusted at download time and not
yet revision-pinned; pinned verification is planned. If you require a fully verified supply chain,
diff --git a/THIRD-PARTY-LICENSES.md b/THIRD-PARTY-LICENSES.md
index e75cd55..d984c97 100644
--- a/THIRD-PARTY-LICENSES.md
+++ b/THIRD-PARTY-LICENSES.md
@@ -36,8 +36,8 @@ engines. Key packages:
| Package | Version | License |
|---------|---------|---------|
-| markitdown | 0.1.6 | MIT |
-| openai | 2.43.0 | Apache-2.0 |
+| markitdown | 0.1.7 | MIT |
+| openai | 2.54.0 | Apache-2.0 |
| pdfminer.six | 20260107 | MIT |
| pdfplumber | 0.11.10 | MIT |
| mammoth | 1.11.0 | BSD-2-Clause |
@@ -59,13 +59,13 @@ engines. Key packages:
| Package | Version | License |
|---------|---------|---------|
-| pypdfium2 | 5.9.0 | BSD-3-Clause / Apache-2.0 |
-| rapidocr-onnxruntime | 1.4.4 | Apache-2.0 |
-| onnxruntime | 1.20.1 | MIT |
+| pypdfium2 | 5.13.0 | BSD-3-Clause / Apache-2.0 |
+| rapidocr | 3.9.2 | Apache-2.0 |
+| onnxruntime | 1.29.0 | MIT |
| faster-whisper | 1.2.1 | MIT |
| ctranslate2 | 4.8.0 | MIT |
| tokenizers | 0.23.1 | Apache-2.0 |
-| huggingface-hub | 1.20.0 | Apache-2.0 |
+| huggingface-hub | 1.20.1 | Apache-2.0 |
| pillow | 12.2.0 | MIT-CMU (HPND) |
| numpy | 2.4.6 | BSD-3-Clause (+ 0BSD / MIT / Zlib components) |
| tqdm | 4.68.3 | **MPL-2.0** AND MIT (file-level; no effect on larger work) |
diff --git a/app/package-lock.json b/app/package-lock.json
index f01cbb7..de100ae 100644
--- a/app/package-lock.json
+++ b/app/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "app",
- "version": "0.1.0",
+ "version": "0.2.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "app",
- "version": "0.1.0",
+ "version": "0.2.0",
"license": "MIT",
"dependencies": {
"@fontsource-variable/inter": "^5.2.8",
diff --git a/app/package.json b/app/package.json
index fc7524f..86921e7 100644
--- a/app/package.json
+++ b/app/package.json
@@ -1,6 +1,6 @@
{
"name": "app",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "",
"type": "module",
"scripts": {
diff --git a/app/src-tauri/Cargo.lock b/app/src-tauri/Cargo.lock
index a4968d9..aa253ce 100644
--- a/app/src-tauri/Cargo.lock
+++ b/app/src-tauri/Cargo.lock
@@ -60,7 +60,7 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "app"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"flate2",
"reqwest 0.12.28",
diff --git a/app/src-tauri/Cargo.toml b/app/src-tauri/Cargo.toml
index 2b8149d..92ccb52 100644
--- a/app/src-tauri/Cargo.toml
+++ b/app/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "app"
-version = "0.1.0"
+version = "0.2.0"
description = "MDFlux"
authors = []
edition = "2021"
diff --git a/app/src-tauri/capabilities/default.json b/app/src-tauri/capabilities/default.json
index f746407..ae71191 100644
--- a/app/src-tauri/capabilities/default.json
+++ b/app/src-tauri/capabilities/default.json
@@ -7,6 +7,16 @@
"core:default",
"core:window:allow-set-title",
"opener:default",
+ {
+ "identifier": "opener:allow-open-url",
+ "allow": [
+ { "url": "https://github.com/sponsors/*" },
+ { "url": "https://www.buymeacoffee.com/*" },
+ { "url": "https://buymeacoffee.com/*" },
+ { "url": "https://www.paypal.me/*" },
+ { "url": "https://paypal.me/*" }
+ ]
+ },
"dialog:default",
"dialog:allow-save",
"fs:default",
diff --git a/app/src-tauri/resources/sidecar/capabilities.py b/app/src-tauri/resources/sidecar/capabilities.py
index d031e95..4bf0cad 100644
--- a/app/src-tauri/resources/sidecar/capabilities.py
+++ b/app/src-tauri/resources/sidecar/capabilities.py
@@ -99,6 +99,22 @@ _CORE_FORMATS: list[dict] = [
"converter": "markitdown.converters.html.HtmlConverter",
"mode": "markitdown",
},
+ {
+ "key": "txt",
+ "label": "Plain text",
+ "extensions": [".txt"],
+ "module": None,
+ "converter": "markitdown.converters.plain_text.PlainTextConverter",
+ "mode": "markitdown",
+ },
+ {
+ "key": "md",
+ "label": "Markdown",
+ "extensions": [".md"],
+ "module": None,
+ "converter": "markitdown.converters.plain_text.PlainTextConverter",
+ "mode": "markitdown",
+ },
]
# OCR-based image formats — activated when RapidOCR is installed.
@@ -107,7 +123,7 @@ _OCR_FORMATS: list[dict] = [
"key": "image",
"label": "Images (JPG, PNG, TIFF, WebP…)",
"extensions": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".tiff", ".tif", ".bmp"],
- "module": "rapidocr_onnxruntime",
+ "module": "rapidocr",
"converter": "ocr.RapidOCR",
"mode": "ocr",
"note": None,
@@ -147,7 +163,7 @@ def ext_to_format(ext: str) -> dict | None:
return None
-SUPPORTED_LIST = "PDF, DOCX, PPTX, XLSX, HTML, CSV, JSON, XML, EPUB, images, or audio"
+SUPPORTED_LIST = "PDF, DOCX, PPTX, XLSX, HTML, CSV, JSON, XML, EPUB, TXT, Markdown, images, or audio"
# ── Diagnostics report ────────────────────────────────────────────────────────
@@ -189,6 +205,7 @@ def _probe(fmt: dict) -> dict:
# Module → distribution name, for version lookup without importing the module.
_DIST_NAMES = {
+ "rapidocr": "rapidocr",
"rapidocr_onnxruntime": "rapidocr-onnxruntime",
"faster_whisper": "faster-whisper",
}
@@ -207,7 +224,7 @@ def _probe_optional(fmt: dict) -> dict:
"""
Probe an optional-engine format (OCR/audio) WITHOUT importing the engine.
- Importing rapidocr_onnxruntime / faster_whisper loads native runtimes
+ Importing rapidocr / faster_whisper loads native runtimes
(onnxruntime, CTranslate2) into the main sidecar process, which stalls the
asyncio Proactor event loop's subprocess pipe handling on Windows. We only
check presence via find_spec and read the version from package metadata.
@@ -229,17 +246,24 @@ def _probe_optional(fmt: dict) -> dict:
def _ocr_optional_status() -> dict:
"""Return the optional.ocr block for the capabilities report (no heavy import)."""
+ if importlib.util.find_spec("rapidocr") is not None:
+ return {
+ "status": "installed",
+ "engine": "rapidocr (PP-OCRv6 small)",
+ "size_hint": "~210 MB",
+ "note": "RapidOCR + PP-OCRv6 small. Scanned PDFs and image files.",
+ }
if importlib.util.find_spec("rapidocr_onnxruntime") is not None:
return {
"status": "installed",
- "engine": "rapidocr-onnxruntime",
+ "engine": "rapidocr-onnxruntime (PP-OCRv4)",
"size_hint": "~200 MB",
- "note": "RapidOCR — scanned PDFs and image files",
+ "note": "Older RapidOCR (PP-OCRv4). Reinstall OCR to upgrade to PP-OCRv6.",
}
return {
"status": "not_installed",
- "engine": "rapidocr-onnxruntime",
- "size_hint": "~200 MB (ONNX Runtime + model)",
+ "engine": "rapidocr (PP-OCRv6 small)",
+ "size_hint": "~210 MB (ONNX Runtime + PP-OCRv6 small)",
"note": "Install to convert scanned PDFs and image files",
}
diff --git a/app/src-tauri/resources/sidecar/cleanup.py b/app/src-tauri/resources/sidecar/cleanup.py
index 5b21a6a..d391703 100644
--- a/app/src-tauri/resources/sidecar/cleanup.py
+++ b/app/src-tauri/resources/sidecar/cleanup.py
@@ -233,9 +233,10 @@ def _clean_one_chunk(chunk, mode, api_type, base_url, key, model, timeout) -> st
return _provider.chat_local(base_url, model, system, chunk, timeout,
num_ctx=num_ctx, num_predict=out_budget)
- # api, openai-compatible (OpenAI, Groq, …) — large fixed context; cap the output.
+ # api, openai-compatible (OpenAI, Groq, DeepSeek, …). Floor max_tokens so a
+ # thinking model cannot spend the entire budget on hidden reasoning.
return _provider.chat_openai_compat(base_url, key, model, system, chunk, timeout,
- max_tokens=out_budget)
+ max_tokens=max(4096, out_budget))
def _split_into_chunks(text: str, target_chars: int) -> list[str]:
diff --git a/app/src-tauri/resources/sidecar/ocr.py b/app/src-tauri/resources/sidecar/ocr.py
index a2ac819..1d478ae 100644
--- a/app/src-tauri/resources/sidecar/ocr.py
+++ b/app/src-tauri/resources/sidecar/ocr.py
@@ -1,8 +1,9 @@
"""
-OCR engine — RapidOCR + pypdfium2 (both pip-installable, no system binary required).
+OCR engine — RapidOCR 3 + pypdfium2 (both pip-installable, no system binary required).
-RapidOCR uses ONNX Runtime; pypdfium2 rasterises PDF pages for OCR.
-Both are installed together via install_engine("ocr").
+RapidOCR 3.9+ defaults to Baidu PP-OCRv6 small (ONNX Runtime). Models ship inside the
+pinned `rapidocr` wheel, so install stays offline after the hash-verified pip step.
+pypdfium2 rasterises PDF pages for OCR.
"""
import importlib.util
import os
@@ -19,13 +20,16 @@ def is_available() -> bool:
"""
True when RapidOCR is installed.
- Uses find_spec rather than importing — importing rapidocr_onnxruntime pulls in
+ Uses find_spec rather than importing — importing RapidOCR pulls in
onnxruntime, whose native thread pools interfere with the sidecar's asyncio
Proactor event loop on Windows (it stalls subprocess pipe pumping, hanging the
first OCR request). The heavy import only ever happens inside the short-lived
OCR worker subprocess, never in the main sidecar process.
"""
- return importlib.util.find_spec("rapidocr_onnxruntime") is not None
+ return (
+ importlib.util.find_spec("rapidocr") is not None
+ or importlib.util.find_spec("rapidocr_onnxruntime") is not None
+ )
def has_pdf_renderer() -> bool:
@@ -34,26 +38,61 @@ def has_pdf_renderer() -> bool:
def _make_engine(intra_op_threads: int = 0):
- """Build a RapidOCR engine, optionally limiting its onnxruntime thread count so
- concurrent batch workers don't oversubscribe the CPU. The kwarg is best-effort:
- if a RapidOCR version rejects it, fall back to the default engine."""
- from rapidocr_onnxruntime import RapidOCR
+ """Build a RapidOCR engine, optionally limiting onnxruntime threads so
+ concurrent batch workers don't oversubscribe the CPU."""
n = int(intra_op_threads or 0)
+ if importlib.util.find_spec("rapidocr") is not None:
+ from rapidocr import RapidOCR
+ # Pin v6 small explicitly. RapidOCR 3.9+ already defaults here; we do not
+ # want a later wheel silently switching to medium (slower, +108 MB, worse det).
+ params: dict = {
+ "Global.log_level": "warning",
+ "Det.ocr_version": "PP-OCRv6",
+ "Det.model_type": "small",
+ "Rec.ocr_version": "PP-OCRv6",
+ "Rec.model_type": "small",
+ }
+ if n > 0:
+ params["EngineConfig.onnxruntime.intra_op_num_threads"] = n
+ params["EngineConfig.onnxruntime.inter_op_num_threads"] = n
+ try:
+ return RapidOCR(params=params)
+ except Exception: # noqa: BLE001 — older/newer keys; use defaults
+ return RapidOCR()
+
+ from rapidocr_onnxruntime import RapidOCR
if n > 0:
try:
return RapidOCR(intra_op_num_threads=n, inter_op_num_threads=n)
- except Exception: # noqa: BLE001 — older/newer API; use the default
+ except Exception: # noqa: BLE001
pass
return RapidOCR()
+def _result_text(result) -> str:
+ """Pull reading-order text from RapidOCR 3 output, with a v1 list fallback."""
+ txts = getattr(result, "txts", None)
+ if txts:
+ to_md = getattr(result, "to_markdown", None)
+ if callable(to_md):
+ md = to_md()
+ if md and "没有检测" not in md:
+ return md
+ return "\n".join(t for t in txts if t and str(t).strip())
+ if not result:
+ return ""
+ # rapidocr-onnxruntime 1.x: list of [box, text, score]
+ lines = []
+ for item in result:
+ if len(item) > 1 and item[1]:
+ lines.append(item[1])
+ return "\n".join(lines)
+
+
def ocr_image(path: str, intra_op_threads: int = 0) -> str:
"""Run OCR on a single image file; return extracted text as plain text."""
engine = _make_engine(intra_op_threads)
- result, _ = engine(path)
- if not result:
- return ""
- return "\n".join(item[1] for item in result if len(item) > 1 and item[1])
+ return _result_text(engine(path))
def is_scanned_pdf(path: str) -> bool:
@@ -95,9 +134,9 @@ def is_scanned_pdf(path: str) -> bool:
def ocr_pdf(path: str, progress_cb=None, intra_op_threads: int = 0) -> str:
"""
- Rasterise each PDF page at 150 DPI and OCR it with RapidOCR.
+ Rasterise each PDF page at 220 DPI and OCR it with RapidOCR.
Renders each page to a temp PNG via pypdfium2 + Pillow (Pillow is a transitive
- dep of rapidocr-onnxruntime, so it is always present when this function runs).
+ dep of RapidOCR, so it is always present when this function runs).
progress_cb(frac, stage_str) called per page.
"""
import pypdfium2 as pdfium
@@ -113,26 +152,22 @@ def ocr_pdf(path: str, progress_cb=None, intra_op_threads: int = 0) -> str:
if progress_cb:
progress_cb(i / n, f"OCR page {i + 1}/{n}")
- bitmap = page.render(scale=150 / 72) # 150 DPI
+ bitmap = page.render(scale=220 / 72) # 220 DPI — sharper than 150, still faster than 300
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as tmp:
tmp_path = tmp.name
try:
bitmap.to_pil().save(tmp_path)
- result, _ = engine(tmp_path)
+ text = _result_text(engine(tmp_path))
finally:
try:
os.unlink(tmp_path)
except OSError:
pass
- if result:
- page_text = "\n".join(
- item[1] for item in result if len(item) > 1 and item[1]
- )
- if page_text.strip():
- pages.append(f"## Page {i + 1}\n\n{page_text}")
+ if text.strip():
+ pages.append(f"## Page {i + 1}\n\n{text.strip()}")
finally:
doc.close()
return "\n\n".join(pages) if pages else ""
diff --git a/app/src-tauri/resources/sidecar/provider.py b/app/src-tauri/resources/sidecar/provider.py
index a2a9f7a..f929e31 100644
--- a/app/src-tauri/resources/sidecar/provider.py
+++ b/app/src-tauri/resources/sidecar/provider.py
@@ -75,6 +75,40 @@ def check_local(base_url: str) -> dict:
}
+def _host_name(url: str) -> str:
+ u = (url or "").lower()
+ table = (
+ ("openai.com", "OpenAI"),
+ ("deepseek.com", "DeepSeek"),
+ ("groq.com", "Groq"),
+ ("anthropic.com", "Anthropic"),
+ ("googleapis.com", "Google Gemini"),
+ ("openrouter.ai", "OpenRouter"),
+ ("together.xyz", "Together AI"),
+ ("mistral.ai", "Mistral"),
+ ("fireworks.ai", "Fireworks"),
+ ("x.ai", "xAI"),
+ ("perplexity.ai", "Perplexity"),
+ ("cerebras.ai", "Cerebras"),
+ ("nvidia.com", "NVIDIA"),
+ )
+ for needle, name in table:
+ if needle in u:
+ return name
+ return "this endpoint"
+
+
+def _401_detail(url: str) -> str:
+ name = _host_name(url)
+ extra = ""
+ if "openai.com" in (url or "").lower():
+ extra = (
+ " If this key is for DeepSeek, Groq, OpenRouter, or another host, "
+ "choose that provider in Diagnostics — do not leave it on OpenAI."
+ )
+ return f"This key was rejected by {name} (401).{extra}"
+
+
def check_openai_compat(base_url: str, key: str) -> dict:
"""Probe an OpenAI-compatible API endpoint with the supplied key."""
base = base_url.rstrip("/")
@@ -85,10 +119,10 @@ def check_openai_compat(base_url: str, key: str) -> dict:
try:
with urllib.request.urlopen(req, timeout=8) as r:
data = json.loads(r.read())
- models = [m.get("id", "") for m in data.get("data", [])]
+ models = [m.get("id", "") for m in data.get("data", []) if m.get("id")]
return {
"reachable": True,
- "detail": f"Connected — {len(models)} model(s) available",
+ "detail": f"Connected to {_host_name(base)} — {len(models)} model(s) available",
"models": models,
"usable": True,
}
@@ -96,13 +130,13 @@ def check_openai_compat(base_url: str, key: str) -> dict:
if e.code == 401:
return {
"reachable": True,
- "detail": "Endpoint reachable — API key rejected (401 Unauthorized)",
+ "detail": _401_detail(base),
"models": [],
"usable": False,
}
return {
"reachable": True,
- "detail": f"Endpoint returned HTTP {e.code}",
+ "detail": f"{_host_name(base)} returned HTTP {e.code}",
"models": [],
"usable": False,
}
@@ -170,8 +204,43 @@ def check_anthropic(key: str) -> dict:
def _post_json(url: str, headers: dict, payload: dict, timeout: float) -> dict:
body = json.dumps(payload).encode()
req = urllib.request.Request(url, data=body, headers=headers, method="POST")
- with urllib.request.urlopen(req, timeout=timeout) as r:
- return json.loads(r.read())
+ try:
+ with urllib.request.urlopen(req, timeout=timeout) as r:
+ return json.loads(r.read())
+ except urllib.error.HTTPError as e:
+ if e.code == 401:
+ raise RuntimeError(_401_detail(url)) from None
+ raise RuntimeError(f"{_host_name(url)} returned HTTP {e.code}") from None
+
+
+def _assistant_text(data: dict) -> str:
+ """Pull visible assistant text out of a chat-completions payload.
+
+ Thinking models may put tokens in `reasoning_content` and leave `content`
+ empty or null. Callers that need a formatter result must treat that as
+ failure, not as a blank document.
+ """
+ choices = data.get("choices") or []
+ if not choices:
+ raise RuntimeError("The model returned no choices.")
+ msg = choices[0].get("message") or {}
+ content = msg.get("content")
+ if isinstance(content, str) and content.strip():
+ return content
+ if isinstance(content, list):
+ parts = [
+ p.get("text", "") for p in content
+ if isinstance(p, dict) and p.get("type") in (None, "text")
+ ]
+ joined = "".join(parts)
+ if joined.strip():
+ return joined
+ finish = choices[0].get("finish_reason")
+ raise RuntimeError(
+ "The model returned no text"
+ + (f" (finish_reason={finish})" if finish else "")
+ + ". Try a non-reasoning chat model, or pick Auto."
+ )
def chat_openai_compat(
@@ -199,8 +268,19 @@ def chat_openai_compat(
}
if max_tokens and max_tokens > 0:
payload["max_tokens"] = int(max_tokens)
- data = _post_json(f"{base}/chat/completions", headers, payload, timeout)
- return data["choices"][0]["message"]["content"]
+ # DeepSeek-V4 defaults to thinking mode; reasoning tokens consume max_tokens
+ # and the formatter gets an empty `content`. Cleanup is not a reasoning task.
+ if "deepseek.com" in base.lower():
+ payload["thinking"] = {"type": "disabled"}
+ try:
+ data = _post_json(f"{base}/chat/completions", headers, payload, timeout)
+ except RuntimeError as exc:
+ # Older DeepSeek-compatible proxies reject the thinking field.
+ if payload.pop("thinking", None) is not None and "HTTP 400" in str(exc):
+ data = _post_json(f"{base}/chat/completions", headers, payload, timeout)
+ else:
+ raise
+ return _assistant_text(data)
def chat_ollama(
@@ -278,12 +358,30 @@ def chat_anthropic(
return "".join(parts)
+def _pick_cleanup_model(models: list[str]) -> str:
+ """Prefer a fast chat/flash model; skip dedicated reasoners for cleanup."""
+ skip = ("reasoner", "o1-", "o3-", "o4-")
+ scored: list[tuple[int, str]] = []
+ for m in models:
+ low = m.lower()
+ if any(s in low for s in skip):
+ continue
+ score = 0
+ if any(k in low for k in ("flash", "chat", "mini", "haiku", "turbo")):
+ score += 2
+ if "pro" in low:
+ score -= 1
+ scored.append((score, m))
+ scored.sort(key=lambda x: -x[0])
+ return scored[0][1] if scored else models[0]
+
+
def first_model_openai_compat(base_url: str, key: str) -> str:
res = check_openai_compat(base_url, key)
models = res.get("models") or []
if not models:
raise RuntimeError("No models available from the configured endpoint.")
- return models[0]
+ return _pick_cleanup_model(models)
def first_model_anthropic(key: str) -> str:
diff --git a/app/src-tauri/resources/sidecar/requirements-ocr.in b/app/src-tauri/resources/sidecar/requirements-ocr.in
index 7ddd1ff..e038e35 100644
--- a/app/src-tauri/resources/sidecar/requirements-ocr.in
+++ b/app/src-tauri/resources/sidecar/requirements-ocr.in
@@ -1,2 +1,3 @@
-rapidocr-onnxruntime
-pypdfium2
+rapidocr>=3.9.2,<4
+onnxruntime>=1.29,<2
+pypdfium2>=5.13
diff --git a/app/src-tauri/resources/sidecar/requirements-ocr.lock b/app/src-tauri/resources/sidecar/requirements-ocr.lock
index 763104a..68c6efc 100644
--- a/app/src-tauri/resources/sidecar/requirements-ocr.lock
+++ b/app/src-tauri/resources/sidecar/requirements-ocr.lock
@@ -1,12 +1,203 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements-ocr.in --generate-hashes --python-version 3.12 -o requirements-ocr.lock
+antlr4-python3-runtime==4.9.3 \
+ --hash=sha256:f224469b4168294902bb1efa80a8bf7855f24c99aef99cbefc1bcd3cce77881b
+ # via omegaconf
+certifi==2026.7.22 \
+ --hash=sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775 \
+ --hash=sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55
+ # via requests
+charset-normalizer==3.5.1 \
+ --hash=sha256:00668ebb0609751758682eb0b5857e7c35b9f00e84dfdef062e103244ec94d45 \
+ --hash=sha256:012a22b88a77ca2e59b98ac5889b0deb604147666032f45e6d6e217634d2550d \
+ --hash=sha256:01e93745f7f219b703b60ba7afead36cfc4242782be5af484673fc500df12da5 \
+ --hash=sha256:04368edf83514385ffc3e1cfd4546e595f4f1272dd23ba437a93a9cc3741d47b \
+ --hash=sha256:0722590aabf9dc6a6c0343d523c05458fa2b5047dbe6302fd526bb570600753f \
+ --hash=sha256:07ffd07412fc5d5e84cd8952acf9ff7e4ed7a708e69d1bada19d8ba91711353f \
+ --hash=sha256:09a7bba9f739468c8e78c36a75c33768e53cb1959fc638f510454c14683f00d5 \
+ --hash=sha256:0b2b1b3fa5670c127b246df1d0c059defd41f689a868a3b9d79df9b1cac42d22 \
+ --hash=sha256:0c6dfb5ca6723eeed15aa8e564a014d69fcb8812f94eef11fe3631e0508199f5 \
+ --hash=sha256:0d929fc574b4d6fd9e7c0f5c2ede8716a41911923aa7fa5fce38e0818aa4a1ac \
+ --hash=sha256:13e3afe97712e8887cd516e960c63f0b93122971e5b5e4b2622fe7701771e838 \
+ --hash=sha256:15f024313246a4ed976c60f440bb8d257815513a681d212ff74fd46f7d715a90 \
+ --hash=sha256:195ce897c6153c0700078142cf8efe3e6454ca4cf4357499e4078dfd83396626 \
+ --hash=sha256:19a3dd5aa73cef1c99687c4fc57db016a9c17104ae1185da88ba566a5d3bebe4 \
+ --hash=sha256:1d1c7a53a6c2103925cdd6d7229f8c567379f211c869793df679f2e9f738c369 \
+ --hash=sha256:1f5883d77fd409a261abb5dc8ccbe335720d798b1de4abb3b1d47ccbbc76b53b \
+ --hash=sha256:21b82d8082f6f5e7f456ef0bd16323d08de1266efbfeb476e64b2a91d1471a4e \
+ --hash=sha256:252d099029bcbea642f2a06c4ed5046bdf8b5a8150b64afa5e027e88b106e5ee \
+ --hash=sha256:256dd4d85d9e4dc595e2bc983c980e73f62ddeb3165c58b4c3dfe78c5c8548c1 \
+ --hash=sha256:26422d45fd13551cf564c58932f7d72b4f58b93b0fcf18c35ba6be12b46bb102 \
+ --hash=sha256:2679de311c7946dde5d3b6f44941844133ff5c7cb86099c0061ab1e8901c20a8 \
+ --hash=sha256:29880d17a8eb0b5cfdfd8944b468322928059aa35f1f5fa8ff22b149ec0b42f8 \
+ --hash=sha256:2bced4061f000f7187254a02ad3433ae17eaf991747ceea2f478422590a5bba9 \
+ --hash=sha256:2e9cf9253119d8e5d111f05d71626786fd3d6193817316eab1ca088cdb8593cf \
+ --hash=sha256:2f06b7eae9dbe77fe1d644ca244dad508de8d302870a43f3c559b521270938a0 \
+ --hash=sha256:2f293479cce755c75f1697e87c409b7ae4c555c7dfecb6e988ad13abba943031 \
+ --hash=sha256:329fc3ccb63ad22d867d84c2adea759a64079a37ba4a343433b02c7a2816871e \
+ --hash=sha256:343fb4f2821043bd87095f7b08a1a181febc8e36ac64212143bbfd0a0e1bc235 \
+ --hash=sha256:3588e376b3ea2eea84976f67273d679f229e24c66dce7b82ae45aef04ff6e072 \
+ --hash=sha256:35aea775dc2bd5f54cd84a1cd2696cc3207c479cb9cf0bd346f0d343e4300ddb \
+ --hash=sha256:35fe081843b35aad20ffeccec3eeffbe637b15d14f3fb22cc1b59cd8ec17e93c \
+ --hash=sha256:36047af20e17097c3bb9476c2b7655f2f7aa51322c0ba58c07695bedf755a950 \
+ --hash=sha256:3617ac3cfd8b9888f145ad89dd6e692285834b0201c6074a5eeaad3fd4d668c2 \
+ --hash=sha256:366ec70f5547c640d3ce1985722490f23faf4eb5216a7eeba78277490e78dacb \
+ --hash=sha256:394fea06235c8543390050ed5f529187074b029fb027213f6c46ac11ab5d950e \
+ --hash=sha256:3d27167433c0d5f18dc850f07d0b3816221984fecdc405d6c157a6f0b8f8e9e6 \
+ --hash=sha256:3e5e1224c0a6a90e05843e07adfec669edebec17801c67072f51e59561d63c0b \
+ --hash=sha256:41876ee62a3dddf48ff1121ad8f0798032aa03f2fd35f21f34a4cab14f18d8d2 \
+ --hash=sha256:433c5a81eade63b47e522303bad236f59dba55ea6951746f5558355eeed8c75d \
+ --hash=sha256:4582c27e8c889d64811987b5967fbd3ae0c823fe1fd933b543d55ac20bb475fa \
+ --hash=sha256:485a0d363cafefcd2538a73c7c838daa2035f09b2c9f9b5e3133f80c6aeb84c2 \
+ --hash=sha256:494b70049a4d69aec6e8137c13af4cf8db8c9f9820a1392ac293b0dd2987a818 \
+ --hash=sha256:496846868fea80e479324862fa877f02411f2fd0f83b79ccee2607aa68b2a032 \
+ --hash=sha256:4abdc5f9ad448c1ecbfae2974b820535d6bc6e7eef63babbab3d81cf46968c71 \
+ --hash=sha256:4b599739b93b2cbeded49645ae3c8d1405c29ddfbceac1545c87a3f9580a9e96 \
+ --hash=sha256:4bea7f8ebe90bbd7f0e4a2de42ca6924ba23e3e76418c408ff82f1d46fabd687 \
+ --hash=sha256:4c4fb141a727957c93edfe5c32a26ceb6b5f6461d67146e2d39f51e16170bea8 \
+ --hash=sha256:4c9548dc78002099910abaebc0a72ac58b7d30931869e0351c09b507dff4ece3 \
+ --hash=sha256:4d26f14f041e83dd8edfd61f4cd4fa7285d31798b5bf1f28e70c367ba6c41d61 \
+ --hash=sha256:4f298bdadb8f0b9e5672877f647d1be9373ef5320c9e2f049795e26cad28b6a9 \
+ --hash=sha256:52ec005752a56ae79547a05c0139ca2501a0c866390b6115008456b9f0e7cde1 \
+ --hash=sha256:55261ac0d2941c42f196dd576f543d87a8ee03cd6f5e30dfb4d807b2e3b9121a \
+ --hash=sha256:56490c595a28b1bb27dfc583e816152a9767721ef58b2c03b13f954d2f707420 \
+ --hash=sha256:58d3e12c88e0950bca850ae1f7c256055c097639c2edb9eb123af9807d8b15e4 \
+ --hash=sha256:58d4aa13a59c969dbfdf9e6a9560e242cbfd9e8a8f50c2747714df1a423adf65 \
+ --hash=sha256:59171c6e45bf07d0d5cab3b0bf81d945035530f6873398b3b531c31184d46663 \
+ --hash=sha256:5b6d1386bf0096d26d3a863dc0a487a5b4eb9aa93cf5ba69683d29dde6b9d60f \
+ --hash=sha256:5c0ea61a470e070686aa30892fed79e297d2c8d0ab46b8bcdf027d38c51da591 \
+ --hash=sha256:5c84bec0ab5ae0c64bfe73a7d2adcb5ce73b467523fc27fd6a28ab2aa6cbe35a \
+ --hash=sha256:5ca0555312ae2fe82715cada7fac375530c2f3349e1eaa1bcb33d0283ac79a18 \
+ --hash=sha256:5d8531a6569d025f68e2321e7638fb7978f23db58e5f69f56913837aae03816e \
+ --hash=sha256:5e2d0e146dcb57034f8b97dc58d2d512cb90aba253960ce449f695fec6a82c6f \
+ --hash=sha256:5fc45d653ea8c9a20479167e11d4a0f8cb2fa3470737ab6f9c827532313187b7 \
+ --hash=sha256:6117b84ea48435e5356dc737f5121485c30920ba43375fa7b434fd753df0eac3 \
+ --hash=sha256:6199d5606e2bbf2b096cf64d03f8b6790c91081d5ac866b8e7bb6422738cc60c \
+ --hash=sha256:62b55f6722735a6c472f88361cde6640608773d9443cebdbb51abf436a1fcdd3 \
+ --hash=sha256:687c9ca3035544b113bea2055e180af96fb63c0c476e22a9180f51925186e7b7 \
+ --hash=sha256:6b7430cf5728e68f6c462254009a6ef4086e1bea43cf2f57aa9c55fb4f50ff96 \
+ --hash=sha256:6ba32c4d2abf1d2fe7cf27d280f4cca5664233b0f885549c7761719eb977f486 \
+ --hash=sha256:6c9cdde8becb25a7fde49924511aa2644d6f8081cc8df8e9452724303348d8e3 \
+ --hash=sha256:6df0ec430f9a831772c23ca5a224cba36517a58a84bb32c32bb59a9fa67c47f6 \
+ --hash=sha256:6e2912d4babbc65196ac13c2f53468dc57fb8b9c25ef913e8c59ddf7c6dc0e1b \
+ --hash=sha256:6e5e4d73d588ca5ed09df1b7dcd1b203d1df3c542e3f50d126c947d432b10731 \
+ --hash=sha256:70055ff39b97c99e7ae40ea3e393fb62aa2e44dbd9b29f8d14f42fb0025c3959 \
+ --hash=sha256:706bfd38730a5ac7a365793269a00f4e988178cec121391f4248d84ad8c972e9 \
+ --hash=sha256:7235dc28fc6dd9d832ac7c7bce95367dedb85929f17368a0c2bee1e080b9acbf \
+ --hash=sha256:774d157f112367ff4abd29019f38f023c24e00e56edc7829c20e358a5a913ad8 \
+ --hash=sha256:77efcff2b23071c349402ac1066667a3d011f62398d81408c9b88ad991747c9e \
+ --hash=sha256:789b8982559ae28dad2356519f841655756cdcd96616410590ae0b17454ee64f \
+ --hash=sha256:7ac76cf9afd34929d76eb7fcb63be476a4853d8a96f0dcf2d0db68a0cbdf9885 \
+ --hash=sha256:7c0c10730342b0c9b35dd1d619beb8214e520bd96a1f870f452680b238aab3e0 \
+ --hash=sha256:823f82903d189af463d7df250ef1f7f696f3cee08cc8d91deb565e8d425f6506 \
+ --hash=sha256:838648accb3a7fd9803fd45c87bce8509648eb0c11bc34e216141300977244f2 \
+ --hash=sha256:854066be00447fa8de2ccbbe893e2ffc4b123ef16d897af794c1e18bd4a714b0 \
+ --hash=sha256:85d5855daafc240cc045c026d7a15fd198a09b0fc8ff6f5ecbb5297b509cb11e \
+ --hash=sha256:85de3134b5379856e323ba37c19c9256d39425f7b76a63af52b09fb4664c2e8f \
+ --hash=sha256:87e4f41d375c0b9be2fb5251aee4b8a689169e134535aed81bf085c3b647451e \
+ --hash=sha256:88ca277405c2d3b71c4e1c2ee0e7966e807bcba86a69d11e19ba199d18ae4491 \
+ --hash=sha256:88e85ab89cb822c1e635f51d6d32e488f94e002e70e2f492bdb8b945543f345a \
+ --hash=sha256:8ac8c94b6539074e0f40899301273ac8402b9b3e01c7b7ba269ff30340aaaf20 \
+ --hash=sha256:8fe532b3c966d1fb794e0698e4589d0444017ae77fc0b31edea13c0e35bcc449 \
+ --hash=sha256:9085f87b0e38a2b92b8923059b4e8789fe40d9279712d15dcc670048d77079af \
+ --hash=sha256:90b7481fb62fbe172c558bc6fd1c4c98d82004a54a7551f20e11ac9bf0b8708c \
+ --hash=sha256:92caef967d287a407085d61176fce4012b1dd62daed4eb6d5ceb26d3d2538712 \
+ --hash=sha256:9362dd90aa7dab48c0054a21187791ccf05473f7dba5d92b8033ae62164675e7 \
+ --hash=sha256:94d78ecec2605a8d0398b0f365d5f12a63248438516f5dac536a5eff7337df4a \
+ --hash=sha256:94fbf1c0c6cc0d3d5e50f9a9313a8cdca90dd696d34b381cd1704f8c9e939f20 \
+ --hash=sha256:950f23cb393f85543777b0433f082cddd25b51ab398eac7971146495679efe5f \
+ --hash=sha256:96eefc178f8636b9c760c5829345307fd81cfae9ab1e80997dbddeb0f54ee9a3 \
+ --hash=sha256:96fef3e886d6a9874b14f27fc193fbdc69d5d8035783d86aa4e1cea594e695f9 \
+ --hash=sha256:977cdbd483a9cff38179bea4fd754289a6f2195c7abd414aba85410b3e66cc5e \
+ --hash=sha256:978eab16f55b4ab2c2a745be9a0a840bf8f09a7f227d9c76eb30214d078865a5 \
+ --hash=sha256:994e883d17c559cdfd38c84003c8b27d25424a1077272a17e7cd27bfe0bf57b2 \
+ --hash=sha256:9ac4444d8d4fd4c4bd08bf451ed3167aa9e7ec6cdb41b648794f1d1103652e36 \
+ --hash=sha256:9b5db6052055d34d41230fb78d7c439c23dc536a9896f6cb039e8dd92cfc1263 \
+ --hash=sha256:9d9a0dc7cbe9bec24c3f767c9122c41fe5a1bc43f47cd099d00d393e09769de4 \
+ --hash=sha256:9dbdd9205662134957cf0c324f639bdc5031c0ca056e2369e238db75187c0f11 \
+ --hash=sha256:9eea3ab2597a5e65fe65296e2d6a84570845a6b55532d90333d740d48bbc850a \
+ --hash=sha256:a2028475ba855475b8b4d3cfeb4994269c967aea8b9892dfba907f4263a863a3 \
+ --hash=sha256:a3a370082ce34d0612f421e15fe011c53bb1feff21a26d06ad4fb244dab5a375 \
+ --hash=sha256:a545775cfe815855ea32d7c27731d79da358ef2055b4a25830231b1622dd18aa \
+ --hash=sha256:a5cbd90ecf0fc62e64726917ad083b73001f0563657a87ec3c0b504e277dc90d \
+ --hash=sha256:a6d095662e73e74f0a49988e0593373e243e3a52e27bfeea0a859e88acf4a0f5 \
+ --hash=sha256:a6dac12ff6b846103483683f60c5f8fee205121adc58ffd87e90a90a3af69e99 \
+ --hash=sha256:a951ad59cad9145664a730d3036b40b844e74d2d3683da40111463cd3a83845d \
+ --hash=sha256:aa1099b956fb795e686d073568f6dc002a0bb89765ea6d5b055dd7d9bf1b116c \
+ --hash=sha256:aa2bb0b37202dca27175591f761108b5d34096ade1191ffe4808bdf6b1571488 \
+ --hash=sha256:aae2ee51122d3ae968a3837d97dc24a0aeebb0dea23694422cd172bd30017cd6 \
+ --hash=sha256:ab743e9bc90c1f73552ec33e10e3331315acd2c397b36065b591b0181de533cc \
+ --hash=sha256:ac00177c4831ffa650f8609e4bdddd5fe09c03b1c0c47acece7e6ea20421598b \
+ --hash=sha256:ac13b004224fb341e1e25a1ed5e19d32f57cdb2a403e01f003b46f051a550f6f \
+ --hash=sha256:acaf604462bf330b0d07e7a07c1d6e4adac79e5fb13e9c5140590542cafacc00 \
+ --hash=sha256:ae31a1a1db2ee6cc2942fccaf695c934bc7f3db9f2133a3fef1f367cf1a4ab10 \
+ --hash=sha256:ae4a097991662cd4fff0ddc74e0fe7874f82e00042fa0ea00855645ed0c79598 \
+ --hash=sha256:aea996a6aba25260827c9ea511d1addfde2da9eb686ac961838509086188b7e6 \
+ --hash=sha256:b39b69b347e5e47a3b5b8cfc005c68c1ba347474e3960236c4944a8ecd174962 \
+ --hash=sha256:b54e7e13267d49ffbfe68e25b3cbd774dab38fa37238f71265e91b36146eb21c \
+ --hash=sha256:b9af956078716df40d985fb0dfeb2c2120c5ca92ba4ff4b388acfd01cdc14d08 \
+ --hash=sha256:ba2f37ee79e6338845261a3c5b1784e5d1acdff2c0785b284f1b633033d136ab \
+ --hash=sha256:ba501e667c17d8411f98e67a022d9604ef179aff0e459b7e292c796837c13573 \
+ --hash=sha256:baf3775a2635e5a11fbd5e4e64ee69c7e86875d224a5c72aca4c141064589a90 \
+ --hash=sha256:bb57753e36e4855b8ca375069482250a6246372331a3e4f3407eaebb007443f5 \
+ --hash=sha256:bd6c173f04743d483881bffa1478d5a4624475b8cd1d2194956a75548e191c18 \
+ --hash=sha256:be47f99644b208bff7766314013f9acf57b056b04191d570d68ad14022cf5b1d \
+ --hash=sha256:c010f5581d9c612804cc59fcf7b524b707fbcb72828551237ab545bb5c7034af \
+ --hash=sha256:c1dcc36dcb96abc02236e182d17e0f71430152a6c2c7447421da2d2dc144edea \
+ --hash=sha256:c428c6c31eb5f4277d7f8eccaf767fbd548ddd5ce3c8b4f4cbbfab3d96b5904c \
+ --hash=sha256:c658c50ac0c98cd755a2dd50b7977d3bca7df401dcc47fbdfa87db53ef7d4e8b \
+ --hash=sha256:c71fb0d56c920c269cd3e2e3fe7c610e3f1fdb21a6ce60efa6430ff63676cea6 \
+ --hash=sha256:c7b742bf31c88566b4bb6335a7f393bb322e580b6bb98df7bd0c25e6e3519ce8 \
+ --hash=sha256:cc0329df4caaceb950d2f580b5ac716a377f7059624a0bafaeaf8a218c6ed774 \
+ --hash=sha256:cc5d36d96478aa9c60654bd932525bf32964c62a7281eafdf16d85003a8d6004 \
+ --hash=sha256:ce854f5f478050ade5a238731c4ca985a7d3b3cb53ff600a9b5c3b689b5f0a7a \
+ --hash=sha256:ced3fdd71aaa83ce593746c2edb42b7a59cb4c19c8b5c407781c72e493aae55a \
+ --hash=sha256:cee5dd7c6fb5dd52a0fe2a740f9bc6e3593f5f8b1788bde49de02086f30182b2 \
+ --hash=sha256:cfa1c0cc3a8f9f53f1243a5a99ac36fd003880199383b37672e86ddda9cb07e2 \
+ --hash=sha256:d1ee1e296209fdce05b81b663250eefa02213a2da7b41bf26f7829b8ba3545aa \
+ --hash=sha256:d59b75732e9b6f27388e10c14b0259cc5f2e48c78627d185e6a177b58ad3cffe \
+ --hash=sha256:d63600d620ad0064c3a748b950ac5ea38a80190e5498532efefa4b7b3f1da1f3 \
+ --hash=sha256:dd732602a7009217f658d5863d12d79d373a4de0eebc111094bcdd3bb8e0a6cc \
+ --hash=sha256:e06efa066f7dbadbc84ebc126a97c452a6451dfcf589d89d788484949e1cf795 \
+ --hash=sha256:e199fb99720074809a7720f1c0b4d919eea8b87e88713e0f8f602f7bef543d9d \
+ --hash=sha256:e4b018dc5a0eee4676e38fe84a47a427816c590b93b55d9025274ec4d6ffc2dc \
+ --hash=sha256:e6621fb2a4988d6e53eedc455e5903e2679f3967b8acb3d639f1b63c14a2e893 \
+ --hash=sha256:e71c909f353863b2b89c83de2ebed71ea6d0df8a6ef65a128193c5e650766bef \
+ --hash=sha256:e90251c0c7bdd54a100a0dce3c07b7e637278c93af29dbf78ebb89a58c4bac7d \
+ --hash=sha256:e9fbdce1e47394b09bc9f26ab117dfc8d6491977a11d86f592bb42c779db2fda \
+ --hash=sha256:eb12fb2ba69ffa05f8695f61c69e591dc4b4a12ac3757ac8af8adb259bf56d17 \
+ --hash=sha256:eda059b6bc8bc0812d626fd91a7ce01bf583df0a61296eff390fd94141a34e30 \
+ --hash=sha256:f03ac127268b43ef4fe9e6ab6794a6794b49485a0cc0c1db79876d2f33f75bc7 \
+ --hash=sha256:f298e218441525d3794428b4c8b8fb8662c6d3ea79925d4807ee6b9a96a3bca5 \
+ --hash=sha256:f5542f9b941279d82d41eb0aa9f98eba36fe4df5c7086c651df7944935b37182 \
+ --hash=sha256:f6f7deae3feb4edfa2efaf7c574fe88cbf055038a6abdb40188e4fff66d5699f \
+ --hash=sha256:f9b1e28d0e8dbfa858abdba91d6b547beaf2df1a59bec6da6faae7b96a4991a9 \
+ --hash=sha256:f9f8405c2c758532c74fed975dbee57be1f31a6e865c031870c79a6ed3212ada \
+ --hash=sha256:fa48b1b63d639f9483e0633e092f5851e2348c352f1f9bb6c8182f87884ef876 \
+ --hash=sha256:fb78f6e7fcd8ad785d28cd577168bc1aaee827b25bb8755638f694794ea98f0a \
+ --hash=sha256:fbc597639158fd7c14d55e808718848319540f51b0e6746e3eefa59723a4a348 \
+ --hash=sha256:fce8cbd4997efeb450bd298b54f755dcdff18d496f7a5ddbb4867c6d7c88fdc3 \
+ --hash=sha256:fd0350afdc3aabd5576f60ea109228bd5538139713c7b094c5cd27c73a98bc6f \
+ --hash=sha256:fd0a274c0e5f9a21565cd9d3dd749b61f96b7aa1e20a93aa1ba4029518f2e5c0 \
+ --hash=sha256:fdb8a068947befafba9952162645dc2fecaeb400e64584829ed5e9b2fbe21a7f
+ # via requests
colorama==0.4.6 \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
- # via tqdm
+ # via
+ # colorlog
+ # tqdm
+colorlog==6.12.0 \
+ --hash=sha256:2a7924c1dadf18b22a0eb8b06d1c7b01d5341707ec1641eb6fcc4fde0c3e8e5f \
+ --hash=sha256:30d392604e9110045a2c2aeefc27d7a017abbab63f3a8aee594eac0801df784e
+ # via rapidocr
flatbuffers==25.12.19 \
--hash=sha256:7634f50c427838bb021c2d66a3d1168e9d199b0607e6329399f04846d42e20b4
# via onnxruntime
+idna==3.19 \
+ --hash=sha256:5e0811a4383b21dc5838069f801c4fb62113b7447663d2530d2bd6e77b49bf15 \
+ --hash=sha256:815e7be7a7806d54abb586dc943addc79e8b2ee16915059658cbeff4b1b43bf4
+ # via requests
numpy==2.4.6 \
--hash=sha256:001fbb8e08d942dd57599e781f2472269ee7f2755fae407b4f67b2f0b17da3f1 \
--hash=sha256:0280e0356c0829a18d9de1cb7eee50ec22ca639878d7240307ca0943d73cd2c4 \
@@ -83,34 +274,38 @@ numpy==2.4.6 \
# via
# onnxruntime
# opencv-python
- # rapidocr-onnxruntime
+ # rapidocr
# shapely
-onnxruntime==1.27.0 \
- --hash=sha256:0874edc171f470fc4dd2bbb60bc0989612ed1a8b89b365cda016630a93227f13 \
- --hash=sha256:1b215aa662c8f983f7d6dedafe65a9be72c26e5338e0fe98b3e0422c32c85428 \
- --hash=sha256:20c321cf187ba496e648acf6b4cf90b4d398b0d17c2a77fdaeba365b908cc1c1 \
- --hash=sha256:2eb083321af8a236a84c7c140a7f4cecbfa2a987a18c07c78db471c20cd390ef \
- --hash=sha256:2fdfa9df40a0ded0028ce6f9cd863264237f3970559dea2b81456e9ac4622b94 \
- --hash=sha256:370d211e1ceeac4cd5f45301655463ac59e27cdc74d9f7aeb2d19ff4b7a76715 \
- --hash=sha256:445fb702ea5241ba813a3ce2febe2e9408a64f6ad2eb610924322c536165f7cd \
- --hash=sha256:48b3d87eb560ff6a772240506f3c78d6d27c63cafedd5c775672e1194f968cfd \
- --hash=sha256:49e416be0d717338b6d041b99911b716d70c397d277056450724f93bdded3fc2 \
- --hash=sha256:54c0c4e9202c36c4ecdb1f3443f5dfbfd5ee3b54d1362c4b4c6134110e74fb32 \
- --hash=sha256:5b51c014cf1a4fcd93c29a97eac8071fa27710dae05a4d0380bb60a66d60a62c \
- --hash=sha256:6872443f236a554921cda6f318c900e2d0c226792cf3534d00e5057c6926e5d2 \
- --hash=sha256:75fbc1e1fb43a39a856c8209c544cca7817b5de7ac16b15b1bdf55d1cc67b9df \
- --hash=sha256:760021bca514d64a811837820d351a08a41741f16f8b4c26450da708fecf14e6 \
- --hash=sha256:7c65a7438632d55dfbc8a02ee60bd6cf7dd9d1ba05a43d4b851452f32338e194 \
- --hash=sha256:856032937dd3bc7a7c141909c8d7ae4fde3e3f59bddf061ae627b9a051bda95c \
- --hash=sha256:8ba14a38c570087f3cdb8cfba33f7a38a1e826c1e5b29e17c28ceda0cc910016 \
- --hash=sha256:a14c2ce45312def86b77aea651f46565e45960cf5f0721bfdff449165086ab76 \
- --hash=sha256:b3e5b58b8c89c2b20e086e890aa9527377e5c240dc3ecc1640d18e07705eeb1c \
- --hash=sha256:c6197a02e3f620c4dc13cff51b80672409fc1ffab3aa2593911b19fd322ff48b \
- --hash=sha256:c6fddce0539a4898c7bef35b052ffd37935b2190e35488eab99ce91887743ea1 \
- --hash=sha256:d0d1f68868e2ef30ef70998ba9bbbc5c305e9b17041e3936751c1b8aa6aade06 \
- --hash=sha256:e4f7b0e90d2d212e2c2deaa6c8291616183ab815d3ec558ea12d3ac8b26d36f4 \
- --hash=sha256:ff050e4f6bf7f12918fa14dcb047c0b02e295f35e86d42532552be4b3d54e977
- # via rapidocr-onnxruntime
+omegaconf==2.3.1 \
+ --hash=sha256:3d701d14e9a8828f1edd28bb70b725908b34277cdd72cf7d6a83f94dadc6b6a0 \
+ --hash=sha256:e5e7de64aeebeddaf8e6d3f7a783b32ac2a01c0fbd9c878012caecb891a1f42a
+ # via rapidocr
+onnxruntime==1.29.0 \
+ --hash=sha256:07c5907474dec4a2792fd7626b753dc66707808385a6d9eecf993db0066a9d0f \
+ --hash=sha256:0d4f427afac434b0070fe992b540ddf20a7aff2265f760f314d91331935b6b98 \
+ --hash=sha256:11264bb58f7b7cf6af835ab10d36838d73680580820fd6f51d90124a1ca8f449 \
+ --hash=sha256:16925ef8497e2c07e4b5ae15b504079b3ab3f65e22c58efd10dde0f3caea969a \
+ --hash=sha256:1ea91cef3b971506e51ae9c37c16d027774ec64994a524ec1bdfb027d68a9832 \
+ --hash=sha256:2945e1f82f81f27e88decea88c7861f45baea23818950d467bf3909aa303119e \
+ --hash=sha256:2b80d8c7ec2cc7438e4da3760b88c24568cba72c9ace96d668800a6c79419acb \
+ --hash=sha256:3a3814c041251d6a77fdf513fb282056538ee826d2f1178a0df3c549d3fff6ba \
+ --hash=sha256:4a3129ae56e70d2618ff773920166916310370a7e3cacb60b9e0e8910092725f \
+ --hash=sha256:4acf2b4948b7ede87221ca6332344b8facdc8059d6ac751a7d367d04532b02dd \
+ --hash=sha256:4b940b0d777590c7e20bf298f5c16af1ea6ad1b400a1c822a6be192f64f4d954 \
+ --hash=sha256:4eae472cf7dc3107dec1bb53cd6d142d1964616d08aae48654cd4254b2363c4b \
+ --hash=sha256:533f8370ce124304e5cb08ab961836cf755631e3dd77adc5f3bbdab70c2b7d99 \
+ --hash=sha256:6c0c37b92f67ed68dd36221ce0403e1d9bd4f7efce724439978a2597848530e5 \
+ --hash=sha256:85f8e8406c52658735fe5c7fbfd3ebaa1ed340768324f6252e4274e374580a23 \
+ --hash=sha256:939e5d65f332e6d399774b2bd0d3559fd8fa629c1e77833db29d968d2384f23d \
+ --hash=sha256:be0f8ed688cfb1d4d5765a137193b7bfab0c8ea214eed99260b380bb525a3a7f \
+ --hash=sha256:c1ad3f437153fe77f9d01a08fbaac0beb030e09b8a80ace1603bcf69b6c95481 \
+ --hash=sha256:d2fb19e848f7c33ed8d3182b52504aaa11c5e8da438bbb47296f85b133cbcf6b \
+ --hash=sha256:d67673c5367727860922c5262d724472f1b5539fb7ccf4c81a638f9b71719803 \
+ --hash=sha256:dc61a79cb39afd66ab3f01fd2c23591a7f01de89c1668e1fb6315067fc279164 \
+ --hash=sha256:e2128f31f449e922c62dbe5d8b6b7b079f0bcaf2d56a102fa203cb6e5bb5ab19 \
+ --hash=sha256:e417ef8628dcce310d2d53023e750ea298ec14d4341ae6dc3a572bfd9bc7fa97 \
+ --hash=sha256:e74b278af1d949876f5d91d1268fd6c680e79f2bac194967394eaba9fdf69e7e
+ # via -r requirements-ocr.in
opencv-python==4.13.0.92 \
--hash=sha256:0bc2596e68f972ca452d80f444bc404e08807d021fbba40df26b61b18e01838a \
--hash=sha256:372fe164a3148ac1ca51e5f3ad0541a4a276452273f503441d718fab9c5e5f59 \
@@ -120,7 +315,7 @@ opencv-python==4.13.0.92 \
--hash=sha256:620d602b8f7d8b8dab5f4b99c6eb353e78d3fb8b0f53db1bd258bb1aa001c1d5 \
--hash=sha256:bccaabf9eb7f897ca61880ce2869dcd9b25b72129c28478e7f2a5e8dee945616 \
--hash=sha256:caf60c071ec391ba51ed00a4a920f996d0b64e3e46068aac1f646b5de0326a19
- # via rapidocr-onnxruntime
+ # via rapidocr
packaging==26.2 \
--hash=sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e \
--hash=sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661
@@ -217,7 +412,7 @@ pillow==12.2.0 \
--hash=sha256:f490f9368b6fc026f021db16d7ec2fbf7d89e2edb42e8ec09d2c60505f5729c7 \
--hash=sha256:fb043ee2f06b41473269765c2feae53fc2e2fbf96e5e22ca94fb5ad677856f06 \
--hash=sha256:fc3d34d4a8fbec3e88a79b92e5465e0f9b842b628675850d860b8bd300b159f5
- # via rapidocr-onnxruntime
+ # via rapidocr
protobuf==7.35.1 \
--hash=sha256:11d6b0ec246892d85215b0a13ca6e0233cf5284b68f0ac02646427f4ff88a799 \
--hash=sha256:230a75ddfc2de4806e56696ce9640c1cdfdb6543b7cfce98d42a4c0a0e7bdb87 \
@@ -265,30 +460,30 @@ pyclipper==1.4.0 \
--hash=sha256:f2a50c22c3a78cb4e48347ecf06930f61ce98cf9252f2e292aa025471e9d75b1 \
--hash=sha256:f3672dbafbb458f1b96e1ee3e610d174acb5ace5bd2ed5d1252603bb797f2fc6 \
--hash=sha256:fd24849d2b94ec749ceac7c34c9f01010d23b6e9d9216cf2238b8481160e703d
- # via rapidocr-onnxruntime
-pypdfium2==5.10.1 \
- --hash=sha256:09fda0609dc4749c9865a0315c447d6f2583a580693bcabd69980d3fbb22ad51 \
- --hash=sha256:0de53d2710ca9509fc2812340acc57c3f043697609068592d87de654f8cabf44 \
- --hash=sha256:10a26ce04795f8ec079e81c707fcb5737061e8a78025babc3d6e36642e9c903a \
- --hash=sha256:139a6387a3a2652f288e53164268bb03af4fa221d78484ee18407053a60082a3 \
- --hash=sha256:13abf7a9f5e0ddebc8bbcccea5f13ae5abe8a298ea219e125b0fc24c1d2171b4 \
- --hash=sha256:172ff3e10358d66456e27fb0b8b5098e28ec24e51072eb4b5b86077d550e21bb \
- --hash=sha256:3ba127750bc3f4161461538d532d74491cd976f584f1753a6cee9cb821338ec1 \
- --hash=sha256:58da5b51fb7884c7d21a05062ab13edb011d1a08dfd9694f3d5d685df62796b9 \
- --hash=sha256:610e14c37d2090b826dccc0604fc7e7612c0ce591190780ae228abdb9abb971e \
- --hash=sha256:6b01adcfe9aaf7a635a59bed5687fd4fd7b0da292664f050d4ebd2bfa5c70584 \
- --hash=sha256:80f30517ee089dfbbc6e9de6da365b6e8c0ce8f80c40b7d4025a3b1d3bbd8a70 \
- --hash=sha256:8702bb4f01ddfc8e7757b41b4c2c8392ac17c9f0234476e1e69672ea7c6d6aa0 \
- --hash=sha256:8947fa3cd808da33960bdf8ff9e5247aa94ccd94f0b09bb3402e99498d83bcc9 \
- --hash=sha256:a0dc52b56631e2f7edcdb22bae3b155aa840bec32c5bd05781e90baaecee88e7 \
- --hash=sha256:ad5f5de15febb788c6eb3853e58aceda9cd8c5187c92472abaeecf9558deb0cf \
- --hash=sha256:be6d2a8d1bcfd777188e7aa55a25c83f34d54e8350ad8810fb32017787d9b0d9 \
- --hash=sha256:cf4d2527f79f31c550490cc74c9f32e19385a944630a3ef4cd4d9b6f961fbf77 \
- --hash=sha256:d04f2050b6b32bb18624688b600543342a4ab3aacf64bf66521a5af72bbc7de1 \
- --hash=sha256:e3301c2f7a66fb8cb57dba857d0c9e90215e178f6602a87c5a306cd98513dab8 \
- --hash=sha256:ebb9e63f92d15fc41b359fe7a187233dfae37548800e1fa09cb2fc466ac89951 \
- --hash=sha256:f257d2011eb43c846b7e9f5a802e28646b29732763e4a35dd6ca76f9be580538 \
- --hash=sha256:f2803020952afa57e1e148adc19369b835154e1fa251a1ca85008ab6466a710f
+ # via rapidocr
+pypdfium2==5.13.0 \
+ --hash=sha256:07f58e91b8c45ca144a1ff3008faf3c73ef8a5e9fb32988831788363288228cd \
+ --hash=sha256:2abedfb5c70992b19c780ed58d7f7b929e8ce8ee52c9140158f44317c90ec6c7 \
+ --hash=sha256:2ed32ff685f8e05e637c990bedbf5fca66727bf27718d8bc33eeab21ce0630d1 \
+ --hash=sha256:3826e521e895648983cb9ee6b934d4bf51552600043984f84e9c2b3b14b696f3 \
+ --hash=sha256:46b2f5be9e7ae941ee4216e3d20b66f9dc3d81944a3d57756272de5275204709 \
+ --hash=sha256:47dcca2a8d507b5fd24f94c3c9d48fb379430f097bc20f01beff6c963ffbcedb \
+ --hash=sha256:554a0b23376460af1410e3c915906895e2dac67a086b9e6ccde0643a795d3b0d \
+ --hash=sha256:5c029d7163a91f264eafab51fb442a84a33efd9fd83d5a06c0136a7857a3cc8d \
+ --hash=sha256:7ca2d8e31bd8d0d40c496416b7d8bea423388669ffd494929f50e8c3a82326b8 \
+ --hash=sha256:81df25c1ab4c13ff773102d3cbea1967511d079123b067fc077bd0c4d57d91d8 \
+ --hash=sha256:882f4bbd4b17a335b43603169a14cde9341de12b238acd5c39e690cbca7c4293 \
+ --hash=sha256:9c777edba28d1d5fd15435ed3a78ee2fdb93dd069be37cb53b559bc122793770 \
+ --hash=sha256:9ee8c2bb2e68b396ab4a763215ac100dacb6b96d0da5bebeb239a021aecc3a7e \
+ --hash=sha256:ada81c36483cd61d07e32bc7814620ee96256b4f421b913f566861bf91800248 \
+ --hash=sha256:b90b0a5ac310bb34db8eb848e58fcab4e201e124e3cf3cb1ccb7b85293e034af \
+ --hash=sha256:bcd81394fe101405e026eedb3e40bef84635c1e5d974dd6036420eb6937753c6 \
+ --hash=sha256:be2dccbde0ce7efe334ecd8f348df4308db360756ede4f0821d82dfc9a58caa8 \
+ --hash=sha256:d33ee7077db67478b75efe4b5ea9610fb96c5416a0bc4949227f0f59c34dfcd9 \
+ --hash=sha256:d66a32d89fa5b4a2715810171239eb194df4aba604727483ab760512f3c6a851 \
+ --hash=sha256:d96929bde3bd64c771ab3558ca1ffd7704cc4d872ab92cd9f8f8b8a20f7f36b8 \
+ --hash=sha256:d96beb7f379e6c76d874ca93fcd182ac3168dd499056407070f9927fb1061b8e \
+ --hash=sha256:da5c7b74eebf40b5c1fbe1de01aa1edc8827a79fb1efd999616bc20dcaf77ba4
# via -r requirements-ocr.in
pyyaml==6.0.3 \
--hash=sha256:00c4bdeba853cc34e7dd471f16b4114f4162dc03e6b7afcc2128711f0eca823c \
@@ -364,10 +559,16 @@ pyyaml==6.0.3 \
--hash=sha256:f7057c9a337546edc7973c0d3ba84ddcdf0daa14533c2065749c9075001090e6 \
--hash=sha256:fa160448684b4e94d80416c0fa4aac48967a969efe22931448d853ada8baf926 \
--hash=sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0
- # via rapidocr-onnxruntime
-rapidocr-onnxruntime==1.4.4 \
- --hash=sha256:971d7d5f223a7a808662229df1ef69893809d8457d834e6373d3854bc1782cbf
+ # via
+ # omegaconf
+ # rapidocr
+rapidocr==3.9.2 \
+ --hash=sha256:04d6b8d151f823d930bd91910555f57bea897c0c44fa6794267b94cf9c1ef9a0
# via -r requirements-ocr.in
+requests==2.34.2 \
+ --hash=sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0 \
+ --hash=sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed
+ # via rapidocr
shapely==2.1.2 \
--hash=sha256:0036ac886e0923417932c2e6369b6c52e38e0ff5d9120b90eef5cd9a5fc5cae9 \
--hash=sha256:01d0d304b25634d60bd7cf291828119ab55a3bab87dc4af1e44b07fb225f188b \
@@ -426,12 +627,16 @@ shapely==2.1.2 \
--hash=sha256:fe2533caae6a91a543dec62e8360fe86ffcdc42a7c55f9dfd0128a977a896b94 \
--hash=sha256:fe7b77dc63d707c09726b7908f575fc04ff1d1ad0f3fb92aec212396bc6cfe5e \
--hash=sha256:fe9627c39c59e553c90f5bc3128252cb85dc3b3be8189710666d2f8bc3a5503e
- # via rapidocr-onnxruntime
+ # via rapidocr
six==1.17.0 \
--hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \
--hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81
- # via rapidocr-onnxruntime
+ # via rapidocr
tqdm==4.68.3 \
--hash=sha256:00dfa48452b6b6cfae3dd9885636c23d3422d1ec97c66d96818cbd5e0821d482 \
--hash=sha256:39832cc2def2789a6f29df83f172db7416cea70052c0907a57801c5f2fdccb03
- # via rapidocr-onnxruntime
+ # via rapidocr
+urllib3==2.7.0 \
+ --hash=sha256:231e0ec3b63ceb14667c67be60f2f2c40a518cb38b03af60abc813da26505f4c \
+ --hash=sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897
+ # via requests
diff --git a/app/src-tauri/resources/sidecar/requirements.lock b/app/src-tauri/resources/sidecar/requirements.lock
index c60e688..11a83e8 100644
--- a/app/src-tauri/resources/sidecar/requirements.lock
+++ b/app/src-tauri/resources/sidecar/requirements.lock
@@ -611,9 +611,9 @@ markdownify==1.2.2 \
--hash=sha256:3f02d3cc52714084d6e589f70397b6fc9f2f3a8531481bf35e8cc39f975e186a \
--hash=sha256:b274f1b5943180b031b699b199cbaeb1e2ac938b75851849a31fd0c3d6603d09
# via markitdown
-markitdown==0.1.6 \
- --hash=sha256:07b2d5bf87b5c53e13a9f2fdc440df8ccc85e26f40c1e557781727b700049775 \
- --hash=sha256:e5bdbaffd971b29598c7c39ef0e9afce2f08c0751fbfa4e4257678ebaf8cfc7e
+markitdown==0.1.7 \
+ --hash=sha256:4d1f3c69cd43b82288fdc3653686d759dcf355ee7c681aa6a855aed98a1e4f44 \
+ --hash=sha256:4eca912c87c6aa6897284a7f4bf6769a23bccf8544530f5d8b175fbe3797c916
# via -r requirements.txt
mpmath==1.3.0 \
--hash=sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f \
@@ -719,9 +719,9 @@ onnxruntime==1.20.1 \
--hash=sha256:f6243e34d74423bdd1edf0ae9596dd61023b260f546ee17d701723915f06a9f7 \
--hash=sha256:fb44b08e017a648924dbe91b82d89b0c105b1adcfe31e90d1dc06b8677ad37be
# via magika
-openai==2.43.0 \
- --hash=sha256:65a670b54fadf2268c9e1330133373c963eb779ee969e5cbad419ec2c21dce97 \
- --hash=sha256:e74d238200a26868977002190fb6631613480a93dfe0c9c982e77021ed60a017
+openai==2.54.0 \
+ --hash=sha256:89089789197ccdb87f173a03145ed1598d00795220c93e96cf712b1cbf5e5f2b \
+ --hash=sha256:e3e6f8bc1ba30ddf381ace1a14340eed381cb984a1a59bd0f34b5be3b5d49cfa
# via -r requirements.txt
openpyxl==3.1.5 \
--hash=sha256:5282c12b107bffeef825f4617dc029afaf41d0ea60823bbb665ef3079dc79de2 \
@@ -1026,29 +1026,29 @@ pydantic-core==2.46.4 \
--hash=sha256:fc3e9034a63de20e15e8ade85358bc6efc614008cab72898b4b4952bea0509ff \
--hash=sha256:fd8b3d9fd264be37976686c7f65cd52a83f5e84f4bfd2adf9c1d469676bbb6ae
# via pydantic
-pypdfium2==5.10.1 \
- --hash=sha256:09fda0609dc4749c9865a0315c447d6f2583a580693bcabd69980d3fbb22ad51 \
- --hash=sha256:0de53d2710ca9509fc2812340acc57c3f043697609068592d87de654f8cabf44 \
- --hash=sha256:10a26ce04795f8ec079e81c707fcb5737061e8a78025babc3d6e36642e9c903a \
- --hash=sha256:139a6387a3a2652f288e53164268bb03af4fa221d78484ee18407053a60082a3 \
- --hash=sha256:13abf7a9f5e0ddebc8bbcccea5f13ae5abe8a298ea219e125b0fc24c1d2171b4 \
- --hash=sha256:172ff3e10358d66456e27fb0b8b5098e28ec24e51072eb4b5b86077d550e21bb \
- --hash=sha256:3ba127750bc3f4161461538d532d74491cd976f584f1753a6cee9cb821338ec1 \
- --hash=sha256:58da5b51fb7884c7d21a05062ab13edb011d1a08dfd9694f3d5d685df62796b9 \
- --hash=sha256:610e14c37d2090b826dccc0604fc7e7612c0ce591190780ae228abdb9abb971e \
- --hash=sha256:6b01adcfe9aaf7a635a59bed5687fd4fd7b0da292664f050d4ebd2bfa5c70584 \
- --hash=sha256:80f30517ee089dfbbc6e9de6da365b6e8c0ce8f80c40b7d4025a3b1d3bbd8a70 \
- --hash=sha256:8702bb4f01ddfc8e7757b41b4c2c8392ac17c9f0234476e1e69672ea7c6d6aa0 \
- --hash=sha256:8947fa3cd808da33960bdf8ff9e5247aa94ccd94f0b09bb3402e99498d83bcc9 \
- --hash=sha256:a0dc52b56631e2f7edcdb22bae3b155aa840bec32c5bd05781e90baaecee88e7 \
- --hash=sha256:ad5f5de15febb788c6eb3853e58aceda9cd8c5187c92472abaeecf9558deb0cf \
- --hash=sha256:be6d2a8d1bcfd777188e7aa55a25c83f34d54e8350ad8810fb32017787d9b0d9 \
- --hash=sha256:cf4d2527f79f31c550490cc74c9f32e19385a944630a3ef4cd4d9b6f961fbf77 \
- --hash=sha256:d04f2050b6b32bb18624688b600543342a4ab3aacf64bf66521a5af72bbc7de1 \
- --hash=sha256:e3301c2f7a66fb8cb57dba857d0c9e90215e178f6602a87c5a306cd98513dab8 \
- --hash=sha256:ebb9e63f92d15fc41b359fe7a187233dfae37548800e1fa09cb2fc466ac89951 \
- --hash=sha256:f257d2011eb43c846b7e9f5a802e28646b29732763e4a35dd6ca76f9be580538 \
- --hash=sha256:f2803020952afa57e1e148adc19369b835154e1fa251a1ca85008ab6466a710f
+pypdfium2==5.13.0 \
+ --hash=sha256:07f58e91b8c45ca144a1ff3008faf3c73ef8a5e9fb32988831788363288228cd \
+ --hash=sha256:2abedfb5c70992b19c780ed58d7f7b929e8ce8ee52c9140158f44317c90ec6c7 \
+ --hash=sha256:2ed32ff685f8e05e637c990bedbf5fca66727bf27718d8bc33eeab21ce0630d1 \
+ --hash=sha256:3826e521e895648983cb9ee6b934d4bf51552600043984f84e9c2b3b14b696f3 \
+ --hash=sha256:46b2f5be9e7ae941ee4216e3d20b66f9dc3d81944a3d57756272de5275204709 \
+ --hash=sha256:47dcca2a8d507b5fd24f94c3c9d48fb379430f097bc20f01beff6c963ffbcedb \
+ --hash=sha256:554a0b23376460af1410e3c915906895e2dac67a086b9e6ccde0643a795d3b0d \
+ --hash=sha256:5c029d7163a91f264eafab51fb442a84a33efd9fd83d5a06c0136a7857a3cc8d \
+ --hash=sha256:7ca2d8e31bd8d0d40c496416b7d8bea423388669ffd494929f50e8c3a82326b8 \
+ --hash=sha256:81df25c1ab4c13ff773102d3cbea1967511d079123b067fc077bd0c4d57d91d8 \
+ --hash=sha256:882f4bbd4b17a335b43603169a14cde9341de12b238acd5c39e690cbca7c4293 \
+ --hash=sha256:9c777edba28d1d5fd15435ed3a78ee2fdb93dd069be37cb53b559bc122793770 \
+ --hash=sha256:9ee8c2bb2e68b396ab4a763215ac100dacb6b96d0da5bebeb239a021aecc3a7e \
+ --hash=sha256:ada81c36483cd61d07e32bc7814620ee96256b4f421b913f566861bf91800248 \
+ --hash=sha256:b90b0a5ac310bb34db8eb848e58fcab4e201e124e3cf3cb1ccb7b85293e034af \
+ --hash=sha256:bcd81394fe101405e026eedb3e40bef84635c1e5d974dd6036420eb6937753c6 \
+ --hash=sha256:be2dccbde0ce7efe334ecd8f348df4308db360756ede4f0821d82dfc9a58caa8 \
+ --hash=sha256:d33ee7077db67478b75efe4b5ea9610fb96c5416a0bc4949227f0f59c34dfcd9 \
+ --hash=sha256:d66a32d89fa5b4a2715810171239eb194df4aba604727483ab760512f3c6a851 \
+ --hash=sha256:d96929bde3bd64c771ab3558ca1ffd7704cc4d872ab92cd9f8f8b8a20f7f36b8 \
+ --hash=sha256:d96beb7f379e6c76d874ca93fcd182ac3168dd499056407070f9927fb1061b8e \
+ --hash=sha256:da5c7b74eebf40b5c1fbe1de01aa1edc8827a79fb1efd999616bc20dcaf77ba4
# via pdfplumber
pyreadline3==3.5.6 \
--hash=sha256:61e53218b99656091ddb077df9e71f25850e72e030b6183b39c9b7e6e4f4a9bf \
diff --git a/app/src-tauri/resources/sidecar/requirements.txt b/app/src-tauri/resources/sidecar/requirements.txt
index 7a8eb9a..eb23586 100644
--- a/app/src-tauri/resources/sidecar/requirements.txt
+++ b/app/src-tauri/resources/sidecar/requirements.txt
@@ -1,2 +1,2 @@
-markitdown[pdf,docx,pptx,xlsx,xls]
-openai
+markitdown[pdf,docx,pptx,xlsx,xls]>=0.1.7
+openai>=2.43,<3
diff --git a/app/src-tauri/resources/sidecar/worker.py b/app/src-tauri/resources/sidecar/worker.py
index 8834824..650976b 100644
--- a/app/src-tauri/resources/sidecar/worker.py
+++ b/app/src-tauri/resources/sidecar/worker.py
@@ -67,6 +67,66 @@ def _progress(stage: str, frac: float | None = None) -> None:
})
+def _friendly_conversion_error(exc: Exception) -> tuple[str, str]:
+ """Return (detail, suggested_action) — readable, not raw exception names."""
+ blob = f"{type(exc).__name__} {exc}".lower()
+ if "password" in blob or "encrypted" in blob:
+ return (
+ "This file is password-protected.",
+ "Unlock it, save an unprotected copy, then try again.",
+ )
+ if (
+ "pdfsyntax" in blob
+ or "no /root" in blob
+ or "eof marker" in blob
+ or "startxref" in blob
+ or ("xref" in blob and "pdf" in blob)
+ ):
+ return (
+ "This PDF is damaged or not a real PDF.",
+ "Open it in a PDF reader to check, or export it again from the original app.",
+ )
+ if "badzipfile" in blob or "not a zip" in blob or "truncated zip" in blob:
+ return (
+ "This Office file is damaged or incomplete.",
+ "Open it in Word, Excel, or PowerPoint, save a new copy, then try again.",
+ )
+ if "permission" in blob or "access is denied" in blob or "errno 13" in blob:
+ return (
+ "The file could not be read.",
+ "Close it if it is open in another app, then try again.",
+ )
+ return (
+ "The file could not be converted.",
+ "The file may be corrupted or contain content that can't be extracted. Try another file.",
+ )
+
+
+def _present_markdown(fmt: str, text: str) -> str:
+ """JSON/XML come through as raw text — wrap them so Preview renders as a code block."""
+ text = text or ""
+ if not text.strip():
+ return text
+ if fmt == "json":
+ body = text.strip()
+ if body.startswith("```"):
+ return text
+ try:
+ body = json.dumps(json.loads(body), indent=2, ensure_ascii=False)
+ except (json.JSONDecodeError, ValueError, TypeError):
+ pass
+ return f"```json\n{body.rstrip()}\n```\n"
+ if fmt == "xml":
+ body = text.strip()
+ if body.startswith("```"):
+ return text
+ # HtmlConverter may already have turned XML into Markdown.
+ if body.startswith("<"):
+ return f"```xml\n{body}\n```\n"
+ return text
+ return text
+
+
def main() -> None:
raw = sys.stdin.readline()
try:
@@ -108,7 +168,7 @@ def main() -> None:
r = md2.convert_stream(
f, stream_info=StreamInfo(extension=ext, charset="utf-8")
)
- result_holder["markdown"] = r.text_content or ""
+ result_holder["markdown"] = _present_markdown(fmt, r.text_content or "")
except Exception as exc: # noqa: BLE001
if llm_client:
# Fail soft: retry without LLM so the text result is never lost.
@@ -121,13 +181,14 @@ def main() -> None:
try:
from markitdown import MarkItDown as _MD
r2 = _MD().convert(path)
- result_holder["markdown"] = r2.text_content or ""
+ result_holder["markdown"] = _present_markdown(fmt, r2.text_content or "")
result_holder["llm_notice"] = f"LLM image description unavailable: {safe_exc}"
return
except Exception as exc2: # noqa: BLE001
- result_holder["error"] = f"LLM failed ({safe_exc}); fallback also failed ({exc2})"
+ result_holder["error"] = exc2
+ result_holder["llm_notice"] = f"LLM image description unavailable: {safe_exc}"
else:
- result_holder["error"] = str(exc)
+ result_holder["error"] = exc
t = threading.Thread(target=run, daemon=True)
t.start()
@@ -139,14 +200,12 @@ def main() -> None:
_progress("extracting")
if "error" in result_holder:
+ detail, action = _friendly_conversion_error(result_holder["error"])
_write({"type": "result", "ok": False, "error": {
"code": "CONVERSION_FAILED",
"title": "Conversion failed",
- "detail": result_holder["error"],
- "suggested_action": (
- "The file may be corrupted or contain content that can't be extracted. "
- "Try another file."
- ),
+ "detail": detail,
+ "suggested_action": action,
}})
else:
warnings: list[str] = []
diff --git a/app/src-tauri/src/config.rs b/app/src-tauri/src/config.rs
index e6dd68d..39c81d2 100644
--- a/app/src-tauri/src/config.rs
+++ b/app/src-tauri/src/config.rs
@@ -12,6 +12,10 @@ pub struct AppConfig {
pub api_type: String, // "openai_compat" | "anthropic"
#[serde(default = "default_api_base_url")]
pub api_base_url: String,
+ /// Named preset: openai, deepseek, groq, anthropic, …, custom.
+ /// Empty on old configs — inferred from api_type + api_base_url on load.
+ #[serde(default)]
+ pub api_provider: String,
#[serde(default)]
pub api_key: String,
/// Stage 5: model used for the optional LLM cleanup pass (empty = auto-pick first).
@@ -65,6 +69,47 @@ fn default_api_type() -> String {
fn default_api_base_url() -> String {
"https://api.openai.com/v1".into()
}
+fn default_api_provider() -> String {
+ "openai".into()
+}
+
+fn infer_api_provider(cfg: &AppConfig) -> String {
+ if cfg.api_type == "anthropic" {
+ return "anthropic".into();
+ }
+ let u = cfg
+ .api_base_url
+ .trim()
+ .trim_end_matches('/')
+ .to_lowercase();
+ let table: &[(&str, &str)] = &[
+ ("https://api.openai.com/v1", "openai"),
+ ("https://api.deepseek.com/v1", "deepseek"),
+ ("https://api.deepseek.com", "deepseek"),
+ ("https://api.groq.com/openai/v1", "groq"),
+ ("https://generativelanguage.googleapis.com/v1beta/openai", "gemini"),
+ ("https://openrouter.ai/api/v1", "openrouter"),
+ ("https://api.together.xyz/v1", "together"),
+ ("https://api.mistral.ai/v1", "mistral"),
+ ("https://api.fireworks.ai/inference/v1", "fireworks"),
+ ("https://api.x.ai/v1", "xai"),
+ ("https://api.perplexity.ai", "perplexity"),
+ ("https://api.cerebras.ai/v1", "cerebras"),
+ ("https://integrate.api.nvidia.com/v1", "nvidia"),
+ ];
+ for (url, id) in table {
+ if u == *url {
+ return (*id).into();
+ }
+ }
+ if u.contains("openai.com") {
+ return "openai".into();
+ }
+ if u.is_empty() {
+ return default_api_provider();
+ }
+ "custom".into()
+}
fn default_extract_images() -> bool {
true
}
@@ -88,6 +133,7 @@ impl Default for AppConfig {
local_base_url: default_local_base_url(),
api_type: default_api_type(),
api_base_url: default_api_base_url(),
+ api_provider: default_api_provider(),
api_key: String::new(),
cleanup_model: String::new(),
cleanup_seen: false,
@@ -114,7 +160,13 @@ fn config_path(app: &AppHandle) -> PathBuf {
pub fn load(app: &AppHandle) -> AppConfig {
let path = config_path(app);
match std::fs::read_to_string(&path) {
- Ok(content) => serde_json::from_str(&content).unwrap_or_default(),
+ Ok(content) => {
+ let mut cfg: AppConfig = serde_json::from_str(&content).unwrap_or_default();
+ if cfg.api_provider.trim().is_empty() {
+ cfg.api_provider = infer_api_provider(&cfg);
+ }
+ cfg
+ }
Err(_) => AppConfig::default(),
}
}
diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rs
index 29bf99f..feeb07b 100644
--- a/app/src-tauri/src/lib.rs
+++ b/app/src-tauri/src/lib.rs
@@ -213,7 +213,7 @@ pub(crate) fn hide_console(_cmd: &mut std::process::Command) {}
/// Core formats always supported (provisioned at Stage 0).
const CORE_EXTS: &[&str] = &[
- "pdf", "docx", "pptx", "xlsx", "xls", "html", "htm", "csv", "json", "xml", "epub",
+ "pdf", "docx", "pptx", "xlsx", "xls", "html", "htm", "csv", "json", "xml", "epub", "txt", "md",
];
/// Formats requiring the OCR engine.
const OCR_EXTS: &[&str] = &["jpg", "jpeg", "png", "gif", "webp", "tiff", "tif", "bmp"];
@@ -532,7 +532,7 @@ async fn pick_file(app: AppHandle) -> Result<Option<String>, String> {
"Supported files",
&[
"pdf", "docx", "pptx", "xlsx", "xls", "html", "htm", "csv", "json", "xml",
- "epub",
+ "epub", "txt", "md",
"jpg", "jpeg", "png", "gif", "webp", "tiff", "tif", "bmp",
"mp3", "wav", "m4a", "ogg", "flac", "aac",
],
diff --git a/app/src-tauri/tauri.conf.json b/app/src-tauri/tauri.conf.json
index 9d9a835..c0bd8fb 100644
--- a/app/src-tauri/tauri.conf.json
+++ b/app/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "MDFlux",
- "version": "0.1.0",
+ "version": "0.2.0",
"identifier": "com.projektvisyo.mdflux",
"build": {
"beforeDevCommand": "npm run dev",
diff --git a/app/src/lib/DiagnosticsView.svelte b/app/src/lib/DiagnosticsView.svelte
index d569a21..2433d88 100644
--- a/app/src/lib/DiagnosticsView.svelte
+++ b/app/src/lib/DiagnosticsView.svelte
@@ -3,6 +3,13 @@
import { invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';
import { buildOutputFilename, type NamingCase } from './naming';
+ import {
+ API_PROVIDERS,
+ detectProviderFromKey,
+ inferProviderId,
+ providerById,
+ providerLabel,
+ } from './providers';
// ── Types ──────────────────────────────────────────────────────────────────
@@ -57,6 +64,7 @@
local_base_url: string;
api_type: string;
api_base_url: string;
+ api_provider?: string;
api_key: string;
cleanup_model: string;
cleanup_seen: boolean;
@@ -101,7 +109,11 @@
let localBaseUrl = $state(untrack(() => config.local_base_url));
let apiType = $state(untrack(() => config.api_type));
let apiBaseUrl = $state(untrack(() => config.api_base_url));
+ let apiProvider = $state(untrack(() =>
+ config.api_provider || inferProviderId(config.api_type, config.api_base_url),
+ ));
let apiKey = $state(untrack(() => config.api_key));
+ let keyHint = $state<string | null>(null);
let cleanupModel = $state(untrack(() => config.cleanup_model));
let conversionModel = $state(untrack(() => config.conversion_model ?? ''));
@@ -156,7 +168,10 @@
}).then(fn => { if (dead) fn(); else unlistenInstall = fn; });
});
- onDestroy(() => { unlistenInstall?.(); });
+ onDestroy(() => {
+ unlistenInstall?.();
+ void persistApiFields();
+ });
// ── Capabilities ───────────────────────────────────────────────────────────
@@ -185,10 +200,43 @@
await onConfigChange({ ...config, llm_mode: m });
}
- async function saveApiType(type: string) {
- apiType = type;
+ async function persistApiFields() {
+ await onConfigChange({
+ ...config,
+ api_provider: apiProvider,
+ api_type: apiType,
+ api_base_url: apiBaseUrl,
+ api_key: apiKey,
+ });
+ }
+
+ async function saveProvider(id: string) {
+ const p = providerById(id);
+ apiProvider = p.id;
+ apiType = p.apiType;
+ if (p.id !== 'custom') apiBaseUrl = p.baseUrl;
+ else if (!apiBaseUrl.trim()) apiBaseUrl = 'https://api.openai.com/v1';
providerResult = null;
- await onConfigChange({ ...config, api_type: type });
+ keyHint = null;
+ cleanupModel = '';
+ await onConfigChange({
+ ...config,
+ api_provider: apiProvider,
+ api_type: apiType,
+ api_base_url: apiBaseUrl,
+ api_key: apiKey,
+ cleanup_model: '',
+ });
+ }
+
+ async function applyKeyAndMaybeDetect() {
+ const detected = detectProviderFromKey(apiKey);
+ if (detected && detected !== apiProvider) {
+ keyHint = `This key looks like ${providerLabel(detected)} - switched provider.`;
+ await saveProvider(detected);
+ return;
+ }
+ await persistApiFields();
}
async function saveCleanupModel(m: string) {
@@ -271,12 +319,13 @@
key: '',
});
} else if (config.llm_mode === 'api') {
- await onConfigChange({
- ...config,
- api_type: apiType,
- api_base_url: apiBaseUrl,
- api_key: apiKey,
- });
+ const detected = detectProviderFromKey(apiKey);
+ if (detected && detected !== apiProvider) {
+ keyHint = `This key looks like ${providerLabel(detected)} - switched provider.`;
+ await saveProvider(detected);
+ } else {
+ await persistApiFields();
+ }
providerResult = await invoke<ProviderCheckResult>('check_provider', {
provider: apiType === 'anthropic' ? 'api_anthropic' : 'api_openai_compat',
baseUrl: apiBaseUrl,
@@ -609,25 +658,31 @@
{:else}
<div class="provider-fields">
- <label class="field-label" for="api-type">Type</label>
- <select id="api-type" class="field-select" value={apiType} onchange={(e) => saveApiType((e.target as HTMLSelectElement).value)}>
- <option value="openai_compat">OpenAI-compatible</option>
- <option value="anthropic">Anthropic</option>
+ <label class="field-label" for="api-provider">Provider</label>
+ <select
+ id="api-provider"
+ class="field-select"
+ value={apiProvider}
+ onchange={(e) => saveProvider((e.target as HTMLSelectElement).value)}
+ >
+ {#each API_PROVIDERS as p}
+ <option value={p.id}>{p.label}</option>
+ {/each}
</select>
+ <p class="field-hint">{providerById(apiProvider).hint}</p>
- {#if apiType === 'openai_compat'}
+ {#if apiProvider === 'custom'}
<label class="field-label" for="api-url">Base URL</label>
<input
id="api-url"
class="field-input"
bind:value={apiBaseUrl}
- placeholder="https://api.openai.com/v1"
+ placeholder="https://api.example.com/v1"
spellcheck="false"
autocomplete="off"
+ onblur={persistApiFields}
/>
- <p class="field-hint">Works with OpenAI, Groq, Together, Mistral, Fireworks, and any OpenAI-compatible API</p>
- {:else}
- <p class="field-hint">Connects to api.anthropic.com — keys begin with sk-ant-</p>
+ <p class="field-hint">Any OpenAI-compatible /v1 endpoint</p>
{/if}
<label class="field-label" for="api-key">API Key</label>
@@ -639,12 +694,18 @@
bind:value={apiKey}
placeholder="Paste your key here"
autocomplete="off"
+ onblur={applyKeyAndMaybeDetect}
/>
- <button class="check-btn" title="Test the API key and list available models" onclick={runProviderCheck} disabled={providerChecking}>
+ <button class="check-btn" title="Test the API key and list available models" onclick={runProviderCheck} disabled={providerChecking || !apiKey.trim()}>
{providerChecking ? 'Testing…' : 'Test'}
</button>
</div>
- <p class="field-hint">Key stored in your app data folder and sent only to the endpoint above</p>
+ {#if keyHint}
+ <p class="field-hint rec-hint">{keyHint}</p>
+ {/if}
+ <p class="field-hint">
+ Key is stored on this machine and sent only to {apiProvider === 'anthropic' ? 'api.anthropic.com' : (apiBaseUrl || 'the selected provider')}.
+ </p>
{#if providerResult}
<div class="provider-result" class:result-ok={providerResult.usable} class:result-fail={!providerResult.usable}>
diff --git a/app/src/lib/DropZone.svelte b/app/src/lib/DropZone.svelte
index 2a991db..a18e110 100644
--- a/app/src/lib/DropZone.svelte
+++ b/app/src/lib/DropZone.svelte
@@ -4,7 +4,7 @@
import { open } from '@tauri-apps/plugin-dialog';
import type { ConvertError } from './ErrorCard.svelte';
import ErrorCard from './ErrorCard.svelte';
- import { SUPPORTED_EXTS } from './formats';
+ import { SUPPORTED_EXTS, extFromPath, formatLabel } from './formats';
let {
onAdd,
@@ -23,6 +23,32 @@
type LocalState = 'idle' | 'drag-hover';
let localState = $state<LocalState>('idle');
let dropState = $derived(error ? 'error' : localState);
+ let hoverLabels = $state<string[]>([]);
+ const hoverTitle = $derived(
+ hoverLabels.length === 0
+ ? 'Drop files or a folder'
+ : hoverLabels.length === 1
+ ? `Drop ${hoverLabels[0]}`
+ : `Drop ${hoverLabels.length} files · ${hoverLabels.join(' · ')}`,
+ );
+
+ function labelsFromPaths(paths: string[]): string[] {
+ const seen = new Set<string>();
+ const out: string[] = [];
+ for (const p of paths) {
+ const label = formatLabel(extFromPath(p));
+ if (seen.has(label)) continue;
+ seen.add(label);
+ out.push(label);
+ }
+ return out;
+ }
+
+ function pathsFromPayload(payload: unknown): string[] {
+ if (!payload || typeof payload !== 'object') return [];
+ const paths = (payload as { paths?: unknown }).paths;
+ return Array.isArray(paths) ? paths.filter((p): p is string => typeof p === 'string') : [];
+ }
onMount(() => {
let unlistenDrop: (() => void) | undefined;
@@ -30,18 +56,21 @@
let unlistenLeave: (() => void) | undefined;
let dead = false;
- listen<{ paths: string[] }>('tauri://drag-drop', (e) => {
+ listen<{ paths?: string[] }>('tauri://drag-drop', (e) => {
localState = 'idle';
- const paths = e.payload.paths ?? [];
+ hoverLabels = [];
+ const paths = pathsFromPayload(e.payload);
if (paths.length) onAdd(paths);
}).then(fn => { if (dead) fn(); else unlistenDrop = fn; });
- listen('tauri://drag-enter', () => {
+ listen<unknown>('tauri://drag-enter', (e) => {
localState = 'drag-hover';
+ hoverLabels = labelsFromPaths(pathsFromPayload(e.payload));
}).then(fn => { if (dead) fn(); else unlistenEnter = fn; });
listen('tauri://drag-leave', () => {
if (localState === 'drag-hover') localState = 'idle';
+ hoverLabels = [];
}).then(fn => { if (dead) fn(); else unlistenLeave = fn; });
return () => {
@@ -98,9 +127,9 @@
<path d="M5 28h12" stroke="currentColor" stroke-width="2" stroke-linecap="round" opacity=".25"/>
</svg>
</div>
- <p class="label">Drop files or a folder</p>
+ <p class="label">{dropState === 'drag-hover' ? hoverTitle : 'Drop files or a folder'}</p>
<p class="hint">or <span class="link">browse to choose</span></p>
- <p class="formats">PDF · DOCX · PPTX · XLSX · EPUB · HTML · CSV · JSON · images · audio</p>
+ <p class="formats">PDF · DOCX · PPTX · XLSX · EPUB · HTML · CSV · JSON · XML · TXT · MD · images · audio</p>
</div>
{/if}
</div>
diff --git a/app/src/lib/GitHubDiff.svelte b/app/src/lib/GitHubDiff.svelte
new file mode 100644
index 0000000..395f157
--- /dev/null
+++ b/app/src/lib/GitHubDiff.svelte
@@ -0,0 +1,273 @@
+<script lang="ts">
+ import { githubBlocks } from './diff';
+ import type { DiffResult, DiffRow } from './diff';
+
+ let {
+ diff,
+ filename,
+ }: {
+ diff: DiffResult;
+ filename: string;
+ } = $props();
+
+ let opened = $state<Record<string, boolean>>({});
+ const blocks = $derived(diff.kind === 'full' ? githubBlocks(diff.rows) : []);
+ const hasExpand = $derived(blocks.some(b => b.kind === 'expand'));
+
+ function toggle(id: string) {
+ opened = { ...opened, [id]: !opened[id] };
+ }
+ function expandAll() {
+ const next: Record<string, boolean> = {};
+ for (const b of blocks) {
+ if (b.kind === 'expand') next[b.id] = true;
+ }
+ opened = next;
+ }
+
+ const statBlocks = $derived.by(() => {
+ const add = diff.added;
+ const del = diff.removed;
+ const total = add + del;
+ if (total === 0) return { green: 0, red: 0, empty: 5 };
+ const green = Math.round((add / total) * 5);
+ const red = Math.min(5 - green, Math.round((del / total) * 5) || (del > 0 ? 1 : 0));
+ const g = Math.min(5, Math.max(add > 0 ? 1 : 0, green));
+ const r = Math.min(5 - g, Math.max(del > 0 ? 1 : 0, red));
+ return { green: g, red: r, empty: 5 - g - r };
+ });
+
+ const barKinds = $derived([
+ ...Array.from({ length: statBlocks.green }, () => 'add' as const),
+ ...Array.from({ length: statBlocks.red }, () => 'del' as const),
+ ...Array.from({ length: statBlocks.empty }, () => 'empty' as const),
+ ]);
+
+ function marker(type: DiffRow['type']): string {
+ if (type === 'add') return '+';
+ if (type === 'del') return '-';
+ return ' ';
+ }
+</script>
+
+{#if diff.kind === 'summary'}
+ <div class="gh-file">
+ <div class="file-header">
+ <span class="file-path">{filename}</span>
+ <span class="diffstat">
+ <span class="stat-add">+{diff.added.toLocaleString()}</span>
+ <span class="stat-del">-{diff.removed.toLocaleString()}</span>
+ </span>
+ </div>
+ <div class="summary">
+ <p>{diff.note}</p>
+ </div>
+ </div>
+{:else}
+ <div class="gh-file">
+ <div class="file-header">
+ <div class="file-info">
+ <svg class="file-icon" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
+ <path fill="currentColor" d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062L11.5 4.25h2.062Z"/>
+ </svg>
+ <span class="file-path">{filename}</span>
+ </div>
+ <div class="file-actions">
+ {#if hasExpand}
+ <button class="expand-all" type="button" onclick={expandAll} title="Show every unchanged line">Expand all</button>
+ {/if}
+ <span class="diffstat" title="{diff.added} additions and {diff.removed} deletions">
+ <span class="stat-add">+{diff.added.toLocaleString()}</span>
+ <span class="stat-del">-{diff.removed.toLocaleString()}</span>
+ <span class="stat-bars" aria-hidden="true">
+ {#each barKinds as kind, i (i)}
+ <span class="bar bar-{kind}"></span>
+ {/each}
+ </span>
+ </span>
+ </div>
+ </div>
+
+ <div class="blob-wrapper">
+ <table class="diff-table">
+ <tbody>
+ {#each blocks as block}
+ {#if block.kind === 'hunk'}
+ <tr class="blob-hunk">
+ <td class="blob-num blob-num-hunk"></td>
+ <td class="blob-num blob-num-hunk"></td>
+ <td class="blob-code blob-code-hunk">{block.header}</td>
+ </tr>
+ {:else if block.kind === 'expand'}
+ {#if opened[block.id]}
+ {#each block.rows as row}
+ {@render codeRow(row)}
+ {/each}
+ {:else}
+ <tr class="blob-hunk blob-expand">
+ <td class="blob-num blob-num-hunk" colspan="2">
+ <button class="hunk-btn" type="button" title="Show {block.rows.length} unchanged lines" onclick={() => toggle(block.id)} aria-label="Expand unchanged lines">
+ <svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8.177.677l2.896 2.896a.25.25 0 0 1-.177.427H8.75v1.25a.75.75 0 0 1-1.5 0V4H5.104a.25.25 0 0 1-.177-.427L7.823.677a.25.25 0 0 1 .354 0ZM7.25 10.75a.75.75 0 0 1 1.5 0V12h2.146a.25.25 0 0 1 .177.427l-2.896 2.896a.25.25 0 0 1-.354 0l-2.896-2.896A.25.25 0 0 1 5.104 12H7.25v-1.25Zm-5-2a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5zM4 8.75a.75.75 0 0 1 0-1.5h.5a.75.75 0 0 1 0 1.5zm3-2.75h.5a.75.75 0 0 0 0-1.5H7a.75.75 0 0 0 0 1.5zM8.75 8a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 8.75 8zM12 7.25a.75.75 0 0 0 0 1.5h.5a.75.75 0 0 0 0-1.5zM13.25 8a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75z"/></svg>
+ </button>
+ </td>
+ <td class="blob-code blob-code-hunk">
+ <button class="hunk-code" type="button" onclick={() => toggle(block.id)}>{block.header}</button>
+ </td>
+ </tr>
+ {/if}
+ {:else}
+ {#each block.rows as row}
+ {@render codeRow(row)}
+ {/each}
+ {/if}
+ {/each}
+ </tbody>
+ </table>
+ </div>
+ </div>
+{/if}
+
+{#snippet codeRow(row: DiffRow)}
+ <tr class="blob-row blob-{row.type}">
+ <td class="blob-num blob-num-{row.type}">{row.oldNo ?? ''}</td>
+ <td class="blob-num blob-num-{row.type}">{row.newNo ?? ''}</td>
+ <td class="blob-code blob-code-{row.type}">
+ <span class="blob-code-inner"
+ ><span class="blob-code-marker">{marker(row.type)}</span>{#if row.parts}{#each row.parts as part}<span class:x={part.changed}>{part.text}</span>{/each}{:else}{row.text}{/if}</span
+ >
+ </td>
+ </tr>
+{/snippet}
+
+<style>
+ /* GitHub Primer dark unified-diff. Hardcoded so this tab matches github.com, not the app chrome. */
+ .gh-file {
+ display: flex;
+ flex-direction: column;
+ min-height: 100%;
+ background: #0d1117;
+ color: #e6edf3;
+ font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
+ font-size: 12px;
+ line-height: 20px;
+ }
+
+ .file-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ padding: 8px 16px;
+ background: #161b22;
+ border-bottom: 1px solid #30363d;
+ flex-shrink: 0;
+ position: sticky;
+ top: 0;
+ z-index: 2;
+ }
+ .file-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
+ .file-icon { color: #8b949e; flex-shrink: 0; }
+ .file-path {
+ color: #e6edf3;
+ font-weight: 600;
+ font-size: 12px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .file-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
+ .expand-all {
+ background: none; border: none; padding: 0;
+ color: #58a6ff; font-size: 12px; font-family: inherit; cursor: pointer;
+ }
+ .expand-all:hover { text-decoration: underline; }
+ .diffstat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
+ .stat-add { color: #3fb950; }
+ .stat-del { color: #f85149; }
+ .stat-bars { display: inline-flex; gap: 1px; }
+ .bar { width: 8px; height: 8px; border-radius: 1px; }
+ .bar-add { background: #3fb950; }
+ .bar-del { background: #f85149; }
+ .bar-empty { background: #30363d; }
+
+ .summary { padding: 16px; color: #8b949e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 14px; }
+ .summary p { margin: 0; }
+
+ .blob-wrapper { overflow: auto; flex: 1; min-height: 0; }
+ .diff-table {
+ width: 100%;
+ border-collapse: collapse;
+ table-layout: auto;
+ }
+
+ .blob-num {
+ width: 1%;
+ min-width: 50px;
+ padding: 0 10px;
+ color: #6e7681;
+ text-align: right;
+ vertical-align: top;
+ user-select: none;
+ white-space: nowrap;
+ border-right: 1px solid #30363d;
+ background: #0d1117;
+ }
+ .blob-code {
+ padding: 0 10px;
+ vertical-align: top;
+ white-space: pre;
+ tab-size: 4;
+ width: 100%;
+ }
+ .blob-code-inner { display: inline; }
+ .blob-code-marker {
+ display: inline-block;
+ width: 1ch;
+ margin-right: 8px;
+ user-select: none;
+ color: inherit;
+ }
+
+ .blob-same .blob-code { color: #e6edf3; }
+ .blob-add .blob-num,
+ .blob-code-add { background: #12261e; }
+ .blob-add .blob-num { color: #3fb950; }
+ .blob-code-add { color: #e6edf3; }
+ .blob-del .blob-num,
+ .blob-code-del { background: #3d1214; }
+ .blob-del .blob-num { color: #f85149; }
+ .blob-code-del { color: #e6edf3; }
+
+ .blob-code-add .x { background: rgba(46, 160, 67, 0.4); }
+ .blob-code-del .x { background: rgba(248, 81, 73, 0.4); }
+
+ .blob-hunk td { background: #111d2e; color: #8b949e; }
+ .blob-num-hunk {
+ background: #111d2e;
+ color: #4493f8;
+ border-right-color: #1e3a5f;
+ }
+ .blob-code-hunk {
+ background: #111d2e;
+ color: #8b949e;
+ white-space: pre;
+ font-weight: 400;
+ }
+
+ .hunk-btn, .hunk-code {
+ background: none; border: none; padding: 0;
+ color: inherit; font: inherit; cursor: pointer; width: 100%;
+ text-align: inherit;
+ }
+ .hunk-btn {
+ color: #4493f8;
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ }
+ .hunk-btn svg { display: block; }
+ .blob-expand:hover td { background: #1c2b45; }
+
+ .blob-row:hover .blob-num-same { background: #161b22; }
+ .blob-row:hover .blob-code-same { background: #161b22; }
+</style>
diff --git a/app/src/lib/ResultView.svelte b/app/src/lib/ResultView.svelte
index 7a2dd0c..3b41280 100644
--- a/app/src/lib/ResultView.svelte
+++ b/app/src/lib/ResultView.svelte
@@ -4,9 +4,10 @@
import type { CleanupResult, CleanupMethod, CleanupUIState, ViewMode } from './cleanup';
import { lineDiff } from './diff';
import type { DiffResult } from './diff';
+ import GitHubDiff from './GitHubDiff.svelte';
import { renderMarkdown } from './mdpreview';
import { buildOutputFilename, type NamingCase } from './naming';
- import { onDestroy } from 'svelte';
+ import { onDestroy, onMount } from 'svelte';
let {
markdown,
@@ -94,6 +95,13 @@
Object.fromEntries((cleanup.rulesSummary?.rules ?? []).map(r => [r.key, r.changes])),
);
+ const isEmpty = $derived(!markdown.trim());
+ const bannerText = $derived(
+ isEmpty
+ ? (warnings.find(w => w.toLowerCase().includes('no text')) ?? 'No text could be extracted from this file.')
+ : (warnings.length ? warnings.join(' ') : ''),
+ );
+
function setView(v: ViewMode) { cleanup.viewMode = v; }
// ── Cleanup method ─────────────────────────────────────────────────────────
@@ -173,6 +181,21 @@
onDestroy(() => clearTimeout(copyTimeout));
+ onMount(() => {
+ function onCopyKey(e: KeyboardEvent) {
+ if (!(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== 'c' || e.altKey) return;
+ if (confirming) return;
+ const t = e.target as HTMLElement | null;
+ if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ const sel = window.getSelection()?.toString() ?? '';
+ if (sel) return;
+ e.preventDefault();
+ copyMarkdown();
+ }
+ window.addEventListener('keydown', onCopyKey);
+ return () => window.removeEventListener('keydown', onCopyKey);
+ });
+
async function copyMarkdown() {
try {
await navigator.clipboard.writeText(activeMarkdown);
@@ -342,6 +365,10 @@
{/if}
</div>
+ {#if bannerText}
+ <div class="result-banner" class:result-banner-empty={isEmpty} role="status">{bannerText}</div>
+ {/if}
+
<!-- Content -->
{#if cleanup.viewMode === 'split' && hasChanges}
<div class="split">
@@ -361,23 +388,15 @@
</div>
</div>
{:else}
- <div class="scroll-area" tabindex="0" role="region" aria-label="Markdown result">
+ <div
+ class="scroll-area"
+ class:diff-bleed={cleanup.viewMode === 'changes' && !!diff}
+ tabindex="0"
+ role="region"
+ aria-label="Markdown result"
+ >
{#if cleanup.viewMode === 'changes' && diff}
- {#if diff.kind === 'summary'}
- <div class="diff-summary">
- <p>{diff.note}</p>
- <p class="diff-counts"><span class="add-count">+{diff.added.toLocaleString()}</span> <span class="del-count">−{diff.removed.toLocaleString()}</span> lines</p>
- </div>
- {:else}
- <div class="diff-view">
- {#each diff.rows as row}
- <div class="diff-row diff-{row.type}">
- <span class="diff-gutter" aria-hidden="true">{row.type === 'add' ? '+' : row.type === 'del' ? '−' : ''}</span>
- <span class="diff-text">{row.text || ' '}</span>
- </div>
- {/each}
- </div>
- {/if}
+ <GitHubDiff {diff} filename="{sourceStem}.md" />
{:else if cleanup.viewMode === 'preview'}
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
<div class="preview" onclick={onPreviewClick}>{@html previewHtml}</div>
@@ -397,7 +416,7 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M3 1.5h5L11 4.5V12a.5.5 0 0 1-.5.5h-7A.5.5 0 0 1 3 12V1.5z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><path d="M7 6.2v3.6M5.2 8h3.6" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>
Open a New File
</button>
- <button class="btn-secondary" title="Copy the current Markdown to the clipboard" onclick={copyMarkdown}>
+ <button class="btn-secondary" title="Copy the current Markdown to the clipboard (Ctrl+C)" onclick={copyMarkdown}>
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><rect x="4.5" y="4.5" width="7.5" height="7.5" rx="1.3" stroke="currentColor" stroke-width="1.2"/><path d="M9.5 4.5V3a1 1 0 0 0-1-1h-5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1H4.5" stroke="currentColor" stroke-width="1.2"/></svg>
{copyLabel}
</button>
@@ -519,8 +538,20 @@
/* Content */
.scroll-area { flex: 1; overflow-y: auto; padding: var(--sp-5) var(--sp-6); min-height: 0; outline: none; }
+ .scroll-area.diff-bleed { padding: 0; overflow: auto; }
.scroll-area:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -2px; }
+ .result-banner {
+ flex-shrink: 0;
+ padding: 8px var(--sp-4);
+ font-size: 12px;
+ line-height: 1.45;
+ color: var(--amber);
+ background: color-mix(in srgb, var(--amber) 12%, transparent);
+ border-bottom: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
+ }
+ .result-banner-empty { color: var(--text-secondary); }
+
/* Split view — before vs after cleanup, rendered side by side, scroll-synced. */
.split { flex: 1; display: flex; min-height: 0; }
.split-col { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
@@ -564,21 +595,6 @@
.preview :global(th) { background: var(--surface-2); font-weight: 600; }
.preview :global(img) { max-width: 100%; }
- /* Diff */
- .diff-view { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; user-select: text; }
- .diff-row { display: flex; gap: var(--sp-2); white-space: pre-wrap; word-break: break-word; padding: 0 var(--sp-1); }
- .diff-gutter { flex-shrink: 0; width: 10px; text-align: center; color: var(--text-muted); user-select: none; }
- .diff-text { flex: 1; min-width: 0; }
- .diff-same { color: var(--text-secondary); }
- .diff-add { background: color-mix(in srgb, var(--green) 12%, transparent); }
- .diff-add .diff-text, .diff-add .diff-gutter { color: var(--green); }
- .diff-del { background: color-mix(in srgb, var(--red) 12%, transparent); }
- .diff-del .diff-text, .diff-del .diff-gutter { color: var(--red); }
- .diff-summary { font-size: 13px; color: var(--text-secondary); display: flex; flex-direction: column; gap: var(--sp-2); }
- .diff-counts { font-family: var(--font-mono); }
- .add-count { color: var(--green); }
- .del-count { color: var(--red); margin-left: var(--sp-2); }
-
/* Bottom bar */
.bottom-bar {
display: flex;
diff --git a/app/src/lib/SponsorMenu.svelte b/app/src/lib/SponsorMenu.svelte
new file mode 100644
index 0000000..ad70ce7
--- /dev/null
+++ b/app/src/lib/SponsorMenu.svelte
@@ -0,0 +1,125 @@
+<script lang="ts">
+ import { onMount } from 'svelte';
+ import { openUrl } from '@tauri-apps/plugin-opener';
+
+ const LINKS = [
+ { label: 'GitHub Sponsors', href: 'https://github.com/sponsors/ibrahimqureshae' },
+ { label: 'Buy Me a Coffee', href: 'https://www.buymeacoffee.com/mibrahim99' },
+ { label: 'PayPal', href: 'https://www.paypal.me/mibrahimqr' },
+ ] as const;
+
+ let open = $state(false);
+ let rootEl: HTMLDivElement | null = $state(null);
+
+ onMount(() => {
+ function onDocClick(e: MouseEvent) {
+ if (open && rootEl && !rootEl.contains(e.target as Node)) open = false;
+ }
+ function onKey(e: KeyboardEvent) {
+ if (e.key === 'Escape') open = false;
+ }
+ document.addEventListener('mousedown', onDocClick);
+ document.addEventListener('keydown', onKey);
+ return () => {
+ document.removeEventListener('mousedown', onDocClick);
+ document.removeEventListener('keydown', onKey);
+ };
+ });
+
+ async function go(href: string) {
+ open = false;
+ try {
+ await openUrl(href);
+ } catch {
+ // opener plugin rejects unknown hosts; ignore so the menu still closes
+ }
+ }
+</script>
+
+<div class="sponsor" bind:this={rootEl}>
+ <button
+ class="sponsor-btn"
+ class:open
+ onclick={() => (open = !open)}
+ aria-haspopup="menu"
+ aria-expanded={open}
+ aria-label="Sponsor MDFlux"
+ title="Sponsor"
+ >
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" aria-hidden="true">
+ <path
+ d="M7.5 13S2 9.4 2 5.8C2 3.9 3.5 2.5 5.2 2.5c1.1 0 1.9.6 2.3 1.4.4-.8 1.2-1.4 2.3-1.4 1.7 0 3.2 1.4 3.2 3.3C13 9.4 7.5 13 7.5 13z"
+ stroke="currentColor"
+ stroke-width="1.2"
+ stroke-linejoin="round"
+ />
+ </svg>
+ </button>
+
+ {#if open}
+ <div class="menu" role="menu" aria-label="Sponsor links">
+ <p class="menu-title">Support MDFlux</p>
+ {#each LINKS as link}
+ <button class="menu-item" role="menuitem" onclick={() => go(link.href)}>
+ {link.label}
+ </button>
+ {/each}
+ </div>
+ {/if}
+</div>
+
+<style>
+ .sponsor { position: relative; }
+ .sponsor-btn {
+ background: var(--surface-2);
+ border: 1px solid var(--border-strong);
+ color: var(--text-secondary);
+ cursor: pointer;
+ width: 34px;
+ height: 34px;
+ border-radius: var(--radius-sm);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
+ }
+ .sponsor-btn:hover,
+ .sponsor-btn.open { color: var(--text-primary); background: var(--surface-3); border-color: #565660; }
+ .sponsor-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); }
+
+ .menu {
+ position: absolute;
+ top: calc(100% + 8px);
+ right: 0;
+ min-width: 200px;
+ background: var(--surface-1);
+ border: 1px solid var(--border-strong);
+ border-radius: var(--radius);
+ padding: var(--sp-2);
+ z-index: 40;
+ }
+ .menu-title {
+ font-size: 10px;
+ font-weight: 600;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--text-muted);
+ padding: 6px 10px 4px;
+ }
+ .menu-item {
+ display: block;
+ width: 100%;
+ text-align: left;
+ background: none;
+ border: none;
+ color: var(--text-primary);
+ font-family: var(--font-ui);
+ font-size: 13px;
+ font-weight: 500;
+ padding: 8px 10px;
+ border-radius: var(--radius-sm);
+ cursor: pointer;
+ }
+ .menu-item:hover { background: var(--surface-2); }
+ .menu-item:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); }
+</style>
diff --git a/app/src/lib/diff.ts b/app/src/lib/diff.ts
index 309bc24..3d210c1 100644
--- a/app/src/lib/diff.ts
+++ b/app/src/lib/diff.ts
@@ -1,14 +1,30 @@
-// Stage 5 — lightweight line diff for the single-file before/after preview.
+// Stage 5 — line diff for the Changes tab.
// Dependency-free LCS. Guards against pathological sizes so a 500-page PDF stays
// responsive: above the cap it returns a cheap multiset summary instead of a full diff.
+// Numbered rows + hunks are shaped like GitHub's unified file diff.
-export type DiffRow = { type: 'same' | 'add' | 'del'; text: string };
+export type TextPart = { text: string; changed: boolean };
+
+export type DiffRow = {
+ type: 'same' | 'add' | 'del';
+ text: string;
+ oldNo: number | null;
+ newNo: number | null;
+ parts?: TextPart[];
+};
export type DiffResult =
| { kind: 'full'; rows: DiffRow[]; added: number; removed: number }
| { kind: 'summary'; added: number; removed: number; note: string };
+export type GitHubBlock =
+ | { kind: 'hunk'; header: string }
+ | { kind: 'expand'; id: string; header: string; rows: DiffRow[] }
+ | { kind: 'lines'; rows: DiffRow[] };
+
const DEFAULT_CAP = 2000;
+const CONTEXT = 3;
+const WORD_CAP = 400;
export function lineDiff(a: string, b: string, cap = DEFAULT_CAP): DiffResult {
const aLines = a.split('\n');
@@ -21,7 +37,6 @@ export function lineDiff(a: string, b: string, cap = DEFAULT_CAP): DiffResult {
const n = aLines.length;
const m = bLines.length;
- // LCS length table.
const dp: Uint32Array[] = Array.from({ length: n + 1 }, () => new Uint32Array(m + 1));
for (let i = n - 1; i >= 0; i--) {
const row = dp[i];
@@ -33,31 +48,173 @@ export function lineDiff(a: string, b: string, cap = DEFAULT_CAP): DiffResult {
}
}
- // Backtrack into rows.
const rows: DiffRow[] = [];
let added = 0;
let removed = 0;
let i = 0;
let j = 0;
+ let oldNo = 0;
+ let newNo = 0;
while (i < n && j < m) {
if (aLines[i] === bLines[j]) {
- rows.push({ type: 'same', text: aLines[i] });
+ oldNo++; newNo++;
+ rows.push({ type: 'same', text: aLines[i], oldNo, newNo });
i++; j++;
} else if (dp[i + 1][j] >= dp[i][j + 1]) {
- rows.push({ type: 'del', text: aLines[i] });
+ oldNo++;
+ rows.push({ type: 'del', text: aLines[i], oldNo, newNo: null });
removed++; i++;
} else {
- rows.push({ type: 'add', text: bLines[j] });
+ newNo++;
+ rows.push({ type: 'add', text: bLines[j], oldNo: null, newNo });
added++; j++;
}
}
- while (i < n) { rows.push({ type: 'del', text: aLines[i] }); removed++; i++; }
- while (j < m) { rows.push({ type: 'add', text: bLines[j] }); added++; j++; }
+ while (i < n) {
+ oldNo++;
+ rows.push({ type: 'del', text: aLines[i], oldNo, newNo: null });
+ removed++; i++;
+ }
+ while (j < m) {
+ newNo++;
+ rows.push({ type: 'add', text: bLines[j], oldNo: null, newNo });
+ added++; j++;
+ }
+
+ return { kind: 'full', rows: attachIntraLine(rows), added, removed };
+}
+
+/** Collapse long unchanged runs the way GitHub's file diff does, with @@ hunk headers. */
+export function githubBlocks(rows: DiffRow[]): GitHubBlock[] {
+ if (rows.length === 0) return [];
+ const changeIdx: number[] = [];
+ for (let i = 0; i < rows.length; i++) {
+ if (rows[i].type !== 'same') changeIdx.push(i);
+ }
+ if (changeIdx.length === 0) {
+ return [{ kind: 'lines', rows }];
+ }
+
+ const ranges: [number, number][] = [];
+ for (const idx of changeIdx) {
+ const start = Math.max(0, idx - CONTEXT);
+ const end = Math.min(rows.length, idx + 1 + CONTEXT);
+ const last = ranges[ranges.length - 1];
+ if (last && start <= last[1]) last[1] = Math.max(last[1], end);
+ else ranges.push([start, end]);
+ }
+
+ const blocks: GitHubBlock[] = [];
+ let cursor = 0;
+ let n = 0;
+ for (const [start, end] of ranges) {
+ const vis = rows.slice(start, end);
+ const header = hunkHeader(vis);
+ if (cursor < start) {
+ blocks.push({
+ kind: 'expand',
+ id: `e${n++}`,
+ header,
+ rows: rows.slice(cursor, start),
+ });
+ } else {
+ blocks.push({ kind: 'hunk', header });
+ }
+ blocks.push({ kind: 'lines', rows: vis });
+ cursor = end;
+ }
+ if (cursor < rows.length) {
+ const skipped = rows.slice(cursor);
+ blocks.push({
+ kind: 'expand',
+ id: `e${n++}`,
+ header: hunkHeader(skipped),
+ rows: skipped,
+ });
+ }
+ return blocks;
+}
+
+function hunkHeader(slice: DiffRow[]): string {
+ const oldStart = slice.find(r => r.oldNo != null)?.oldNo ?? 1;
+ const newStart = slice.find(r => r.newNo != null)?.newNo ?? 1;
+ const oldLen = slice.filter(r => r.type !== 'add').length;
+ const newLen = slice.filter(r => r.type !== 'del').length;
+ return `@@ -${oldStart},${oldLen} +${newStart},${newLen} @@`;
+}
+
+function attachIntraLine(rows: DiffRow[]): DiffRow[] {
+ const out = rows.slice();
+ let i = 0;
+ while (i < out.length) {
+ if (out[i].type !== 'del') { i++; continue; }
+ let j = i;
+ while (j < out.length && out[j].type === 'del') j++;
+ let k = j;
+ while (k < out.length && out[k].type === 'add') k++;
+ const n = Math.min(j - i, k - j);
+ for (let t = 0; t < n; t++) {
+ const w = wordParts(out[i + t].text, out[j + t].text);
+ out[i + t] = { ...out[i + t], parts: w.del };
+ out[j + t] = { ...out[j + t], parts: w.add };
+ }
+ i = k;
+ }
+ return out;
+}
- return { kind: 'full', rows, added, removed };
+function wordParts(a: string, b: string): { del: TextPart[]; add: TextPart[] } {
+ const split = (s: string) => s.split(/(\s+)/).filter(t => t.length > 0);
+ const aw = split(a);
+ const bw = split(b);
+ if (aw.length > WORD_CAP || bw.length > WORD_CAP) {
+ return {
+ del: [{ text: a, changed: true }],
+ add: [{ text: b, changed: true }],
+ };
+ }
+ const n = aw.length;
+ const m = bw.length;
+ const dp: Uint16Array[] = Array.from({ length: n + 1 }, () => new Uint16Array(m + 1));
+ for (let i = n - 1; i >= 0; i--) {
+ const row = dp[i];
+ const next = dp[i + 1];
+ for (let j = m - 1; j >= 0; j--) {
+ row[j] = aw[i] === bw[j] ? next[j + 1] + 1 : Math.max(next[j], row[j + 1]);
+ }
+ }
+ const del: TextPart[] = [];
+ const add: TextPart[] = [];
+ let i = 0;
+ let j = 0;
+ while (i < n && j < m) {
+ if (aw[i] === bw[j]) {
+ del.push({ text: aw[i], changed: false });
+ add.push({ text: bw[j], changed: false });
+ i++; j++;
+ } else if (dp[i + 1][j] >= dp[i][j + 1]) {
+ del.push({ text: aw[i], changed: true });
+ i++;
+ } else {
+ add.push({ text: bw[j], changed: true });
+ j++;
+ }
+ }
+ while (i < n) { del.push({ text: aw[i], changed: true }); i++; }
+ while (j < m) { add.push({ text: bw[j], changed: true }); j++; }
+ return { del: mergeParts(del), add: mergeParts(add) };
+}
+
+function mergeParts(parts: TextPart[]): TextPart[] {
+ const out: TextPart[] = [];
+ for (const p of parts) {
+ const last = out[out.length - 1];
+ if (last && last.changed === p.changed) last.text += p.text;
+ else out.push({ ...p });
+ }
+ return out;
}
-// Cheap approximation for very large inputs — multiset difference of lines.
function summaryDiff(aLines: string[], bLines: string[]): DiffResult {
const count = (lines: string[]) => {
const map = new Map<string, number>();
diff --git a/app/src/lib/formats.ts b/app/src/lib/formats.ts
index fbc12e7..8deb699 100644
--- a/app/src/lib/formats.ts
+++ b/app/src/lib/formats.ts
@@ -4,7 +4,7 @@
/** Core document formats — always available (provisioned at Stage 0). */
export const CORE_EXTS = [
- 'pdf', 'docx', 'pptx', 'xlsx', 'xls', 'html', 'htm', 'csv', 'json', 'xml', 'epub',
+ 'pdf', 'docx', 'pptx', 'xlsx', 'xls', 'html', 'htm', 'csv', 'json', 'xml', 'epub', 'txt', 'md',
];
/** Image formats — converted via the optional OCR engine. */
@@ -26,3 +26,25 @@ export function isAudioExt(ext: string): boolean {
export function isHeavyExt(ext: string): boolean {
return isImageExt(ext) || isAudioExt(ext);
}
+
+/** File extension without the leading dot, lowercased. Empty if none. */
+export function extFromPath(path: string): string {
+ const base = path.split(/[\\/]/).pop() ?? '';
+ const i = base.lastIndexOf('.');
+ if (i <= 0 || i === base.length - 1) return '';
+ return base.slice(i + 1).toLowerCase();
+}
+
+/** Short drop-zone / badge label for an extension. */
+export function formatLabel(ext: string): string {
+ const e = ext.replace(/^\./, '').toLowerCase();
+ if (!e) return 'Unknown';
+ if (isImageExt(e)) return 'Image';
+ if (isAudioExt(e)) return 'Audio';
+ const labels: Record<string, string> = {
+ pdf: 'PDF', docx: 'Word', pptx: 'PowerPoint', xlsx: 'Excel', xls: 'Excel',
+ html: 'HTML', htm: 'HTML', csv: 'CSV', json: 'JSON', xml: 'XML',
+ epub: 'EPUB', txt: 'Text', md: 'Markdown',
+ };
+ return labels[e] ?? e.toUpperCase();
+}
diff --git a/app/src/lib/providers.ts b/app/src/lib/providers.ts
new file mode 100644
index 0000000..c5bdfaa
--- /dev/null
+++ b/app/src/lib/providers.ts
@@ -0,0 +1,155 @@
+// Known API providers for AI cleanup. The dropdown writes api_type + api_base_url;
+// Custom is the only row that still shows a Base URL field.
+
+export type ApiKind = 'openai_compat' | 'anthropic';
+
+export interface ApiProvider {
+ id: string;
+ label: string;
+ apiType: ApiKind;
+ /** Empty for Anthropic (fixed host) and for Custom (user-supplied). */
+ baseUrl: string;
+ /** Extra URLs that should still map back to this preset. */
+ aliases?: string[];
+ hint: string;
+}
+
+export const API_PROVIDERS: ApiProvider[] = [
+ {
+ id: 'openai',
+ label: 'OpenAI',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.openai.com/v1',
+ hint: 'Keys start with sk- or sk-proj-',
+ },
+ {
+ id: 'deepseek',
+ label: 'DeepSeek',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.deepseek.com',
+ aliases: ['https://api.deepseek.com/v1'],
+ hint: 'Keys start with sk-. Use api.deepseek.com, not openai.com.',
+ },
+ {
+ id: 'groq',
+ label: 'Groq',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.groq.com/openai/v1',
+ hint: 'Keys start with gsk_',
+ },
+ {
+ id: 'anthropic',
+ label: 'Anthropic',
+ apiType: 'anthropic',
+ baseUrl: '',
+ hint: 'Keys start with sk-ant-',
+ },
+ {
+ id: 'gemini',
+ label: 'Google Gemini',
+ apiType: 'openai_compat',
+ baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai',
+ aliases: ['https://generativelanguage.googleapis.com/v1beta/openai/'],
+ hint: 'Google AI Studio keys start with AIza',
+ },
+ {
+ id: 'openrouter',
+ label: 'OpenRouter',
+ apiType: 'openai_compat',
+ baseUrl: 'https://openrouter.ai/api/v1',
+ hint: 'Keys start with sk-or-',
+ },
+ {
+ id: 'together',
+ label: 'Together AI',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.together.xyz/v1',
+ hint: 'OpenAI-compatible Together endpoint',
+ },
+ {
+ id: 'mistral',
+ label: 'Mistral',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.mistral.ai/v1',
+ hint: 'La Plateforme keys',
+ },
+ {
+ id: 'fireworks',
+ label: 'Fireworks',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.fireworks.ai/inference/v1',
+ hint: 'OpenAI-compatible Fireworks endpoint',
+ },
+ {
+ id: 'xai',
+ label: 'xAI (Grok)',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.x.ai/v1',
+ hint: 'Keys start with xai-',
+ },
+ {
+ id: 'perplexity',
+ label: 'Perplexity',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.perplexity.ai',
+ hint: 'Keys start with pplx-',
+ },
+ {
+ id: 'cerebras',
+ label: 'Cerebras',
+ apiType: 'openai_compat',
+ baseUrl: 'https://api.cerebras.ai/v1',
+ hint: 'OpenAI-compatible Cerebras endpoint',
+ },
+ {
+ id: 'nvidia',
+ label: 'NVIDIA NIM',
+ apiType: 'openai_compat',
+ baseUrl: 'https://integrate.api.nvidia.com/v1',
+ hint: 'build.nvidia.com API keys',
+ },
+ {
+ id: 'custom',
+ label: 'Custom (OpenAI-compatible)',
+ apiType: 'openai_compat',
+ baseUrl: '',
+ hint: 'Paste any OpenAI-compatible Base URL',
+ },
+];
+
+export function providerById(id: string | undefined | null): ApiProvider {
+ return API_PROVIDERS.find(p => p.id === id) ?? API_PROVIDERS[0];
+}
+
+function normUrl(url: string): string {
+ return (url || '').trim().replace(/\/+$/, '').toLowerCase();
+}
+
+export function inferProviderId(apiType: string, baseUrl: string): string {
+ if ((apiType || '') === 'anthropic') return 'anthropic';
+ const u = normUrl(baseUrl);
+ if (!u) return 'openai';
+ for (const p of API_PROVIDERS) {
+ if (p.id === 'custom' || p.id === 'anthropic') continue;
+ const candidates = [p.baseUrl, ...(p.aliases ?? [])].map(normUrl).filter(Boolean);
+ if (candidates.includes(u)) return p.id;
+ }
+ if (u.includes('openai.com')) return 'openai';
+ return 'custom';
+}
+
+/** Unambiguous key prefixes only. Never guess between OpenAI and DeepSeek (both sk-). */
+export function detectProviderFromKey(key: string): string | null {
+ const k = (key || '').trim();
+ if (k.startsWith('sk-ant-')) return 'anthropic';
+ if (k.startsWith('gsk_')) return 'groq';
+ if (k.startsWith('sk-or-')) return 'openrouter';
+ if (k.startsWith('AIza')) return 'gemini';
+ if (k.startsWith('xai-')) return 'xai';
+ if (k.startsWith('pplx-')) return 'perplexity';
+ return null;
+}
+
+export function providerLabel(id: string): string {
+ return providerById(id).label;
+}
diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte
index 2f29d6e..b62c7c6 100644
--- a/app/src/routes/+page.svelte
+++ b/app/src/routes/+page.svelte
@@ -7,6 +7,7 @@
import ConvertProgress from '$lib/ConvertProgress.svelte';
import ResultView from '$lib/ResultView.svelte';
import ModeSwitch from '$lib/ModeSwitch.svelte';
+ import SponsorMenu from '$lib/SponsorMenu.svelte';
import DiagnosticsView from '$lib/DiagnosticsView.svelte';
import BatchQueueView from '$lib/BatchQueueView.svelte';
import BatchSummaryView from '$lib/BatchSummaryView.svelte';
@@ -355,7 +356,7 @@
code: 'UNSUPPORTED_FORMAT',
title: 'Unsupported file type',
detail: 'None of the selected files are a supported format.',
- suggested_action: 'Choose PDF, DOCX, PPTX, XLSX, EPUB, HTML, CSV, JSON, XML, an image, or audio.',
+ suggested_action: 'Choose PDF, DOCX, PPTX, XLSX, EPUB, HTML, CSV, JSON, XML, TXT, Markdown, an image, or audio.',
};
return;
}
@@ -533,6 +534,7 @@
</span>
{/if}
<div class="header-right">
+ <SponsorMenu />
{#if phase === 'ready' && config}
<ModeSwitch mode={config.llm_mode} onModeChange={(m) => updateConfig({ ...config!, llm_mode: m })} />
<button
diff --git a/docs/media/screenshot-changes.png b/docs/media/screenshot-changes.png
new file mode 100644
index 0000000..fcc0c57
Binary files /dev/null and b/docs/media/screenshot-changes.png differ
diff --git a/index.html b/index.html
index 5df8af5..e6dad01 100644
--- a/index.html
+++ b/index.html
@@ -331,9 +331,10 @@
.cleanup-grid{display:grid;grid-template-columns:1fr 1fr;gap:48px;align-items:center}
.cleanup-shot{
background:var(--panel);border:1px solid var(--border);border-radius:var(--r-card);
- padding:18px;display:flex;justify-content:center;
+ padding:18px;display:flex;flex-direction:column;align-items:center;justify-content:center;
}
.cleanup-shot img{border-radius:var(--r-inset);border:1px solid var(--hairline);width:100%;height:auto}
+ .shot-caption{margin:12px 0 0;font-size:13px;color:var(--muted);text-align:center;line-height:1.45}
.modes{display:flex;flex-direction:column;gap:14px}
.mode{
background:var(--panel);border:1px solid var(--border);border-radius:var(--r-card);
@@ -407,7 +408,7 @@
<div class="eyebrow"><span class="dot"></span>Reads documents other tools can't.</div>
<h1>Converts documents into clean, <em>AI-ready Markdown.</em></h1>
<p class="sub">On your machine. No upload.</p>
- <p class="sub" style="font-size:14px;opacity:.65;margin-top:8px">Works with PDF · DOCX · PPTX · XLSX · EPUB · HTML · CSV · JSON · XML · images · audio</p>
+ <p class="sub" style="font-size:14px;opacity:.65;margin-top:8px">Works with PDF · DOCX · PPTX · XLSX · EPUB · HTML · CSV · JSON · XML · TXT · MD · images · audio</p>
<div class="chips">
<span class="chip">Open Source</span>
<span class="chip">MIT</span>
@@ -504,12 +505,12 @@
<div class="feature-grid">
<div class="feature"><div class="ic">💸</div><h3>Fewer tokens, lower cost</h3><p>Clean Markdown costs about 2 to 6× fewer tokens than sending pages to a vision model. Every LLM call that reads the document is cheaper.</p></div>
<div class="feature"><div class="ic">🔒</div><h3>Local and private</h3><p>Your documents never leave your machine. No cloud, no API key, no account.</p></div>
- <div class="feature"><div class="ic">🔍</div><h3>Reads scanned PDFs</h3><p>Built-in OCR recovers text that plain extractors return as zero characters.</p></div>
+ <div class="feature"><div class="ic">🔍</div><h3>Reads scanned PDFs</h3><p>Built-in OCR recovers text from scans that other tools treat as blank.</p></div>
<div class="feature"><div class="ic">🧱</div><h3>Real structure</h3><p>Proper Markdown with headings, tables, and lists intact. Readable, greppable, diff-able.</p></div>
<div class="feature"><div class="ic">🖥️</div><h3>No terminal needed</h3><p>Portable app. Unzip, run, click through a one-time setup. Done.</p></div>
- <div class="feature"><div class="ic">📦</div><h3>Many formats</h3><p>PDF, DOCX, PPTX, XLSX, EPUB, HTML, CSV, JSON, XML, images, and audio.</p></div>
+ <div class="feature"><div class="ic">📦</div><h3>Many formats</h3><p>PDF, DOCX, PPTX, XLSX, EPUB, HTML, CSV, JSON, XML, TXT, Markdown, images, and audio.</p></div>
<div class="feature"><div class="ic">🔁</div><h3>Batch a whole folder</h3><p>Convert everything at once, with progress, cancellation, and per-file diagnostics.</p></div>
- <div class="feature"><div class="ic">🧹</div><h3>Optional cleanup</h3><p>Off, rule-based, or a local AI pass to tidy up messy extractions.</p></div>
+ <div class="feature"><div class="ic">🧹</div><h3>Optional cleanup</h3><p>Off, rule-based, or an AI pass (local or API). The Changes tab shows what cleanup added or removed.</p></div>
</div>
</div>
</section>
@@ -596,11 +597,15 @@
<span class="dot-c" style="background:var(--muted)"></span>
<div>
<h3>API <span class="tag">bring-your-own-key</span></h3>
- <p>For when you want a frontier model's cleanup. OpenAI-compatible client, your key, your cost. Clearly marked, never the default, never required.</p>
+ <p>For when you want a frontier model's cleanup. Pick the provider in Diagnostics (DeepSeek, OpenAI, and other OpenAI-compatible endpoints), then Test the key. Clearly marked, never the default, never required.</p>
</div>
</div>
</div>
</div>
+ <div class="cleanup-shot" style="margin-top:48px;max-width:600px;margin-left:auto;margin-right:auto">
+ <img src="docs/media/screenshot-changes.png" alt="Changes tab after cleanup, showing added and removed lines" width="600" height="444" loading="lazy">
+ <p class="shot-caption">The Changes tab after cleanup: what was added or removed, line by line.</p>
+ </div>
</div>
</section>