fix(tagger): provision ONNX runtime DLLs during tagger model prep

On a clean install the WD tagger download failed instantly: only the
(UI-removed) caption model prep ever downloaded the shared ONNX Runtime
DLLs, while ensure_onnx_runtime — despite its comment — only initializes
and errors when the DLL is absent. Worse, the OnceLock cached that error
for the whole session, and the onboarding step swallowed the message.

- new captioner::provision_onnx_runtime downloads missing DLLs; tagger
  prep calls it before init
- ensure_onnx_runtime no longer caches failure (Mutex<bool>, success-only
  latch) so a later download can recover in-session
- onboarding AI step now displays taggerModelError
This commit is contained in:
2026-06-13 00:00:35 +01:00
parent 3b7190d353
commit b72f140737
3 changed files with 43 additions and 20 deletions
+3 -2
View File
@@ -251,11 +251,12 @@ pub fn prepare_tagger_model_with_progress(
std::fs::create_dir_all(&local_dir)?;
// Ensure the shared ONNX runtime DLLs are present. The tagger shares
// them with the captioner; install them here so the tagger is fully
// them with the captioner; download them here so the tagger is fully
// functional even on a clean install where the caption model has never
// been downloaded.
// been downloaded (ensure_onnx_runtime only initializes, never downloads).
let caption_model_dir = crate::captioner::model_dir(app_data_dir);
std::fs::create_dir_all(&caption_model_dir)?;
crate::captioner::provision_onnx_runtime(&caption_model_dir)?;
crate::captioner::ensure_onnx_runtime(&caption_model_dir)?;
// Download the two tagger-specific files.