Fix: update status after download completes
Made-with: Cursor
This commit is contained in:
@@ -243,6 +243,15 @@ impl SettingsApp {
|
|||||||
let model_path = Path::new(&self.config.model_path);
|
let model_path = Path::new(&self.config.model_path);
|
||||||
let model_valid = !self.config.model_path.is_empty() && model::is_model_valid(model_path);
|
let model_valid = !self.config.model_path.is_empty() && model::is_model_valid(model_path);
|
||||||
let downloading = self.download_progress.as_ref().and_then(|p| p.read().ok()).and_then(|g| g.clone());
|
let downloading = self.download_progress.as_ref().and_then(|p| p.read().ok()).and_then(|g| g.clone());
|
||||||
|
|
||||||
|
// Download complete: update status even when model_valid is now true
|
||||||
|
if matches!(downloading, Some(model::DownloadProgress::Finished)) {
|
||||||
|
self.status = "Model downloaded. Remember to save.".to_string();
|
||||||
|
if let Some(ref p) = self.download_progress {
|
||||||
|
let _ = p.write().map(|mut w| *w = None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !self.config.model_path.is_empty() && !model_valid {
|
if !self.config.model_path.is_empty() && !model_valid {
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.colored_label(egui::Color32::YELLOW, "Model not found in folder.");
|
ui.colored_label(egui::Color32::YELLOW, "Model not found in folder.");
|
||||||
@@ -265,10 +274,6 @@ impl SettingsApp {
|
|||||||
}
|
}
|
||||||
model::DownloadProgress::Finished => {
|
model::DownloadProgress::Finished => {
|
||||||
ui.colored_label(egui::Color32::GREEN, "Download complete.");
|
ui.colored_label(egui::Color32::GREEN, "Download complete.");
|
||||||
self.status = "Model downloaded. Remember to save.".to_string();
|
|
||||||
if let Some(ref p) = self.download_progress {
|
|
||||||
let _ = p.write().map(|mut w| *w = None);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
model::DownloadProgress::Error(e) => {
|
model::DownloadProgress::Error(e) => {
|
||||||
ui.colored_label(egui::Color32::RED, format!("Error: {}", e));
|
ui.colored_label(egui::Color32::RED, format!("Error: {}", e));
|
||||||
|
|||||||
Reference in New Issue
Block a user