Skip to content

feat: add local LLM text post-processing - #177

Draft
jatinkrmalik wants to merge 5 commits into
mainfrom
jmalik/feat/local-llm-polish
Draft

feat: add local LLM text post-processing#177
jatinkrmalik wants to merge 5 commits into
mainfrom
jmalik/feat/local-llm-polish

Conversation

@jatinkrmalik

@jatinkrmalik jatinkrmalik commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Adds an opt-in local AI post-processing pass after Whisper transcription and before text insertion.

  • adds a dedicated Text settings tab for language, vocabulary, AI rewrite, and insertion settings
  • adds a curated local model picker with Gemma 3 1B as the default conservative choice, Qwen3 1.7B as the larger alternative, and custom GGUF support
  • installs and detects Homebrew's llama-server runtime, including migration from previously stored llama or llama-cli paths
  • prepares catalog models through llama.cpp's Hugging Face cache via -hf, then enables rewrite only after a valid probe response
  • falls back to raw Whisper text if post-processing fails, while surfacing a non-blocking warning

Runtime design

VocaMac starts llama-server for each post-processing request on a unique private Unix socket under /tmp. It waits for the health endpoint, sends separate system and user messages to the OpenAI-compatible /v1/chat/completions endpoint, decodes choices[0].message.content, and shuts the server down after the response.

This replaces the earlier llama-cli transcript parsing approach entirely:

  • no interactive CLI mode or hanging prompt loop
  • no parsing of banners, prompt echoes, timing lines, or terminal control sequences
  • no TCP port selection or collision risk
  • structured JSON errors and response validation
  • server subprocess output is drained to avoid pipe backpressure

Production notes

  • No silent external installs: llama.cpp installation is user-initiated.
  • No custom model downloader: llama.cpp owns Hugging Face downloads and caching.
  • The first guided model setup can take time because the selected GGUF is downloaded locally.
  • Existing custom GGUF workflows continue through the Custom GGUF option.
  • Existing saved llama and llama-cli paths resolve the adjacent llama-server binary automatically.

Model choice

In local tests for conservative transcript cleanup, Gemma 3 1B followed the rewrite instructions more reliably than Qwen3 1.7B, so Gemma is now the default. Qwen remains available as an explicit larger option.

Related Linux issue: VocaHQ/vocalinux#408

Validation

  • swift test (236 tests, 2 skipped, 0 failures)
  • VOCAMAC_RUN_LOCAL_LLM_TEST=1 swift test --filter LocalLLMPostProcessorTests/testLocalLlamaServerIntegrationWhenEnabled
  • real-model integration passed against cached ggml-org/gemma-3-1b-it-GGUF:Q4_K_M
  • manual structured API probe against cached Qwen/Qwen3-1.7B-GGUF:Q8_0
  • verified the integration leaves no llama-server process running

@github-actions github-actions Bot added the app label Jul 9, 2026
@jatinkrmalik

Copy link
Copy Markdown
Member Author

/build

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Build started for 8adf8ed

Build signed & notarized DMG... this usually takes 10–20 minutes.

Watch the build →

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Build ready!

DMG VocaMac-0.7.0-pr.177+8adf8ed-arm64.dmg
Size 5.1M
Branch jmalik/feat/local-llm-polish
Commit 8adf8ed
Signed ✅ Developer ID
Notarized ✅ Apple

📥 Install

  1. Click the DMG link above to download
  2. Open the DMG and drag VocaMac to Applications (replace existing)
  3. Open VocaMac — No Gatekeeper warnings, no permission resets
SHA-256 checksum
52b80c38f21993b4fd8a7ca46196ef71e2ddd8066538a67b4933639f503450db  VocaMac-0.7.0-pr.177+8adf8ed-arm64.dmg

💡 Comment /build or /build-quick to rebuild.

@jatinkrmalik
jatinkrmalik force-pushed the jmalik/feat/local-llm-polish branch from 524cfa4 to f5223ae Compare July 9, 2026 20:25

Copy link
Copy Markdown
Member Author

/build

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Build started for f5223ae

Build signed & notarized DMG... this usually takes 10–20 minutes.

Watch the build →

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Build ready!

DMG VocaMac-0.7.0-pr.177+f5223ae-arm64.dmg
Size 5.2M
Branch jmalik/feat/local-llm-polish
Commit f5223ae
Signed ✅ Developer ID
Notarized ✅ Apple

📥 Install

  1. Click the DMG link above to download
  2. Open the DMG and drag VocaMac to Applications (replace existing)
  3. Open VocaMac — No Gatekeeper warnings, no permission resets
SHA-256 checksum
78d0183996e6669b26472cc98ee421d3401c0c781eb1a1523ea992024f70d2bd  VocaMac-0.7.0-pr.177+f5223ae-arm64.dmg

💡 Comment /build or /build-quick to rebuild.

Copy link
Copy Markdown
Member Author

/build

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Build started for a6984c8

Build signed & notarized DMG... this usually takes 10–20 minutes.

Watch the build →

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Build ready!

DMG VocaMac-0.7.0-pr.177+a6984c8-arm64.dmg
Size 5.2M
Branch jmalik/feat/local-llm-polish
Commit a6984c8
Signed ✅ Developer ID
Notarized ✅ Apple

📥 Install

  1. Click the DMG link above to download
  2. Open the DMG and drag VocaMac to Applications (replace existing)
  3. Open VocaMac — No Gatekeeper warnings, no permission resets
SHA-256 checksum
6959002b9710d2b16e38252daf64a234a0cc0260f66ec536593fe19642bb5174  VocaMac-0.7.0-pr.177+a6984c8-arm64.dmg

💡 Comment /build or /build-quick to rebuild.

@jatinkrmalik
jatinkrmalik force-pushed the jmalik/feat/local-llm-polish branch from a3d314c to f164f65 Compare July 23, 2026 00:11
Run llama.cpp in single-turn mode, parse only the assistant reply from chat output, and tighten the setup probe so model preparation only succeeds after a valid response. Switch the default rewrite model to Gemma 3 1B because it behaved more conservatively and reliably in local repros.
Replace human-oriented llama CLI output parsing with a private Unix-socket llama-server session and JSON chat-completions responses. Preserve existing runner settings by resolving adjacent server binaries and add an opt-in real-model integration test for the complete process lifecycle.
@jatinkrmalik
jatinkrmalik force-pushed the jmalik/feat/local-llm-polish branch from f164f65 to 4bed40f Compare July 23, 2026 00:35
@jatinkrmalik

Copy link
Copy Markdown
Member Author

/build

@github-actions

Copy link
Copy Markdown

PR Build started for 4bed40f

Build signed & notarized DMG... this usually takes 10–20 minutes.

Watch the build →

@github-actions

Copy link
Copy Markdown

PR Build ready!

DMG VocaMac-0.7.1-pr.177+4bed40f-arm64.dmg
Size 5.2M
Branch jmalik/feat/local-llm-polish
Commit 4bed40f
Signed ✅ Developer ID
Notarized ✅ Apple

📥 Install

  1. Click the DMG link above to download
  2. Open the DMG and drag VocaMac to Applications (replace existing)
  3. Open VocaMac — No Gatekeeper warnings, no permission resets
SHA-256 checksum
aaf53a421c4867f6c591e24579a57be47e3f28679a46590b5472edf5dc7435d8  VocaMac-0.7.1-pr.177+4bed40f-arm64.dmg

💡 Comment /build or /build-quick to rebuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant