mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 05:21:36 +00:00
Fixed a bug in GUID comparisons for configuration plugins (#578)
Some checks failed
Build and Release / Read metadata (push) Has been cancelled
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) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
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) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
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) Has been cancelled
Some checks failed
Build and Release / Read metadata (push) Has been cancelled
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) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
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) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
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) Has been cancelled
This commit is contained in:
parent
48d762bc68
commit
a6519ca0e2
@ -3,6 +3,7 @@ require("icon")
|
|||||||
-- ------
|
-- ------
|
||||||
-- This is an example of a configuration plugin. Please replace
|
-- This is an example of a configuration plugin. Please replace
|
||||||
-- the placeholders and assign a valid ID.
|
-- the placeholders and assign a valid ID.
|
||||||
|
-- All IDs should be lower-case.
|
||||||
-- ------
|
-- ------
|
||||||
|
|
||||||
-- The ID for this plugin:
|
-- The ID for this plugin:
|
||||||
@ -97,9 +98,7 @@ CONFIG["SETTINGS"] = {}
|
|||||||
|
|
||||||
-- Configure the preselected profile.
|
-- Configure the preselected profile.
|
||||||
-- It must be one of the profile IDs defined in CONFIG["PROFILES"].
|
-- It must be one of the profile IDs defined in CONFIG["PROFILES"].
|
||||||
-- Be aware that the ID must be using the same casing as defined in the profile.
|
-- Please note: using an empty string ("") will lock the preselected profile selection, even though no valid preselected profile is found.
|
||||||
-- When the ID is using upper case letters, but using lower case letters in this
|
|
||||||
-- setting, the preselection will not work.
|
|
||||||
-- CONFIG["SETTINGS"]["DataApp.PreselectedProfile"] = "00000000-0000-0000-0000-000000000000"
|
-- CONFIG["SETTINGS"]["DataApp.PreselectedProfile"] = "00000000-0000-0000-0000-000000000000"
|
||||||
|
|
||||||
-- Example chat templates for this configuration:
|
-- Example chat templates for this configuration:
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
@ -153,6 +154,34 @@ public static partial class ManagedConfiguration
|
|||||||
Guid configPluginId,
|
Guid configPluginId,
|
||||||
LuaTable settings,
|
LuaTable settings,
|
||||||
bool dryRun)
|
bool dryRun)
|
||||||
|
{
|
||||||
|
return TryProcessConfiguration(configSelection, propertyExpression, string.Empty, configPluginId, settings, dryRun);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to process the configuration settings from a Lua table for string values.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// When the configuration is successfully processed, it updates the configuration metadata with the configured value.
|
||||||
|
/// Furthermore, it locks the managed state of the configuration metadata to the provided configuration plugin ID.
|
||||||
|
/// The setting's value is set to the configured value.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="configuredType">Parameter type of the configuration entry.</param>
|
||||||
|
/// <param name="configPluginId">The ID of the related configuration plugin.</param>
|
||||||
|
/// <param name="settings">The Lua table containing the settings to process.</param>
|
||||||
|
/// <param name="configSelection">The expression to select the configuration class.</param>
|
||||||
|
/// <param name="propertyExpression">The expression to select the property within the configuration class.</param>
|
||||||
|
/// <param name="dryRun">When true, the method will not apply any changes, but only check if the configuration can be read.</param>
|
||||||
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
|
/// <typeparam name="TDataType">The data type of the configured value.</typeparam>
|
||||||
|
/// <returns>True when the configuration was successfully processed, otherwise false.</returns>
|
||||||
|
public static bool TryProcessConfiguration<TClass, TDataType>(
|
||||||
|
Expression<Func<Data, TClass>> configSelection,
|
||||||
|
Expression<Func<TClass, string>> propertyExpression,
|
||||||
|
TDataType configuredType,
|
||||||
|
Guid configPluginId,
|
||||||
|
LuaTable settings,
|
||||||
|
bool dryRun)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Handle configured string values
|
// Handle configured string values
|
||||||
@ -171,8 +200,20 @@ public static partial class ManagedConfiguration
|
|||||||
// Step 2 -- try to read the Lua value as a string:
|
// Step 2 -- try to read the Lua value as a string:
|
||||||
if(configuredTextValue.TryRead<string>(out var configuredText))
|
if(configuredTextValue.TryRead<string>(out var configuredText))
|
||||||
{
|
{
|
||||||
configuredValue = configuredText;
|
switch (configuredType)
|
||||||
successful = true;
|
{
|
||||||
|
// Case: the read string is a Guid:
|
||||||
|
case Guid:
|
||||||
|
successful = Guid.TryParse(configuredText, out var id);
|
||||||
|
configuredValue = successful ? id.ToString().ToLowerInvariant() : configuredText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Case: the read string is just a string:
|
||||||
|
case string:
|
||||||
|
configuredValue = configuredText;
|
||||||
|
successful = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -263,7 +263,7 @@ public sealed class SettingsManager
|
|||||||
if (preselection != Profile.NO_PROFILE)
|
if (preselection != Profile.NO_PROFILE)
|
||||||
return preselection;
|
return preselection;
|
||||||
|
|
||||||
preselection = this.ConfigurationData.Profiles.FirstOrDefault(x => x.Id == this.ConfigurationData.App.PreselectedProfile);
|
preselection = this.ConfigurationData.Profiles.FirstOrDefault(x => x.Id.Equals(this.ConfigurationData.App.PreselectedProfile, StringComparison.InvariantCultureIgnoreCase));
|
||||||
return preselection ?? Profile.NO_PROFILE;
|
return preselection ?? Profile.NO_PROFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ public sealed class SettingsManager
|
|||||||
if (preselection != ChatTemplate.NO_CHAT_TEMPLATE)
|
if (preselection != ChatTemplate.NO_CHAT_TEMPLATE)
|
||||||
return preselection;
|
return preselection;
|
||||||
|
|
||||||
preselection = this.ConfigurationData.ChatTemplates.FirstOrDefault(x => x.Id == this.ConfigurationData.App.PreselectedChatTemplate);
|
preselection = this.ConfigurationData.ChatTemplates.FirstOrDefault(x => x.Id.Equals(this.ConfigurationData.App.PreselectedChatTemplate, StringComparison.InvariantCultureIgnoreCase));
|
||||||
return preselection ?? ChatTemplate.NO_CHAT_TEMPLATE;
|
return preselection ?? ChatTemplate.NO_CHAT_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
|
|||||||
PluginConfigurationObject.TryParse(PluginConfigurationObjectType.PROFILE, x => x.Profiles, x => x.NextProfileNum, mainTable, this.Id, ref this.configObjects, dryRun);
|
PluginConfigurationObject.TryParse(PluginConfigurationObjectType.PROFILE, x => x.Profiles, x => x.NextProfileNum, mainTable, this.Id, ref this.configObjects, dryRun);
|
||||||
|
|
||||||
// Config: preselected profile?
|
// Config: preselected profile?
|
||||||
ManagedConfiguration.TryProcessConfiguration(x => x.App, x => x.PreselectedProfile, this.Id, settingsTable, dryRun);
|
ManagedConfiguration.TryProcessConfiguration(x => x.App, x => x.PreselectedProfile, Guid.Empty, this.Id, settingsTable, dryRun);
|
||||||
|
|
||||||
message = string.Empty;
|
message = string.Empty;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
# v0.9.55, build 230 (2025-12-xx xx:xx UTC)
|
# v0.9.55, build 230 (2025-12-xx xx:xx UTC)
|
||||||
- Added support for newer Mistral models (Mistral 3, Voxtral, and Magistral)
|
- Added support for newer Mistral models (Mistral 3, Voxtral, and Magistral).
|
||||||
|
- Improved the ID handling for configuration plugins.
|
||||||
Loading…
Reference in New Issue
Block a user