mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 02:57:59 +00:00
Added support for organization-managed introduction texts (#814)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (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, nsis) (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,updater, appimage) (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,app,updater, dmg) (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, nsis) (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,updater, appimage) (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 / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (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, nsis) (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,updater, appimage) (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,app,updater, dmg) (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, nsis) (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,updater, appimage) (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
e04879fd7f
commit
5045da3a91
15 files changed
+291
-27
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using AIStudio.Components;
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
@@ -18,13 +19,25 @@ public partial class Home : MSGComponentBase
|
||||
private string LastChangeContent { get; set; } = string.Empty;
|
||||
|
||||
private TextItem[] itemsAdvantages = [];
|
||||
|
||||
private List<DataIntroduction> introductions = [];
|
||||
|
||||
private string expandedPanelId = string.Empty;
|
||||
private int expansionPanelsRenderKey;
|
||||
|
||||
private const string PANEL_ID_BUILT_IN_INTRODUCTION = "built-in-introduction";
|
||||
private const string PANEL_ID_LAST_CHANGELOG = "last-changelog";
|
||||
private const string PANEL_ID_VISION = "vision";
|
||||
private const string PANEL_ID_QUICK_START_GUIDE = "quick-start-guide";
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
this.ApplyFilters([], [ Event.CONFIGURATION_CHANGED ]);
|
||||
await base.OnInitializedAsync();
|
||||
this.InitializeAdvantagesItems();
|
||||
this.RefreshIntroductionPanels();
|
||||
this.EnsureDefaultExpandedPanel();
|
||||
|
||||
// Read the last change content asynchronously
|
||||
// without blocking the UI thread:
|
||||
@@ -69,10 +82,14 @@ public partial class Home : MSGComponentBase
|
||||
{
|
||||
case Event.PLUGINS_RELOADED:
|
||||
this.InitializeAdvantagesItems();
|
||||
this.RefreshIntroductionPanels();
|
||||
this.EnsureDefaultExpandedPanel();
|
||||
await this.InvokeAsync(this.StateHasChanged);
|
||||
break;
|
||||
|
||||
case Event.CONFIGURATION_CHANGED:
|
||||
this.RefreshIntroductionPanels();
|
||||
this.EnsureDefaultExpandedPanel();
|
||||
await this.InvokeAsync(this.StateHasChanged);
|
||||
break;
|
||||
}
|
||||
@@ -80,6 +97,42 @@ public partial class Home : MSGComponentBase
|
||||
|
||||
#endregion
|
||||
|
||||
private void RefreshIntroductionPanels()
|
||||
{
|
||||
this.introductions = PluginFactory.GetIntroductions().ToList();
|
||||
}
|
||||
|
||||
private string GetDefaultExpandedPanelId()
|
||||
{
|
||||
if (this.SettingsManager.ConfigurationData.App.ShowIntroduction)
|
||||
return PANEL_ID_BUILT_IN_INTRODUCTION;
|
||||
|
||||
var firstIntroduction = this.introductions.FirstOrDefault();
|
||||
return firstIntroduction is not null
|
||||
? IntroductionPanelId(firstIntroduction)
|
||||
: PANEL_ID_LAST_CHANGELOG;
|
||||
}
|
||||
|
||||
private void EnsureDefaultExpandedPanel()
|
||||
{
|
||||
this.expandedPanelId = this.GetDefaultExpandedPanelId();
|
||||
this.expansionPanelsRenderKey++;
|
||||
}
|
||||
|
||||
private bool IsPanelExpanded(string panelId) => string.Equals(this.expandedPanelId, panelId, StringComparison.Ordinal);
|
||||
|
||||
private Task SetPanelExpanded(string panelId, bool isExpanded)
|
||||
{
|
||||
if (isExpanded)
|
||||
this.expandedPanelId = panelId;
|
||||
else if (this.IsPanelExpanded(panelId))
|
||||
this.expandedPanelId = string.Empty;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private static string IntroductionPanelId(DataIntroduction introduction) => $"introduction:{introduction.Id}";
|
||||
|
||||
private async Task ReadLastChangeAsync()
|
||||
{
|
||||
var latest = Changelog.LOGS.MaxBy(n => n.Build);
|
||||
|
||||
Reference in new issue
Block a user