mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 12:17:59 +00:00
Added detailed plugin information to the plugins page (#1013)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
b371b3d54f
commit
f912af321f
26 files changed
+884
-95
No files matched your search
@@ -1,6 +1,5 @@
|
||||
@using AIStudio.Tools.PluginSystem
|
||||
@using AIStudio.Tools.PluginSystem.Assistants
|
||||
@using AIStudio.Tools.Services
|
||||
@inherits MSGComponentBase
|
||||
@attribute [Route(Routes.PLUGINS)]
|
||||
|
||||
@@ -79,9 +78,20 @@
|
||||
</MudTd>
|
||||
<MudTd>
|
||||
<MudStack Spacing="0">
|
||||
<MudText Typo="Typo.h6" Class="mb-0 pb-0 gap-0">
|
||||
@context.Name
|
||||
</MudText>
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
|
||||
<MudText Typo="Typo.h6" Class="mb-0 pb-0 gap-0">
|
||||
@context.Name
|
||||
</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary ms-1">
|
||||
v@(context.Version)
|
||||
</MudText>
|
||||
@if (context is IAvailablePlugin { IsInternal: false } infoPlugin)
|
||||
{
|
||||
<MudTooltip Text="@T("Plugin information")">
|
||||
<MudIconButton Icon="@Icons.Material.Outlined.Info" Size="Size.Small" OnClick="@(() => this.ShowPluginInfoAsync(infoPlugin))"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
</MudStack>
|
||||
<MudText Typo="Typo.body1">
|
||||
@context.Description
|
||||
</MudText>
|
||||
@@ -106,26 +116,11 @@
|
||||
}
|
||||
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="0" Class="ms-3" Style="gap: 4px;">
|
||||
@if (context is { IsInternal: false } && !string.IsNullOrWhiteSpace(context.SourceURL))
|
||||
@if (context is { IsInternal: false })
|
||||
{
|
||||
var sourceUrl = context.SourceURL;
|
||||
var isSendingMail = IsSendingMail(sourceUrl);
|
||||
if (isSendingMail)
|
||||
{
|
||||
var isDefaultSupportContact = string.Equals(sourceUrl, AssistantPluginGenerationService.DEFAULT_SUPPORT_CONTACT, StringComparison.Ordinal);
|
||||
<MudTooltip Text="@(isDefaultSupportContact ? string.Empty : T("Send a mail"))">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Email" Href="@sourceUrl" Target="_blank" Size="Size.Medium" Disabled="@isDefaultSupportContact"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else
|
||||
{
|
||||
var isDefaultSourceUrl = string.Equals(sourceUrl, AssistantPluginGenerationService.DEFAULT_SOURCE_URL, StringComparison.Ordinal);
|
||||
<MudTooltip Text="@(isDefaultSourceUrl ? T("No source url available") : T("Open website"))">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.OpenInBrowser" Href="@sourceUrl" Target="_blank" Size="Size.Medium" Disabled="@isDefaultSourceUrl"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
<PluginLinkButton Url="@context.SourceURL" Size="Size.Medium"/>
|
||||
}
|
||||
|
||||
|
||||
@if (context is IAvailablePlugin editablePlugin && CanEditAssistantPlugin(editablePlugin))
|
||||
{
|
||||
<MudTooltip Text="@T("Edit assistant plugin")">
|
||||
|
||||
@@ -485,7 +485,16 @@ public partial class Plugins : MSGComponentBase
|
||||
await dialogReference.Result;
|
||||
}
|
||||
|
||||
private static bool IsSendingMail(string sourceUrl) => sourceUrl.TrimStart().StartsWith("mailto:", StringComparison.OrdinalIgnoreCase);
|
||||
private async Task ShowPluginInfoAsync(IAvailablePlugin plugin)
|
||||
{
|
||||
var dialogParameters = new DialogParameters<PluginInfoDialog>
|
||||
{
|
||||
{ x => x.Plugin, plugin },
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<PluginInfoDialog>(string.Format(this.T("Plugin information: {0}"), plugin.Name), dialogParameters, DialogOptions.FULLSCREEN);
|
||||
await dialogReference.Result;
|
||||
}
|
||||
|
||||
private PluginAssistants? TryGetAssistantPlugin(Guid pluginId) => PluginFactory.RunningPlugins.OfType<PluginAssistants>().FirstOrDefault(x => x.Id == pluginId);
|
||||
|
||||
|
||||
Reference in new issue
Block a user