diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor
index 853df195..656fa2cf 100644
--- a/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor
+++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor
@@ -13,7 +13,8 @@
-
+
+
diff --git a/app/MindWork AI Studio/Layout/MainLayout.razor.cs b/app/MindWork AI Studio/Layout/MainLayout.razor.cs
index cc115a2c..079b4161 100644
--- a/app/MindWork AI Studio/Layout/MainLayout.razor.cs
+++ b/app/MindWork AI Studio/Layout/MainLayout.razor.cs
@@ -92,7 +92,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
[
Event.UPDATE_AVAILABLE, Event.CONFIGURATION_CHANGED, Event.COLOR_THEME_CHANGED, Event.SHOW_ERROR,
Event.SHOW_ERROR, Event.SHOW_WARNING, Event.SHOW_SUCCESS, Event.STARTUP_PLUGIN_SYSTEM,
- Event.PLUGINS_RELOADED
+ Event.PLUGINS_RELOADED, Event.INSTALL_UPDATE,
]);
// Set the snackbar for the update service:
@@ -143,6 +143,11 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
{
switch (triggeredEvent)
{
+ case Event.INSTALL_UPDATE:
+ this.performingUpdate = true;
+ this.StateHasChanged();
+ break;
+
case Event.UPDATE_AVAILABLE:
if (data is UpdateResponse updateResponse)
{
diff --git a/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs b/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs
index 587dec94..1ec3e75d 100644
--- a/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs
+++ b/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs
@@ -63,7 +63,7 @@ public static class ConfigurationSelectDataFactory
yield return new(TB("Enter is sending the input"), SendBehavior.ENTER_IS_SENDING);
}
- public static IEnumerable> GetUpdateBehaviorData()
+ public static IEnumerable> GetUpdateIntervalData()
{
yield return new(TB("No automatic update checks"), UpdateInterval.NO_CHECK);
yield return new(TB("Once at startup"), UpdateInterval.ONCE_STARTUP);
@@ -71,6 +71,11 @@ public static class ConfigurationSelectDataFactory
yield return new(TB("Check every day"), UpdateInterval.DAILY);
yield return new (TB("Check every week"), UpdateInterval.WEEKLY);
}
+
+ public static IEnumerable> GetUpdateBehaviourData()
+ {
+ yield return new(TB("Install updates manually"), UpdateBehaviour.MANUAL);
+ yield return new(TB("Install updates automatically"), UpdateBehaviour.AUTOMATIC);
}
public static IEnumerable> GetWorkspaceStorageBehaviorData()
diff --git a/app/MindWork AI Studio/Settings/DataModel/DataApp.cs b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs
index 1bdead6b..1f879608 100644
--- a/app/MindWork AI Studio/Settings/DataModel/DataApp.cs
+++ b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs
@@ -41,6 +41,11 @@ public sealed class DataApp(Expression>? configSelection = n
/// If and when we should look for updates.
///
public UpdateInterval UpdateInterval { get; set; } = ManagedConfiguration.Register(configSelection, n => n.UpdateInterval, UpdateInterval.HOURLY);
+
+ ///
+ /// How updates should be installed.
+ ///
+ public UpdateBehaviour UpdateBehaviour { get; set; } = ManagedConfiguration.Register(configSelection, n => n.UpdateBehaviour, UpdateBehaviour.MANUAL);
///
/// The navigation behavior.
diff --git a/app/MindWork AI Studio/Settings/DataModel/UpdateBehaviour.cs b/app/MindWork AI Studio/Settings/DataModel/UpdateBehaviour.cs
new file mode 100644
index 00000000..466a59c6
--- /dev/null
+++ b/app/MindWork AI Studio/Settings/DataModel/UpdateBehaviour.cs
@@ -0,0 +1,7 @@
+namespace AIStudio.Settings.DataModel;
+
+public enum UpdateBehaviour
+{
+ MANUAL,
+ AUTOMATIC,
+}
diff --git a/app/MindWork AI Studio/Tools/Event.cs b/app/MindWork AI Studio/Tools/Event.cs
index fc8ca8e3..fcf32604 100644
--- a/app/MindWork AI Studio/Tools/Event.cs
+++ b/app/MindWork AI Studio/Tools/Event.cs
@@ -18,6 +18,7 @@ public enum Event
// Update events:
USER_SEARCH_FOR_UPDATE,
UPDATE_AVAILABLE,
+ INSTALL_UPDATE,
// Chat events:
HAS_CHAT_UNSAVED_CHANGES,
diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs
index 8a1ed5b8..57ef5de6 100644
--- a/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs
+++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs
@@ -55,6 +55,9 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
// Config: check for updates, and if so, how often?
ManagedConfiguration.TryProcessConfiguration(x => x.App, x => x.UpdateInterval, this.Id, settingsTable, dryRun);
+ // Config: how should updates be installed?
+ ManagedConfiguration.TryProcessConfiguration(x => x.App, x => x.UpdateBehaviour, this.Id, settingsTable, dryRun);
+
// Config: allow the user to add providers?
ManagedConfiguration.TryProcessConfiguration(x => x.App, x => x.AllowUserToAddProvider, this.Id, settingsTable, dryRun);
diff --git a/app/MindWork AI Studio/Tools/Services/UpdateService.cs b/app/MindWork AI Studio/Tools/Services/UpdateService.cs
index cee21cc5..c2244fd0 100644
--- a/app/MindWork AI Studio/Tools/Services/UpdateService.cs
+++ b/app/MindWork AI Studio/Tools/Services/UpdateService.cs
@@ -115,7 +115,25 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
var response = await this.rust.CheckForUpdate();
if (response.UpdateIsAvailable)
{
- await this.messageBus.SendMessage(null, Event.UPDATE_AVAILABLE, response);
+ if (this.settingsManager.ConfigurationData.App.UpdateBehaviour is UpdateBehaviour.AUTOMATIC)
+ {
+ try
+ {
+ await this.messageBus.SendMessage(null, Event.INSTALL_UPDATE);
+ await this.rust.InstallUpdate();
+ }
+ catch (Exception)
+ {
+ SNACKBAR!.Add(TB("Failed to install update automatically. Please try again manually."), Severity.Error, config =>
+ {
+ config.Icon = Icons.Material.Filled.Error;
+ config.IconSize = Size.Large;
+ config.IconColor = Color.Error;
+ });
+ }
+ }
+ else
+ await this.messageBus.SendMessage(null, Event.UPDATE_AVAILABLE, response);
}
else
{