diff --git a/app/MindWork AI Studio/Settings/SettingsManager.cs b/app/MindWork AI Studio/Settings/SettingsManager.cs index 338c35c..38b46c6 100644 --- a/app/MindWork AI Studio/Settings/SettingsManager.cs +++ b/app/MindWork AI Studio/Settings/SettingsManager.cs @@ -73,9 +73,10 @@ public sealed class SettingsManager /// /// Data structure for deleting a secret response. /// - /// True, when the secret was successfully deleted. + /// True, when the secret was successfully deleted or not found. /// The issue, when the secret could not be deleted. - public readonly record struct DeleteSecretResponse(bool Success, string Issue); + /// True, when the entry was found and deleted. + public readonly record struct DeleteSecretResponse(bool Success, string Issue, bool WasEntryFound); /// /// Tries to delete the API key for the given provider. diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.8.5.md b/app/MindWork AI Studio/wwwroot/changelog/v0.8.5.md index b2568e8..9be70b3 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.8.5.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.8.5.md @@ -6,6 +6,7 @@ - Improved readability of the issue component - Improved switches: when an option is enabled, the switch is using a different color - Fixed the applying of spellchecking settings to the single-line dialog +- Fixed the bug where users cannot delete a self-hosted provider when an API token was never entered - Restructured the layout of the settings page - Refactored the settings data model - Upgraded to Rust 1.80.0 diff --git a/runtime/src/main.rs b/runtime/src/main.rs index d1617ae..3e0f867 100644 --- a/runtime/src/main.rs +++ b/runtime/src/main.rs @@ -15,6 +15,7 @@ use tauri::api::process::{Command, CommandChild, CommandEvent}; use tauri::utils::config::AppUrl; use tokio::time; use flexi_logger::{AdaptiveFormat, Logger}; +use keyring::error::Error::NoEntry; use log::{debug, error, info, warn}; use tauri::updater::UpdateResponse; @@ -454,19 +455,31 @@ fn delete_secret(destination: String, user_name: String) -> DeleteSecretResponse let service = format!("mindwork-ai-studio::{}", destination); let entry = Entry::new(service.as_str(), user_name.as_str()).unwrap(); let result = entry.delete_password(); + match result { Ok(_) => { warn!("Secret for {service} and user {user_name} was deleted successfully."); DeleteSecretResponse { success: true, + was_entry_found: true, issue: String::from(""), } }, + + Err(NoEntry) => { + warn!("No secret for {service} and user {user_name} was found."); + DeleteSecretResponse { + success: true, + was_entry_found: false, + issue: String::from(""), + } + } Err(e) => { error!("Failed to delete secret for {service} and user {user_name}: {e}."); DeleteSecretResponse { success: false, + was_entry_found: false, issue: e.to_string(), } }, @@ -476,6 +489,7 @@ fn delete_secret(destination: String, user_name: String) -> DeleteSecretResponse #[derive(Serialize)] struct DeleteSecretResponse { success: bool, + was_entry_found: bool, issue: String, }