mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 06:18:00 +00:00
Start the plugin system (#372)
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 }}) (-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 / Build app (linux-arm64) (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 }}) (-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 / Build app (linux-arm64) (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
This commit is contained in:
1 parent
3f8f399cd9
commit
b632854cd4
36 files changed
+705
-233
No files matched your search
@@ -0,0 +1,77 @@
|
||||
@using AIStudio.Tools.PluginSystem
|
||||
@attribute [Route(Routes.PLUGINS)]
|
||||
|
||||
<div class="inner-scrolling-context">
|
||||
<MudText Typo="Typo.h3" Class="mb-2">
|
||||
Plugins
|
||||
</MudText>
|
||||
<PreviewExperimental ApplyInnerScrollingFix="true"/>
|
||||
|
||||
<InnerScrolling>
|
||||
|
||||
<MudTable Items="@PluginFactory.AvailablePlugins" Hover="@true" GroupBy="@this.groupConfig" Class="border-dashed border rounded-lg">
|
||||
<ColGroup>
|
||||
<col style="width: 2em;" />
|
||||
<col style="width: 2.1em; "/>
|
||||
<col/>
|
||||
<col style="width: 12em;"/>
|
||||
</ColGroup>
|
||||
<HeaderContent>
|
||||
<MudTh colspan="2">Plugins</MudTh>
|
||||
<MudTh>Actions</MudTh>
|
||||
</HeaderContent>
|
||||
<GroupHeaderTemplate>
|
||||
<MudTh Class="mud-table-cell-custom-group" colspan="3">
|
||||
@switch (context.Key)
|
||||
{
|
||||
case GROUP_ENABLED:
|
||||
<MudText Typo="Typo.h6" Class="mb-2">
|
||||
Enabled Plugins
|
||||
</MudText>
|
||||
break;
|
||||
|
||||
case GROUP_DISABLED:
|
||||
<MudText Typo="Typo.h6" Class="mb-2">
|
||||
Disabled Plugins
|
||||
</MudText>
|
||||
break;
|
||||
|
||||
case GROUP_INTERNAL:
|
||||
<MudText Typo="Typo.h6" Class="mb-2">
|
||||
Internal Plugins
|
||||
</MudText>
|
||||
break;
|
||||
}
|
||||
</MudTh>
|
||||
</GroupHeaderTemplate>
|
||||
<RowTemplate>
|
||||
<MudTd>
|
||||
<MudAvatar Size="Size.Medium" Style="width: 2em; height: 2em;" Class="align-content-stretch">
|
||||
<div class="plugin-icon-container">
|
||||
@((MarkupString)context.IconSVG)
|
||||
</div>
|
||||
</MudAvatar>
|
||||
</MudTd>
|
||||
<MudTd>
|
||||
<MudStack Spacing="0">
|
||||
<MudText Typo="Typo.h6" Class="mb-0 pb-0 gap-0">
|
||||
@context.Name
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body1">
|
||||
@context.Description
|
||||
</MudText>
|
||||
</MudStack>
|
||||
</MudTd>
|
||||
<MudTd>
|
||||
@if (!context.IsInternal)
|
||||
{
|
||||
var isEnabled = this.SettingsManager.IsPluginEnabled(context);
|
||||
<MudTooltip Text="@(isEnabled ? "Disable plugin" : "Enable plugin")">
|
||||
<MudSwitch T="bool" Value="@isEnabled" ValueChanged="@(_ => this.PluginActivationStateChanged(context))"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
</InnerScrolling>
|
||||
</div>
|
||||
@@ -0,0 +1,56 @@
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Pages;
|
||||
|
||||
public partial class Plugins : ComponentBase
|
||||
{
|
||||
private const string GROUP_ENABLED = "Enabled";
|
||||
private const string GROUP_DISABLED = "Disabled";
|
||||
private const string GROUP_INTERNAL = "Internal";
|
||||
|
||||
[Inject]
|
||||
private MessageBus MessageBus { get; init; } = null!;
|
||||
|
||||
[Inject]
|
||||
private SettingsManager SettingsManager { get; init; } = null!;
|
||||
|
||||
private TableGroupDefinition<IPluginMetadata> groupConfig = null!;
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
this.groupConfig = new TableGroupDefinition<IPluginMetadata>
|
||||
{
|
||||
Expandable = true,
|
||||
IsInitiallyExpanded = true,
|
||||
Selector = pluginMeta =>
|
||||
{
|
||||
if (pluginMeta.IsInternal)
|
||||
return GROUP_INTERNAL;
|
||||
|
||||
return this.SettingsManager.IsPluginEnabled(pluginMeta)
|
||||
? GROUP_ENABLED
|
||||
: GROUP_DISABLED;
|
||||
}
|
||||
};
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async Task PluginActivationStateChanged(IPluginMetadata pluginMeta)
|
||||
{
|
||||
if (this.SettingsManager.IsPluginEnabled(pluginMeta))
|
||||
this.SettingsManager.ConfigurationData.EnabledPlugins.Remove(pluginMeta.Id);
|
||||
else
|
||||
this.SettingsManager.ConfigurationData.EnabledPlugins.Add(pluginMeta.Id);
|
||||
|
||||
await this.SettingsManager.StoreSettings();
|
||||
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,10 @@
|
||||
@inherits MSGComponentBase
|
||||
|
||||
<div class="inner-scrolling-context">
|
||||
<MudText Typo="Typo.h3" Class="mb-2 mr-3">
|
||||
<MudText Typo="Typo.h3" Class="mb-2">
|
||||
Writer
|
||||
</MudText>
|
||||
|
||||
<PreviewExperimental/>
|
||||
<PreviewExperimental ApplyInnerScrollingFix="true"/>
|
||||
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings"/>
|
||||
<InnerScrolling>
|
||||
|
||||
Reference in new issue
Block a user