Prettify llama.cpp OCR settings + wire up llama.cpp hashes#11053
Merged
Conversation
- Redesigned LlamaCppOcrSettingsWindow with header, bordered details panel, more vertical spacing, and a wider Timeout numeric input. Matches the Chatterbox TTS settings layout. - Added an "Engine" status row showing a green/amber/grey dot + label, mirroring how Chatterbox shows install state. - Wired up the previously-unused LlamaCpp.* hashes in DownloadHashManager: LlamaCppDownloadService.DownloadEngine now verifies the downloaded archive's SHA-256 and throws on mismatch, and LlamaCppServerManager.GetEngineUpdateStatus() hashes the installed llama-server binary against the per-OS executable key so the OCR settings dot can show "Update available" when a new build is pinned. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the llama.cpp OCR settings experience and strengthens llama.cpp engine integrity/version reporting by wiring DownloadHashManager hashes into the download and “installed status” flows.
Changes:
- Redesignes
LlamaCppOcrSettingsWindowlayout to match the Chatterbox TTS settings styling and adds an “Engine” status row (dot + label). - Adds archive integrity verification to
LlamaCppDownloadService.DownloadEngine()using known SHA-256 hashes. - Adds
LlamaCppServerManager.GetEngineUpdateStatus()and initializes the OCR settings view model on dialog open to display installed/update status.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ui/Logic/LlamaCpp/LlamaCppServerManager.cs | Adds executable hashing-based update status lookup for installed llama-server. |
| src/ui/Logic/Download/LlamaCppDownloadService.cs | Verifies downloaded engine archive SHA-256 against DownloadHashManager and fails on mismatch. |
| src/ui/Features/Ocr/OcrViewModel.cs | Ensures the llama.cpp OCR settings VM is initialized when opening the dialog. |
| src/ui/Features/Ocr/LlamaCppOcrSettingsWindow.cs | Rebuilds the settings window layout and adds the engine status row UI. |
| src/ui/Features/Ocr/LlamaCppOcrSettingsViewModel.cs | Adds engine status label/brush state and refresh logic based on installed/update status. |
Comment on lines
+43
to
+64
| IsEngineInstalled = LlamaCppServerManager.IsEngineInstalled(); | ||
| if (!IsEngineInstalled) | ||
| { | ||
| EngineLabel = "Not installed"; | ||
| EngineBrush = new SolidColorBrush(Color.FromRgb(0x9E, 0x9E, 0x9E)); // grey | ||
| return; | ||
| } | ||
|
|
||
| switch (LlamaCppServerManager.GetEngineUpdateStatus()) | ||
| { | ||
| case DownloadHashManager.UpdateStatus.UpToDate: | ||
| EngineLabel = "Installed (latest)"; | ||
| EngineBrush = new SolidColorBrush(Color.FromRgb(0x4C, 0xAF, 0x50)); // green | ||
| break; | ||
| case DownloadHashManager.UpdateStatus.UpdateAvailable: | ||
| EngineLabel = "Update available"; | ||
| EngineBrush = new SolidColorBrush(Color.FromRgb(0xFF, 0x98, 0x00)); // amber | ||
| break; | ||
| default: | ||
| EngineLabel = "Installed (unknown version)"; | ||
| EngineBrush = new SolidColorBrush(Color.FromRgb(0x4C, 0xAF, 0x50)); // green | ||
| break; |
Comment on lines
+135
to
+156
| private static StackPanel BuildHeader() | ||
| { | ||
| var title = new TextBlock | ||
| { | ||
| Text = "llama.cpp OCR", | ||
| FontSize = 18, | ||
| FontWeight = FontWeight.SemiBold, | ||
| }; | ||
| var subtitle = new TextBlock | ||
| { | ||
| Text = "Local llama.cpp server (multimodal model) used for OCR.", | ||
| FontSize = 12, | ||
| Opacity = 0.75, | ||
| Margin = new Thickness(0, 2, 0, 0), | ||
| }; | ||
| return new StackPanel | ||
| { | ||
| Orientation = Orientation.Vertical, | ||
| Spacing = 0, | ||
| Children = { title, subtitle }, | ||
| }; | ||
| } |
Switch hard-coded "Not installed" / "Installed (latest)" /
"Update available" / "Installed (unknown version)" strings to
Se.Language.General.{NotInstalled, UpToDate, UpdateAvailable,
UnknownNoInstallRecord}, matching the Qwen3/Kokoro/STT
engine-settings pattern. Align the dot colors with the same
convention: red when missing, green up-to-date, amber update
available, grey for an unknown installed build.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LlamaCppOcrSettingsWindow— header (title + subtitle), bordered details panel, more vertical spacing (RowSpacing = 12), and a wider TimeoutNumericUpDown(100 → 140). Matches the Chatterbox TTS settings layout.Ellipse) + bold label bound toEngineBrush/EngineLabel, mirroringChatterboxTtsSettingsWindow.MakeStatusPanel.LlamaCpp.*hashes inDownloadHashManager:LlamaCppDownloadService.DownloadEnginenow calls a newVerifyArchiveafter download — compares the downloaded bytes againstDownloadHashManager.GetLatestKnownHash(ResolveLlamaCppKey(variant))and throwsIOExceptionon mismatch, so the caller'sIsFaultedbranch surfaces "Download failed" instead of silently unpacking a truncated or tampered file. MirrorsQwen3TtsCppDownloadService.VerifyArchive.LlamaCppServerManager.GetEngineUpdateStatus()SHA-256s the installedllama-serverbinary on disk and callsDownloadHashManager.GetStatus(ResolveLlamaCppExecutableKey(), hash). No sidecar needed becauseLlamaCpp.{Os}Executablekeys already track hashes of the unpacked binary per OS/arch.Test plan
b9174b9145from the executable hash list) is on diskllama-serveris absentIOExceptionis raised🤖 Generated with Claude Code