mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-04 17:29:40 +00:00
Refactored configuration objects (#538)
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
This commit is contained in:
1 parent
be11efed67
commit
c1826426d9
31 files changed
+723
-472
No files matched your search
@@ -92,10 +92,10 @@ public static partial class PluginFactory
|
||||
|
||||
case { IsValid: false }:
|
||||
LOG.LogError($"Was not able to load plugin '{pluginMainFile}', because the Lua code is not a valid AI Studio plugin. There are {plugin.Issues.Count()} issues to fix. First issue is: {plugin.Issues.FirstOrDefault()}");
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
foreach (var pluginIssue in plugin.Issues)
|
||||
LOG.LogError($"Plugin issue: {pluginIssue}");
|
||||
#endif
|
||||
#endif
|
||||
continue;
|
||||
|
||||
case { IsMaintained: false }:
|
||||
@@ -125,89 +125,24 @@ public static partial class PluginFactory
|
||||
|
||||
//
|
||||
// =========================================================
|
||||
// Next, we have to clean up our settings. It is possible that a configuration plugin was removed.
|
||||
// We have to remove the related settings as well:
|
||||
// Next, we have to clean up our settings. It is possible
|
||||
// that a configuration plugin was removed. We have to
|
||||
// remove the related settings as well:
|
||||
// =========================================================
|
||||
//
|
||||
var wasConfigurationChanged = false;
|
||||
|
||||
//
|
||||
// Check LLM providers:
|
||||
//
|
||||
#pragma warning disable MWAIS0001
|
||||
var configuredProviders = SETTINGS_MANAGER.ConfigurationData.Providers.ToList();
|
||||
foreach (var configuredProvider in configuredProviders)
|
||||
{
|
||||
if(!configuredProvider.IsEnterpriseConfiguration)
|
||||
continue;
|
||||
|
||||
var providerSourcePluginId = configuredProvider.EnterpriseConfigurationPluginId;
|
||||
if(providerSourcePluginId == Guid.Empty)
|
||||
continue;
|
||||
|
||||
var providerSourcePlugin = AVAILABLE_PLUGINS.FirstOrDefault(plugin => plugin.Id == providerSourcePluginId);
|
||||
if(providerSourcePlugin is null)
|
||||
{
|
||||
LOG.LogWarning($"The configured LLM provider '{configuredProvider.InstanceName}' (id={configuredProvider.Id}) is based on a plugin that is not available anymore. Removing the provider from the settings.");
|
||||
SETTINGS_MANAGER.ConfigurationData.Providers.Remove(configuredProvider);
|
||||
wasConfigurationChanged = true;
|
||||
}
|
||||
|
||||
if(!configObjectList.Any(configObject =>
|
||||
configObject.Type is PluginConfigurationObjectType.LLM_PROVIDER &&
|
||||
configObject.ConfigPluginId == providerSourcePluginId &&
|
||||
configObject.Id.ToString() == configuredProvider.Id))
|
||||
{
|
||||
LOG.LogWarning($"The configured LLM provider '{configuredProvider.InstanceName}' (id={configuredProvider.Id}) is not present in the configuration plugin anymore. Removing the provider from the settings.");
|
||||
SETTINGS_MANAGER.ConfigurationData.Providers.Remove(configuredProvider);
|
||||
wasConfigurationChanged = true;
|
||||
}
|
||||
}
|
||||
#pragma warning restore MWAIS0001
|
||||
var wasConfigurationChanged = PluginConfigurationObject.CleanLeftOverConfigurationObjects(PluginConfigurationObjectType.LLM_PROVIDER, x => x.Providers, AVAILABLE_PLUGINS, configObjectList);
|
||||
|
||||
//
|
||||
// Check chat templates:
|
||||
//
|
||||
var configuredTemplates = SETTINGS_MANAGER.ConfigurationData.ChatTemplates.ToList();
|
||||
foreach (var configuredTemplate in configuredTemplates)
|
||||
{
|
||||
if(!configuredTemplate.IsEnterpriseConfiguration)
|
||||
continue;
|
||||
|
||||
var templateSourcePluginId = configuredTemplate.EnterpriseConfigurationPluginId;
|
||||
if(templateSourcePluginId == Guid.Empty)
|
||||
continue;
|
||||
|
||||
var templateSourcePlugin = AVAILABLE_PLUGINS.FirstOrDefault(plugin => plugin.Id == templateSourcePluginId);
|
||||
if(templateSourcePlugin is null)
|
||||
{
|
||||
LOG.LogWarning($"The configured chat template '{configuredTemplate.Name}' (id={configuredTemplate.Id}) is based on a plugin that is not available anymore. Removing the chat template from the settings.");
|
||||
SETTINGS_MANAGER.ConfigurationData.ChatTemplates.Remove(configuredTemplate);
|
||||
wasConfigurationChanged = true;
|
||||
}
|
||||
|
||||
if(!configObjectList.Any(configObject =>
|
||||
configObject.Type is PluginConfigurationObjectType.CHAT_TEMPLATE &&
|
||||
configObject.ConfigPluginId == templateSourcePluginId &&
|
||||
configObject.Id.ToString() == configuredTemplate.Id))
|
||||
{
|
||||
LOG.LogWarning($"The configured chat template '{configuredTemplate.Name}' (id={configuredTemplate.Id}) is not present in the configuration plugin anymore. Removing the chat template from the settings.");
|
||||
SETTINGS_MANAGER.ConfigurationData.ChatTemplates.Remove(configuredTemplate);
|
||||
wasConfigurationChanged = true;
|
||||
}
|
||||
}
|
||||
if(PluginConfigurationObject.CleanLeftOverConfigurationObjects(PluginConfigurationObjectType.CHAT_TEMPLATE, x => x.ChatTemplates, AVAILABLE_PLUGINS, configObjectList))
|
||||
wasConfigurationChanged = true;
|
||||
|
||||
//
|
||||
// ==========================================================
|
||||
// Check all possible settings:
|
||||
// ==========================================================
|
||||
//
|
||||
|
||||
// Check for updates, and if so, how often?
|
||||
// Check for update behavior:
|
||||
if(ManagedConfiguration.IsConfigurationLeftOver<DataApp, UpdateBehavior>(x => x.App, x => x.UpdateBehavior, AVAILABLE_PLUGINS))
|
||||
wasConfigurationChanged = true;
|
||||
|
||||
// Allow the user to add providers?
|
||||
// Check for users allowed to added providers:
|
||||
if(ManagedConfiguration.IsConfigurationLeftOver<DataApp, bool>(x => x.App, x => x.AllowUserToAddProvider, AVAILABLE_PLUGINS))
|
||||
wasConfigurationChanged = true;
|
||||
|
||||
|
||||
Reference in new issue
Block a user