Merge branch '44-add-changelog' into 'main'

Resolve "Add changelog"

Closes #44

See merge request products/mindwork-ai-studio!15
This commit is contained in:
Thorsten 2024-06-02 19:09:03 +00:00
commit 84e1f35f72
14 changed files with 193 additions and 4 deletions

View File

@ -0,0 +1,23 @@
namespace AIStudio.Components.Blocks;
public partial class Changelog
{
public readonly record struct Log(int Build, string Display, string Filename)
{
#region Overrides of ValueType
public override string ToString() => this.Display;
#endregion
}
public static readonly Log[] LOGS =
[
new (149, "v0.5.0, build 149 (2024-06-02 18:51 UTC)", "v0.5.0.md"),
new (138, "v0.4.0, build 138 (2024-05-26 13:26 UTC)", "v0.4.0.md"),
new (120, "v0.3.0, build 120 (2024-05-18 21:57 UTC)", "v0.3.0.md"),
new (90, "v0.2.0, build 90 (2024-05-04 10:50 UTC)", "v0.2.0.md"),
new (45, "v0.1.0, build 45 (2024-04-20 21:27 UTC)", "v0.1.0.md"),
];
}

View File

@ -0,0 +1,9 @@
@using AIStudio.Tools
<MudSelect T="Log" @bind-Value="@this.SelectedLog" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Schedule" Margin="Margin.Dense" Label="Changelog" Class="mb-2 rounded-lg" Variant="Variant.Outlined" SelectedValuesChanged="() => this.ReadLogAsync()" OnKeyUp="() => this.ReadLogAsync()">
@foreach (var log in LOGS)
{
<MudSelectItem Value="@log"/>
}
</MudSelect>
<MudMarkdown Value="@this.LogContent" OverrideHeaderTypo="@Markdown.OverrideHeaderTypo"/>

View File

@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks;
public partial class Changelog : ComponentBase
{
[Inject]
private HttpClient HttpClient { get; set; } = null!;
#region Overrides of ComponentBase
protected override async Task OnInitializedAsync()
{
await this.ReadLogAsync();
await base.OnInitializedAsync();
}
#endregion
private Log SelectedLog { get; set; } = LOGS.MaxBy(n => n.Build);
private string LogContent { get; set; } = string.Empty;
private async Task ReadLogAsync()
{
var response = await this.HttpClient.GetAsync($"changelog/{this.SelectedLog.Filename}");
this.LogContent = await response.Content.ReadAsStringAsync();
}
}

View File

@ -19,6 +19,10 @@
<MudListItem Icon="@Icons.Material.Outlined.Memory" Text="@TauriVersion"/> <MudListItem Icon="@Icons.Material.Outlined.Memory" Text="@TauriVersion"/>
</MudList> </MudList>
</ExpansionPanel> </ExpansionPanel>
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.EventNote" HeaderText="Changelog">
<Changelog/>
</ExpansionPanel>
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Engineering" HeaderText="Motivation"> <ExpansionPanel HeaderIcon="@Icons.Material.Filled.Engineering" HeaderText="Motivation">
<Motivation/> <Motivation/>

View File

@ -25,6 +25,10 @@
</MudText> </MudText>
</ExpansionPanel> </ExpansionPanel>
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.EventNote" HeaderText="Last Changelog">
<MudMarkdown Value="@this.LastChangeContent" OverrideHeaderTypo="@Markdown.OverrideHeaderTypo"/>
</ExpansionPanel>
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Lightbulb" HeaderText="Vision"> <ExpansionPanel HeaderIcon="@Icons.Material.Filled.Lightbulb" HeaderText="Vision">
<Vision/> <Vision/>
</ExpansionPanel> </ExpansionPanel>

View File

@ -6,6 +6,28 @@ namespace AIStudio.Components.Pages;
public partial class Home : ComponentBase public partial class Home : ComponentBase
{ {
[Inject]
private HttpClient HttpClient { get; set; } = null!;
private string LastChangeContent { get; set; } = string.Empty;
#region Overrides of ComponentBase
protected override async Task OnInitializedAsync()
{
await this.ReadLastChangeAsync();
await base.OnInitializedAsync();
}
#endregion
private async Task ReadLastChangeAsync()
{
var latest = Changelog.LOGS.MaxBy(n => n.Build);
var response = await this.HttpClient.GetAsync($"changelog/{latest.Filename}");
this.LastChangeContent = await response.Content.ReadAsStringAsync();
}
private static readonly TextItem[] ITEMS_ADVANTAGES = private static readonly TextItem[] ITEMS_ADVANTAGES =
[ [
new TextItem("Free of charge", "The app is free to use, both for personal and commercial purposes."), new TextItem("Free of charge", "The app is free to use, both for personal and commercial purposes."),

View File

@ -10,6 +10,7 @@ using System.Reflection;
using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders;
#endif #endif
var port = args.Length > 0 ? args[0] : "5000";
var builder = WebApplication.CreateBuilder(); var builder = WebApplication.CreateBuilder();
builder.Services.AddMudServices(config => builder.Services.AddMudServices(config =>
{ {
@ -37,7 +38,11 @@ builder.Services.AddRazorComponents()
options.HandshakeTimeout = TimeSpan.FromSeconds(30); options.HandshakeTimeout = TimeSpan.FromSeconds(30);
}); });
var port = args.Length > 0 ? args[0] : "5000"; builder.Services.AddSingleton(new HttpClient
{
BaseAddress = new Uri($"http://localhost:{port}")
});
builder.WebHost.UseUrls($"http://localhost:{port}"); builder.WebHost.UseUrls($"http://localhost:{port}");
#if DEBUG #if DEBUG

View File

@ -31,6 +31,7 @@ def "main prepare" [action: string]: string -> nothing {
main fix_web_assets main fix_web_assets
inc_build_number inc_build_number
update_build_time update_build_time
update_changelog
main metadata main metadata
} }
} }
@ -346,4 +347,35 @@ def update_project_commit_hash []: nothing -> nothing {
$meta_lines.8 = $updated_commit_hash $meta_lines.8 = $updated_commit_hash
$meta_lines | save --raw --force ../../metadata.txt $meta_lines | save --raw --force ../../metadata.txt
}
def update_changelog []: nothing -> nothing {
# Get all changelog files:
let all_changelog_files = glob wwwroot/changelog/*.md
# Create a table with the build numbers and the corresponding file names:
let table = $all_changelog_files | reduce --fold [] { |it, acc|
let header_line = open --raw $it | lines | first
let file_name = $it | path basename
let header_data = $header_line | parse --regex '#\s+(?P<header>(?P<version>v[0-9.]+)[,\s]+build\s+(?P<build_num>[0-9]+)[,\s]+\((?P<build_time>[0-9-?\s:UTC]+)\))'
$acc ++ [[build_num, file_name, header]; [$header_data.build_num.0, $file_name, $header_data.header.0]]
} | sort-by build_num --natural --reverse
# Now, we build the necessary C# code:
const tab = " "; # using 4 spaces as one tab
let code_rows = $table | reduce --fold "" { |it, acc|
$acc ++ $"($tab)($tab)new \(($it.build_num), \"($it.header)\", \"($it.file_name)\"\),\n"
}
let code = ($"LOGS = \n($tab)[\n($code_rows)\n($tab)];")
# Next, update the Changelog.Logs.cs file:
let changelog_logs_source_file = open --raw "Components/Blocks/Changelog.Logs.cs"
let result = $changelog_logs_source_file | str replace --regex '(?ms)LOGS =\s+\[[\w\s".,-:()?]+\];' $code
# Save the updated file:
$result | save --raw --force "Components/Blocks/Changelog.Logs.cs"
let number_change_logs = $table | length
print $"Updated Changelog.Logs.cs with ($number_change_logs) change logs."
} }

View File

@ -0,0 +1,8 @@
# v0.1.0, build 45 (2024-04-20 21:27 UTC)
- Initial release
- Set up the project structure
- Integration of Tauri
- Integration of MudBlazor
- Added commands to read & store secrets using the operating system secure storage
- Added settings manager to handle application settings
- Added settings page

View File

@ -0,0 +1,11 @@
# v0.2.0, build 90 (2024-05-04 10:50 UTC)
- Improved layout
- Added the chat page
- Added simple content block handling
- Added instance name validation to the settings
- Added a confirmation dialog
- Added clipboard handling
- Added setting to save energy (slow chat streaming)
- Added OpenAI provider
- Finished provider & data model
- Integration of MudBlazor.Markdown to render markdown content

View File

@ -0,0 +1,11 @@
# v0.3.0, build 120 (2024-05-18 21:57 UTC)
- Added a cross-platform build script using NuShell
- Added static file embedding
- Added MudBlazor fonts to the static file embedding
- Added option to specify the used port for the server
- Added cross-platform .NET compiling & publishing using expected names, considering Tauri sidecar integration
- Added app loading screen
- Added sidecar integration of Tauri to embed the .NET client and server
- Added logging to the Rust runtime
- Added system message handling between Rust and .NET
- Fixed layout issue on Windows

View File

@ -0,0 +1,11 @@
# v0.4.0, build 138 (2024-05-26 13:26 UTC)
- Added possibility to choose & change the AI model
- Added tooltips to the navigation
- Added metadata to the build process
- Added consistent build & version numbers
- Added logging of the metadata
- Added about page & show metadata
- Added the FSL-MIT license
- Added README file
- Fixed link handling; links are now opened by the system's default browser
- Fixed Markdown header styling

View File

@ -0,0 +1,20 @@
# v0.5.0, build 149 (2024-06-02 18:51 UTC)
- Designed a banner for the start page
- Added the start page
- Added a text list component
- Added introduction content
- Added a vision statement
- Added the motivation behind the project
- Added a quick start guide
- Added a supporter page
- Added settings to enable or disable the spell checker
- Added ability to remember the last window position & size
- Added a changelog component & changelogs
- Fixed scrolling issue on all pages
- Fixed build script due to breaking change in the next NuShell release
- Fixed reconnection issue after a device was on sleep
- Fixed navigation icon highlighting
- Unified about page content into expansion panels
- Updated the README file to match the GitHub sponsors
- Refactored the inner scrolling technique into its own component
- Refactored the customized expansion panel into its own component

View File

@ -1,9 +1,9 @@
0.5.0 0.5.0
2024-05-30 23:00:00 UTC 2024-06-02 19:03:30 UTC
148 151
8.0.205 (commit 3e1383b780) 8.0.205 (commit 3e1383b780)
8.0.5 (commit 087e15321b) 8.0.5 (commit 087e15321b)
1.78.0 (commit 9b00956e5) 1.78.0 (commit 9b00956e5)
6.19.1 6.19.1
1.6.1 1.6.1
6b1b8ee52eb, dev debug 0c1e2a28ab9, dev testing