Skip to content

Start the plugin system #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Mar 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cc2f11f
Refactor PluginFactory to separate internal plugin management into a …
SommerEngineering Mar 23, 2025
e10cf41
Implement IPluginMetadata interface in PluginBase for enhanced plugin…
SommerEngineering Mar 23, 2025
c375f11
Made plugin root a static variable
SommerEngineering Mar 23, 2025
08bfafa
Added data structure for enabled plugins
SommerEngineering Mar 23, 2025
5bca190
Implemented plugin loading
SommerEngineering Mar 23, 2025
f885db8
Load all plugins asynchronously without waiting for completion
SommerEngineering Mar 23, 2025
ff17b67
Refactored the Lua module loading & standard libraries from the plugi…
SommerEngineering Mar 23, 2025
544e9ee
Fixed the plugin path
SommerEngineering Mar 23, 2025
f72eef2
Refactored DEPRECATION_MESSAGE to use an empty string when not needed
SommerEngineering Mar 23, 2025
7f09b51
Removed the no-longer necessary plugin path
SommerEngineering Mar 23, 2025
cacdb52
Added debug logging for plugin issues
SommerEngineering Mar 23, 2025
65b0a4a
Refactored nav item collection
SommerEngineering Mar 23, 2025
a5b5566
Consider mandatory internal plugins
SommerEngineering Mar 23, 2025
50a2420
Added a plugin page
SommerEngineering Mar 23, 2025
08a0ac9
Optimized nav item for plugin page
SommerEngineering Mar 23, 2025
ec31660
Added icon support for plugins
SommerEngineering Mar 25, 2025
6466908
Fixed the preview tooltip component not showing the correct position …
SommerEngineering Mar 25, 2025
3b0a35e
Added internal flag for plugins
SommerEngineering Mar 27, 2025
b91ffc3
Fixed warning
SommerEngineering Mar 27, 2025
12885a4
Refactored
SommerEngineering Mar 27, 2025
c99b231
Refactored action columns
SommerEngineering Mar 27, 2025
3f57207
Changed the plugin list to be a table
SommerEngineering Mar 27, 2025
73eab18
Fixed plugin table
SommerEngineering Mar 27, 2025
00742e6
Optimized table layout & spacing
SommerEngineering Mar 27, 2025
ac8ebe8
Optimized plugin icons
SommerEngineering Mar 27, 2025
ff6cc82
Moved icon to the top
SommerEngineering Mar 27, 2025
3deed7f
Made internal plugin detection secure
SommerEngineering Mar 27, 2025
d77a5ab
Syntax
SommerEngineering Mar 27, 2025
6cb4cad
Added switch to enable or disable a plugin
SommerEngineering Mar 27, 2025
91948e0
Added tooltip for enabling or disabling plugins
SommerEngineering Mar 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,20 @@ else
<HeaderContent>
<MudTh>Name</MudTh>
<MudTh>Type</MudTh>
<MudTh Style="text-align: left;">Actions</MudTh>
<MudTh>Actions</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.EmbeddingName</MudTd>
<MudTd>@context.EmbeddingType</MudTd>
<MudTd Style="text-align: left;">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditEmbedding(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteEmbedding(context)">
Delete
</MudButton>
<MudTd>
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditEmbedding(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteEmbedding(context)">
Delete
</MudButton>
</MudStack>
</MudTd>
</RowTemplate>
</MudTable>
Expand Down Expand Up @@ -274,17 +276,19 @@ else
</ColGroup>
<HeaderContent>
<MudTh>Name</MudTh>
<MudTh Style="text-align: left;">Actions</MudTh>
<MudTh>Actions</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Name</MudTd>
<MudTd Style="text-align: left;">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditRetrievalProcess(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteRetrievalProcess(context)">
Delete
</MudButton>
<MudTd>
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditRetrievalProcess(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteRetrievalProcess(context)">
Delete
</MudButton>
</MudStack>
</MudTd>
</RowTemplate>
</MudTable>
Expand Down
2 changes: 1 addition & 1 deletion app/MindWork AI Studio/Components/PreviewAlpha.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<MudTooltip Placement="Placement.Bottom" Arrow="@true" Class="@this.Classes">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.FirstPage" Color="Color.Error" Class="mb-3">
Alpha
Expand Down
8 changes: 7 additions & 1 deletion app/MindWork AI Studio/Components/PreviewAlpha.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

namespace AIStudio.Components;

public partial class PreviewAlpha : ComponentBase;
public partial class PreviewAlpha : ComponentBase
{
[Parameter]
public bool ApplyInnerScrollingFix { get; set; }

private string Classes => this.ApplyInnerScrollingFix ? "InnerScrollingFix" : string.Empty;
}
2 changes: 1 addition & 1 deletion app/MindWork AI Studio/Components/PreviewBeta.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<MudTooltip Placement="Placement.Bottom" Arrow="@true" Class="@this.Classes">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.HourglassTop" Color="Color.Info" Class="mb-3">
Beta
Expand Down
8 changes: 7 additions & 1 deletion app/MindWork AI Studio/Components/PreviewBeta.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

namespace AIStudio.Components;

public partial class PreviewBeta : ComponentBase;
public partial class PreviewBeta : ComponentBase
{
[Parameter]
public bool ApplyInnerScrollingFix { get; set; }

private string Classes => this.ApplyInnerScrollingFix ? "InnerScrollingFix" : string.Empty;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<MudTooltip Placement="Placement.Bottom" Arrow="@true" Class="@this.Classes">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.Science" Color="Color.Error" Class="mb-3">
Experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

namespace AIStudio.Components;

public partial class PreviewExperimental : ComponentBase;
public partial class PreviewExperimental : ComponentBase
{
[Parameter]
public bool ApplyInnerScrollingFix { get; set; }

private string Classes => this.ApplyInnerScrollingFix ? "InnerScrollingFix" : string.Empty;
}
2 changes: 1 addition & 1 deletion app/MindWork AI Studio/Components/PreviewPrototype.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<MudTooltip Placement="Placement.Bottom" Arrow="@true" Class="@this.Classes">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.HourglassBottom" Color="Color.Error" Class="mb-3">
Prototype
Expand Down
8 changes: 7 additions & 1 deletion app/MindWork AI Studio/Components/PreviewPrototype.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

namespace AIStudio.Components;

public partial class PreviewPrototype : ComponentBase;
public partial class PreviewPrototype : ComponentBase
{
[Parameter]
public bool ApplyInnerScrollingFix { get; set; }

private string Classes => this.ApplyInnerScrollingFix ? "InnerScrollingFix" : string.Empty;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<MudTooltip Placement="Placement.Bottom" Arrow="@true" Class="@this.Classes">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.VerifiedUser" Color="Color.Success" Class="mb-3">
Release Candidate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

namespace AIStudio.Components;

public partial class PreviewReleaseCandidate : ComponentBase;
public partial class PreviewReleaseCandidate : ComponentBase
{
[Parameter]
public bool ApplyInnerScrollingFix { get; set; }

private string Classes => this.ApplyInnerScrollingFix ? "InnerScrollingFix" : string.Empty;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,26 @@
<MudTh>Name</MudTh>
<MudTh>Provider</MudTh>
<MudTh>Model</MudTh>
<MudTh Style="text-align: left;">Actions</MudTh>
<MudTh>Actions</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Num</MudTd>
<MudTd>@context.Name</MudTd>
<MudTd>@context.UsedLLMProvider</MudTd>
<MudTd>@this.GetEmbeddingProviderModelName(context)</MudTd>

<MudTd Style="text-align: left;">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.OpenInBrowser" Class="ma-2" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())">
Open Dashboard
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditEmbeddingProvider(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteEmbeddingProvider(context)">
Delete
</MudButton>
<MudTd>
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())">
Open Dashboard
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditEmbeddingProvider(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteEmbeddingProvider(context)">
Delete
</MudButton>
</MudStack>
</MudTd>
</RowTemplate>
</MudTable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@
<HeaderContent>
<MudTh>#</MudTh>
<MudTh>Profile Name</MudTh>
<MudTh Style="text-align: left;">Actions</MudTh>
<MudTh>Actions</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Num</MudTd>
<MudTd>@context.Name</MudTd>
<MudTd Style="text-align: left;">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditProfile(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteProfile(context)">
Delete
</MudButton>
<MudTd>
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditProfile(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteProfile(context)">
Delete
</MudButton>
</MudStack>
</MudTd>
</RowTemplate>
</MudTable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<MudTh>Instance Name</MudTh>
<MudTh>Provider</MudTh>
<MudTh>Model</MudTh>
<MudTh Style="text-align: left;">Actions</MudTh>
<MudTh>Actions</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Num</MudTd>
Expand All @@ -44,16 +44,18 @@
@("as selected by provider")
}
</MudTd>
<MudTd Style="text-align: left;">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.OpenInBrowser" Class="ma-2" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())">
Open Dashboard
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditLLMProvider(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteLLMProvider(context)">
Delete
</MudButton>
<MudTd>
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())">
Open Dashboard
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditLLMProvider(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteLLMProvider(context)">
Delete
</MudButton>
</MudStack>
</MudTd>
</RowTemplate>
</MudTable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,24 @@
<MudTh>Name</MudTh>
<MudTh>Type</MudTh>
<MudTh>Embedding</MudTh>
<MudTh Style="text-align: left;">Actions</MudTh>
<MudTh>Actions</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Num</MudTd>
<MudTd>@context.Name</MudTd>
<MudTd>@context.Type.GetDisplayName()</MudTd>
<MudTd>@this.GetEmbeddingName(context)</MudTd>

<MudTd Style="text-align: left;">
<MudIconButton Variant="Variant.Filled" Color="Color.Info" Icon="@Icons.Material.Filled.Info" Class="ma-2" OnClick="() => this.ShowInformation(context)"/>
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditDataSource(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteDataSource(context)">
Delete
</MudButton>
<MudTd>
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
<MudIconButton Variant="Variant.Filled" Color="Color.Info" Icon="@Icons.Material.Filled.Info" OnClick="() => this.ShowInformation(context)"/>
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditDataSource(context)">
Edit
</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteDataSource(context)">
Delete
</MudButton>
</MudStack>
</MudTd>
</RowTemplate>
</MudTable>
Expand Down
62 changes: 33 additions & 29 deletions app/MindWork AI Studio/Layout/MainLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,19 @@ protected override async Task OnInitializedAsync()
// Ensure that all settings are loaded:
await this.SettingsManager.LoadSettings();

// Ensure that all internal plugins are present:
await PluginFactory.EnsureInternalPlugins();
//
// We cannot process the plugins before the settings are loaded,
// and we know our data directory.
//
if(PreviewFeatures.PRE_PLUGINS_2025.IsEnabled(this.SettingsManager))
{
// Ensure that all internal plugins are present:
await PluginFactory.EnsureInternalPlugins();

// Load (but not start) all plugins, without waiting for them:
var pluginLoadingTimeout = new CancellationTokenSource(TimeSpan.FromSeconds(5));
_ = PluginFactory.LoadAll(pluginLoadingTimeout.Token);
}

// Register this component with the message bus:
this.MessageBus.RegisterComponent(this);
Expand All @@ -106,33 +117,7 @@ protected override async Task OnInitializedAsync()

private void LoadNavItems()
{
var palette = this.ColorTheme.GetCurrentPalette(this.SettingsManager);
var isWriterModePreviewEnabled = PreviewFeatures.PRE_WRITER_MODE_2024.IsEnabled(this.SettingsManager);
if (!isWriterModePreviewEnabled)
{
this.navItems = new List<NavBarItem>
{
new("Home", Icons.Material.Filled.Home, palette.DarkLighten, palette.GrayLight, Routes.HOME, true),
new("Chat", Icons.Material.Filled.Chat, palette.DarkLighten, palette.GrayLight, Routes.CHAT, false),
new("Assistants", Icons.Material.Filled.Apps, palette.DarkLighten, palette.GrayLight, Routes.ASSISTANTS, false),
new("Supporters", Icons.Material.Filled.Favorite, palette.Error.Value, "#801a00", Routes.SUPPORTERS, false),
new("About", Icons.Material.Filled.Info, palette.DarkLighten, palette.GrayLight, Routes.ABOUT, false),
new("Settings", Icons.Material.Filled.Settings, palette.DarkLighten, palette.GrayLight, Routes.SETTINGS, false),
};
}
else
{
this.navItems = new List<NavBarItem>
{
new("Home", Icons.Material.Filled.Home, palette.DarkLighten, palette.GrayLight, Routes.HOME, true),
new("Chat", Icons.Material.Filled.Chat, palette.DarkLighten, palette.GrayLight, Routes.CHAT, false),
new("Assistants", Icons.Material.Filled.Apps, palette.DarkLighten, palette.GrayLight, Routes.ASSISTANTS, false),
new("Writer", Icons.Material.Filled.Create, palette.DarkLighten, palette.GrayLight, Routes.WRITER, false),
new("Supporters", Icons.Material.Filled.Favorite, palette.Error.Value, "#801a00", Routes.SUPPORTERS, false),
new("About", Icons.Material.Filled.Info, palette.DarkLighten, palette.GrayLight, Routes.ABOUT, false),
new("Settings", Icons.Material.Filled.Settings, palette.DarkLighten, palette.GrayLight, Routes.SETTINGS, false),
};
}
this.navItems = new List<NavBarItem>(this.GetNavItems());
}

#endregion
Expand Down Expand Up @@ -185,6 +170,25 @@ public async Task ProcessMessage<T>(ComponentBase? sendingComponent, Event trigg
}

#endregion

private IEnumerable<NavBarItem> GetNavItems()
{
var palette = this.ColorTheme.GetCurrentPalette(this.SettingsManager);

yield return new("Home", Icons.Material.Filled.Home, palette.DarkLighten, palette.GrayLight, Routes.HOME, true);
yield return new("Chat", Icons.Material.Filled.Chat, palette.DarkLighten, palette.GrayLight, Routes.CHAT, false);
yield return new("Assistants", Icons.Material.Filled.Apps, palette.DarkLighten, palette.GrayLight, Routes.ASSISTANTS, false);

if (PreviewFeatures.PRE_WRITER_MODE_2024.IsEnabled(this.SettingsManager))
yield return new("Writer", Icons.Material.Filled.Create, palette.DarkLighten, palette.GrayLight, Routes.WRITER, false);

if (PreviewFeatures.PRE_PLUGINS_2025.IsEnabled(this.SettingsManager))
yield return new("Plugins", Icons.Material.TwoTone.Extension, palette.DarkLighten, palette.GrayLight, Routes.PLUGINS, false);

yield return new("Supporters", Icons.Material.Filled.Favorite, palette.Error.Value, "#801a00", Routes.SUPPORTERS, false);
yield return new("About", Icons.Material.Filled.Info, palette.DarkLighten, palette.GrayLight, Routes.ABOUT, false);
yield return new("Settings", Icons.Material.Filled.Settings, palette.DarkLighten, palette.GrayLight, Routes.SETTINGS, false);
}

private async Task DismissUpdate()
{
Expand Down
Loading