feat: Tier-1 Model Manager with Hot-Swapping, HF Download Engine, bug fixes, and test repairs
- Phase 4: Hugging Face Download Engine — streaming GGUF downloads with progress, cancellation, and managed-model storage - Phase 5: Model Source Validation — source-mode compatibility, path/file validation, inline error UI with recovery guidance - Hot-swap: stop runtime → update model_path → restart atomic command - Model library: folder open, delete model file, local model management - SettingsPage unified hub: local models list + HF search with 3-state action buttons - Bug fixes: send button text restored (4 failing tests), reasoning-toggle aria-label, Rust warnings - All 89 tests passing, cargo check clean
This commit is contained in:
1 parent
01b629cb4a
commit
9a093dca15
23 files changed
+1798
-344
No files matched your search
@@ -3,6 +3,18 @@ use std::path::{Path, PathBuf};
|
||||
const MODEL_LIBRARY_DIR: &str = "model-library";
|
||||
const INDEX_FILE: &str = "index.json";
|
||||
const MANAGED_MODELS_DIR: &str = "managed-models";
|
||||
const DEFAULT_MODELS_DIR: &str = "models";
|
||||
|
||||
/// Resolves the models directory from the user-configured `models_dir`.
|
||||
/// - `None` → `./models` (relative to the app's working directory)
|
||||
/// - `Some("")` → `./models`
|
||||
/// - `Some(path)` → that exact path
|
||||
pub fn resolve_models_dir(models_dir: Option<&str>) -> PathBuf {
|
||||
match models_dir {
|
||||
None | Some("") => PathBuf::from(DEFAULT_MODELS_DIR),
|
||||
Some(path) => PathBuf::from(path),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn model_library_dir(app_data_dir: &Path) -> PathBuf {
|
||||
app_data_dir.join(MODEL_LIBRARY_DIR)
|
||||
@@ -12,6 +24,9 @@ pub fn model_library_index_path(app_data_dir: &Path) -> PathBuf {
|
||||
model_library_dir(app_data_dir).join(INDEX_FILE)
|
||||
}
|
||||
|
||||
/// Legacy path for the managed-models location inside AppData.
|
||||
/// Used only for index persistence — downloads now go to the user-configured
|
||||
/// `models_dir` (defaults to `./models` in the project root).
|
||||
pub fn managed_models_dir(app_data_dir: &Path) -> PathBuf {
|
||||
model_library_dir(app_data_dir).join(MANAGED_MODELS_DIR)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user