diff --git a/app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs b/app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs new file mode 100644 index 0000000..334824b --- /dev/null +++ b/app/MindWork AI Studio/Components/Blocks/Changelog.Logs.cs @@ -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"), + + ]; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Blocks/Changelog.razor b/app/MindWork AI Studio/Components/Blocks/Changelog.razor new file mode 100644 index 0000000..1c75ce9 --- /dev/null +++ b/app/MindWork AI Studio/Components/Blocks/Changelog.razor @@ -0,0 +1,9 @@ +@using AIStudio.Tools + + @foreach (var log in LOGS) + { + + } + + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs b/app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs new file mode 100644 index 0000000..97631b7 --- /dev/null +++ b/app/MindWork AI Studio/Components/Blocks/Changelog.razor.cs @@ -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(); + } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Pages/About.razor b/app/MindWork AI Studio/Components/Pages/About.razor index f96e772..94c0756 100644 --- a/app/MindWork AI Studio/Components/Pages/About.razor +++ b/app/MindWork AI Studio/Components/Pages/About.razor @@ -19,6 +19,10 @@ + + + + diff --git a/app/MindWork AI Studio/Components/Pages/Home.razor b/app/MindWork AI Studio/Components/Pages/Home.razor index b44f1b2..3638f6b 100644 --- a/app/MindWork AI Studio/Components/Pages/Home.razor +++ b/app/MindWork AI Studio/Components/Pages/Home.razor @@ -25,6 +25,10 @@ + + + + diff --git a/app/MindWork AI Studio/Components/Pages/Home.razor.cs b/app/MindWork AI Studio/Components/Pages/Home.razor.cs index 34b5931..031c37d 100644 --- a/app/MindWork AI Studio/Components/Pages/Home.razor.cs +++ b/app/MindWork AI Studio/Components/Pages/Home.razor.cs @@ -6,6 +6,28 @@ namespace AIStudio.Components.Pages; 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 = [ new TextItem("Free of charge", "The app is free to use, both for personal and commercial purposes."), diff --git a/app/MindWork AI Studio/Program.cs b/app/MindWork AI Studio/Program.cs index 38d72dc..5d54b79 100644 --- a/app/MindWork AI Studio/Program.cs +++ b/app/MindWork AI Studio/Program.cs @@ -10,6 +10,7 @@ using System.Reflection; using Microsoft.Extensions.FileProviders; #endif +var port = args.Length > 0 ? args[0] : "5000"; var builder = WebApplication.CreateBuilder(); builder.Services.AddMudServices(config => { @@ -37,7 +38,11 @@ builder.Services.AddRazorComponents() 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}"); #if DEBUG diff --git a/app/MindWork AI Studio/build.nu b/app/MindWork AI Studio/build.nu index 2d6e2da..ae03587 100755 --- a/app/MindWork AI Studio/build.nu +++ b/app/MindWork AI Studio/build.nu @@ -31,6 +31,7 @@ def "main prepare" [action: string]: string -> nothing { main fix_web_assets inc_build_number update_build_time + update_changelog main metadata } } @@ -346,4 +347,35 @@ def update_project_commit_hash []: nothing -> nothing { $meta_lines.8 = $updated_commit_hash $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
(?Pv[0-9.]+)[,\s]+build\s+(?P[0-9]+)[,\s]+\((?P[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." } \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.1.0.md b/app/MindWork AI Studio/wwwroot/changelog/v0.1.0.md new file mode 100644 index 0000000..d332bf8 --- /dev/null +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.1.0.md @@ -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 \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.2.0.md b/app/MindWork AI Studio/wwwroot/changelog/v0.2.0.md new file mode 100644 index 0000000..43dd8f7 --- /dev/null +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.2.0.md @@ -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 \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.3.0.md b/app/MindWork AI Studio/wwwroot/changelog/v0.3.0.md new file mode 100644 index 0000000..ad1c33c --- /dev/null +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.3.0.md @@ -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 \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.4.0.md b/app/MindWork AI Studio/wwwroot/changelog/v0.4.0.md new file mode 100644 index 0000000..0073d80 --- /dev/null +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.4.0.md @@ -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 \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.5.0.md b/app/MindWork AI Studio/wwwroot/changelog/v0.5.0.md new file mode 100644 index 0000000..1a9ca99 --- /dev/null +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.5.0.md @@ -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 \ No newline at end of file diff --git a/metadata.txt b/metadata.txt index b3ec3ec..4b3dd64 100644 --- a/metadata.txt +++ b/metadata.txt @@ -1,9 +1,9 @@ 0.5.0 -2024-05-30 23:00:00 UTC -148 +2024-06-02 19:03:30 UTC +151 8.0.205 (commit 3e1383b780) 8.0.5 (commit 087e15321b) 1.78.0 (commit 9b00956e5) 6.19.1 1.6.1 -6b1b8ee52eb, dev debug +0c1e2a28ab9, dev testing