Compare commits

..
5 Commits
145 changed files with 286 additions and 268 deletions

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
# MindWork AI Studio # MindWork AI Studio
![MindWork AI Studio](documentation/AI%20Studio.png) ![MindWork AI Studio - Home](documentation/AI%20Studio%20Home.png)
![MindWork AI Studio - Assistants](documentation/AI%20Studio%20Assistants.png)
MindWork AI Studio is a desktop application available for macOS, Windows, and Linux. It provides a unified chat interface for Large Language Models (LLMs). You bring your own API key for the respective LLM provider to use the models. The API keys are securely stored by the operating system. MindWork AI Studio is a desktop application available for macOS, Windows, and Linux. It provides a unified chat interface for Large Language Models (LLMs). You bring your own API key for the respective LLM provider to use the models. The API keys are securely stored by the operating system.
+30
View File
@@ -0,0 +1,30 @@
@using Microsoft.AspNetCore.Components.Web
@* ReSharper disable Html.PathError *@
<!DOCTYPE html>
<html lang="en">
<head>
<title>MindWork AI Studio</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<base href="/"/>
<link rel="icon" type="image/png" href="favicon.png"/>
<link href="system/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
<link href="system/MudBlazor.Markdown/MudBlazor.Markdown.min.css" rel="stylesheet" />
<link href="app.css" rel="stylesheet" />
<HeadOutlet/>
<script src="diff.js"></script>
</head>
<body style="overflow: hidden;">
<Routes @rendermode="new InteractiveServerRenderMode(prerender: false)"/>
<script src="_framework/blazor.web.js" autostart="false"></script>
<script src="boot.js"></script>
<script src="system/MudBlazor/MudBlazor.min.js"></script>
<script src="system/MudBlazor.Markdown/MudBlazor.Markdown.min.js"></script>
<script src="app.js"></script>
</body>
</html>
@@ -1,5 +1,4 @@
@attribute [Route(Path.ASSISTANT_AGENDA)] @attribute [Route(Routes.ASSISTANT_AGENDA)]
@using AIStudio.Tools
@inherits AssistantBaseCore @inherits AssistantBaseCore
<MudTextField T="string" @bind-Text="@this.inputName" Validation="@this.ValidateName" Label="Meeting Name" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Tag" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="Name the meeting, seminar, etc." Placeholder="Weekly jour fixe" Class="mb-3"/> <MudTextField T="string" @bind-Text="@this.inputName" Validation="@this.ValidateName" Label="Meeting Name" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Tag" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="Name the meeting, seminar, etc." Placeholder="Weekly jour fixe" Class="mb-3"/>
@@ -3,7 +3,7 @@ using System.Text;
using AIStudio.Chat; using AIStudio.Chat;
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.Agenda; namespace AIStudio.Assistants.Agenda;
public partial class AssistantAgenda : AssistantBaseCore public partial class AssistantAgenda : AssistantBaseCore
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.Agenda; namespace AIStudio.Assistants.Agenda;
public enum NumberParticipants public enum NumberParticipants
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.Agenda; namespace AIStudio.Assistants.Agenda;
public static class NumberParticipantsExtensions public static class NumberParticipantsExtensions
{ {
@@ -1,6 +1,5 @@
@using AIStudio.Chat @using AIStudio.Chat
@using AIStudio.Components.Pages
@using AIStudio.Tools
<MudText Typo="Typo.h3" Class="mb-2 mr-3"> <MudText Typo="Typo.h3" Class="mb-2 mr-3">
@(this.Title) @(this.Title)
</MudText> </MudText>
@@ -23,12 +22,14 @@
{ {
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mb-6" /> <MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mb-6" />
} }
<div id="@ASSISTANT_RESULT_DIV_ID" class="mr-2 mt-3">
@if (this.ShowResult && this.resultingContentBlock is not null) <div id="@RESULT_DIV_ID" class="mr-2 mt-3">
{
<ContentBlockComponent Role="@(this.resultingContentBlock.Role)" Type="@(this.resultingContentBlock.ContentType)" Time="@(this.resultingContentBlock.Time)" Content="@(this.resultingContentBlock.Content)"/>
}
</div> </div>
@if (this.ShowResult && this.resultingContentBlock is not null)
{
<ContentBlockComponent Role="@(this.resultingContentBlock.Role)" Type="@(this.resultingContentBlock.ContentType)" Time="@(this.resultingContentBlock.Time)" Content="@(this.resultingContentBlock.Content)"/>
}
<div id="@AFTER_RESULT_DIV_ID" class="mt-3"> <div id="@AFTER_RESULT_DIV_ID" class="mt-3">
</div> </div>
@@ -1,14 +1,11 @@
using AIStudio.Chat; using AIStudio.Chat;
using AIStudio.Components.Pages;
using AIStudio.Provider; using AIStudio.Provider;
using AIStudio.Settings; using AIStudio.Settings;
using AIStudio.Tools; using AIStudio.Tools;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Path = AIStudio.Components.Pages.Path; namespace AIStudio.Assistants;
namespace AIStudio.Components;
public abstract partial class AssistantBase : ComponentBase public abstract partial class AssistantBase : ComponentBase
{ {
@@ -31,7 +28,7 @@ public abstract partial class AssistantBase : ComponentBase
protected NavigationManager NavigationManager { get; init; } = null!; protected NavigationManager NavigationManager { get; init; } = null!;
internal const string AFTER_RESULT_DIV_ID = "afterAssistantResult"; internal const string AFTER_RESULT_DIV_ID = "afterAssistantResult";
internal const string ASSISTANT_RESULT_DIV_ID = "assistantResult"; internal const string RESULT_DIV_ID = "assistantResult";
protected abstract string Title { get; } protected abstract string Title { get; }
@@ -184,17 +181,17 @@ public abstract partial class AssistantBase : ComponentBase
var (eventItem, path) = destination switch var (eventItem, path) = destination switch
{ {
SendTo.AGENDA_ASSISTANT => (Event.SEND_TO_AGENDA_ASSISTANT, Path.ASSISTANT_AGENDA), SendTo.AGENDA_ASSISTANT => (Event.SEND_TO_AGENDA_ASSISTANT, Routes.ASSISTANT_AGENDA),
SendTo.CODING_ASSISTANT => (Event.SEND_TO_CODING_ASSISTANT, Path.ASSISTANT_CODING), SendTo.CODING_ASSISTANT => (Event.SEND_TO_CODING_ASSISTANT, Routes.ASSISTANT_CODING),
SendTo.REWRITE_ASSISTANT => (Event.SEND_TO_REWRITE_ASSISTANT, Path.ASSISTANT_REWRITE), SendTo.REWRITE_ASSISTANT => (Event.SEND_TO_REWRITE_ASSISTANT, Routes.ASSISTANT_REWRITE),
SendTo.TRANSLATION_ASSISTANT => (Event.SEND_TO_TRANSLATION_ASSISTANT, Path.ASSISTANT_TRANSLATION), SendTo.TRANSLATION_ASSISTANT => (Event.SEND_TO_TRANSLATION_ASSISTANT, Routes.ASSISTANT_TRANSLATION),
SendTo.ICON_FINDER_ASSISTANT => (Event.SEND_TO_ICON_FINDER_ASSISTANT, Path.ASSISTANT_ICON_FINDER), SendTo.ICON_FINDER_ASSISTANT => (Event.SEND_TO_ICON_FINDER_ASSISTANT, Routes.ASSISTANT_ICON_FINDER),
SendTo.GRAMMAR_SPELLING_ASSISTANT => (Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, Path.ASSISTANT_GRAMMAR_SPELLING), SendTo.GRAMMAR_SPELLING_ASSISTANT => (Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, Routes.ASSISTANT_GRAMMAR_SPELLING),
SendTo.TEXT_SUMMARIZER_ASSISTANT => (Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, Path.ASSISTANT_SUMMARIZER), SendTo.TEXT_SUMMARIZER_ASSISTANT => (Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, Routes.ASSISTANT_SUMMARIZER),
SendTo.CHAT => (Event.SEND_TO_CHAT, Path.CHAT), SendTo.CHAT => (Event.SEND_TO_CHAT, Routes.CHAT),
_ => (Event.NONE, Path.ASSISTANTS), _ => (Event.NONE, Routes.ASSISTANTS),
}; };
switch (destination) switch (destination)
@@ -217,7 +214,7 @@ public abstract partial class AssistantBase : ComponentBase
this.resultingContentBlock = null; this.resultingContentBlock = null;
this.providerSettings = default; this.providerSettings = default;
await this.JsRuntime.ClearDiv(ASSISTANT_RESULT_DIV_ID); await this.JsRuntime.ClearDiv(RESULT_DIV_ID);
await this.JsRuntime.ClearDiv(AFTER_RESULT_DIV_ID); await this.JsRuntime.ClearDiv(AFTER_RESULT_DIV_ID);
this.ResetFrom(); this.ResetFrom();
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering; using Microsoft.AspNetCore.Components.Rendering;
namespace AIStudio.Components; namespace AIStudio.Assistants;
// //
// See https://stackoverflow.com/a/77300384/2258393 for why this class is necessary // See https://stackoverflow.com/a/77300384/2258393 for why this class is necessary
@@ -1,4 +1,4 @@
@attribute [Route(Path.ASSISTANT_CODING)] @attribute [Route(Routes.ASSISTANT_CODING)]
@inherits AssistantBaseCore @inherits AssistantBaseCore
<MudExpansionPanels Class="mb-3"> <MudExpansionPanels Class="mb-3">
@@ -2,7 +2,7 @@
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.Coding; namespace AIStudio.Assistants.Coding;
public partial class AssistantCoding : AssistantBaseCore public partial class AssistantCoding : AssistantBaseCore
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.Coding; namespace AIStudio.Assistants.Coding;
public sealed class CodingContext(string id, CommonCodingLanguages language, string otherLanguage, string code) public sealed class CodingContext(string id, CommonCodingLanguages language, string otherLanguage, string code)
{ {
@@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Pages.Coding; namespace AIStudio.Assistants.Coding;
public partial class CodingContextItem : ComponentBase public partial class CodingContextItem : ComponentBase
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.Coding; namespace AIStudio.Assistants.Coding;
public static class CommonCodingLanguageExtensions public static class CommonCodingLanguageExtensions
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.Coding; namespace AIStudio.Assistants.Coding;
public enum CommonCodingLanguages public enum CommonCodingLanguages
{ {
@@ -1,5 +1,4 @@
@using AIStudio.Tools @attribute [Route(Routes.ASSISTANT_GRAMMAR_SPELLING)]
@attribute [Route(Path.ASSISTANT_GRAMMAR_SPELLING)]
@inherits AssistantBaseCore @inherits AssistantBaseCore
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidateText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="Your input to check" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/> <MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidateText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="Your input to check" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
@@ -1,7 +1,7 @@
using AIStudio.Chat; using AIStudio.Chat;
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.GrammarSpelling; namespace AIStudio.Assistants.GrammarSpelling;
public partial class AssistantGrammarSpelling : AssistantBaseCore public partial class AssistantGrammarSpelling : AssistantBaseCore
{ {
@@ -1,4 +1,4 @@
@attribute [Route(Path.ASSISTANT_ICON_FINDER)] @attribute [Route(Routes.ASSISTANT_ICON_FINDER)]
@inherits AssistantBaseCore @inherits AssistantBaseCore
<MudTextField T="string" @bind-Text="@this.inputContext" Validation="@this.ValidatingContext" AdornmentIcon="@Icons.Material.Filled.Description" Adornment="Adornment.Start" Label="Your context" Variant="Variant.Outlined" Lines="3" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/> <MudTextField T="string" @bind-Text="@this.inputContext" Validation="@this.ValidatingContext" AdornmentIcon="@Icons.Material.Filled.Description" Adornment="Adornment.Start" Label="Your context" Variant="Variant.Outlined" Lines="3" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
@@ -1,6 +1,6 @@
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.IconFinder; namespace AIStudio.Assistants.IconFinder;
public partial class AssistantIconFinder : AssistantBaseCore public partial class AssistantIconFinder : AssistantBaseCore
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.IconFinder; namespace AIStudio.Assistants.IconFinder;
public static class IconSourceExtensions public static class IconSourceExtensions
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.IconFinder; namespace AIStudio.Assistants.IconFinder;
public enum IconSources public enum IconSources
{ {
@@ -1,5 +1,4 @@
@using AIStudio.Tools @attribute [Route(Routes.ASSISTANT_REWRITE)]
@attribute [Route(Path.ASSISTANT_REWRITE)]
@inherits AssistantBaseCore @inherits AssistantBaseCore
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidateText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="Your input to improve" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/> <MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidateText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="Your input to improve" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
@@ -1,7 +1,7 @@
using AIStudio.Chat; using AIStudio.Chat;
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.RewriteImprove; namespace AIStudio.Assistants.RewriteImprove;
public partial class AssistantRewriteImprove : AssistantBaseCore public partial class AssistantRewriteImprove : AssistantBaseCore
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.RewriteImprove; namespace AIStudio.Assistants.RewriteImprove;
public enum WritingStyles public enum WritingStyles
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.RewriteImprove; namespace AIStudio.Assistants.RewriteImprove;
public static class WritingStylesExtensions public static class WritingStylesExtensions
{ {
@@ -1,5 +1,4 @@
@attribute [Route(Path.ASSISTANT_SUMMARIZER)] @attribute [Route(Routes.ASSISTANT_SUMMARIZER)]
@using AIStudio.Tools
@inherits AssistantBaseCore @inherits AssistantBaseCore
@if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader) @if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader)
@@ -1,7 +1,7 @@
using AIStudio.Chat; using AIStudio.Chat;
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.TextSummarizer; namespace AIStudio.Assistants.TextSummarizer;
public partial class AssistantTextSummarizer : AssistantBaseCore public partial class AssistantTextSummarizer : AssistantBaseCore
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.TextSummarizer; namespace AIStudio.Assistants.TextSummarizer;
public enum Complexity public enum Complexity
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Pages.TextSummarizer; namespace AIStudio.Assistants.TextSummarizer;
public static class ComplexityExtensions public static class ComplexityExtensions
{ {
@@ -1,5 +1,4 @@
@attribute [Route(Path.ASSISTANT_TRANSLATION)] @attribute [Route(Routes.ASSISTANT_TRANSLATION)]
@using AIStudio.Tools
@inherits AssistantBaseCore @inherits AssistantBaseCore
@if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader) @if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)
@@ -1,7 +1,7 @@
using AIStudio.Chat; using AIStudio.Chat;
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.Translation; namespace AIStudio.Assistants.Translation;
public partial class AssistantTranslation : AssistantBaseCore public partial class AssistantTranslation : AssistantBaseCore
{ {
@@ -0,0 +1,4 @@
@using AIStudio
@using AIStudio.Tools
@using AIStudio.Components
@using MudBlazor
@@ -1,28 +0,0 @@
@* ReSharper disable Html.PathError *@
<!DOCTYPE html>
<html lang="en">
<head>
<title>MindWork AI Studio</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<base href="/"/>
<link rel="icon" type="image/png" href="favicon.png"/>
<link href="system/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
<link href="system/MudBlazor.Markdown/MudBlazor.Markdown.min.css" rel="stylesheet" />
<link href="app.css" rel="stylesheet" />
<HeadOutlet/>
<script src="diff.js"></script>
</head>
<body style="overflow: hidden;">
<Routes @rendermode="new InteractiveServerRenderMode(prerender: false)"/>
<script src="_framework/blazor.web.js" autostart="false"></script>
<script src="boot.js"></script>
<script src="system/MudBlazor/MudBlazor.min.js"></script>
<script src="system/MudBlazor.Markdown/MudBlazor.Markdown.min.js"></script>
<script src="app.js"></script>
</body>
</html>
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class AssistantBlock : ComponentBase public partial class AssistantBlock : ComponentBase
{ {
@@ -1,3 +0,0 @@
namespace AIStudio.Components.Blocks;
public interface ITreeItem;
@@ -1,3 +0,0 @@
namespace AIStudio.Components.Blocks;
public readonly record struct TreeDivider : ITreeItem;
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class Changelog public partial class Changelog
{ {
@@ -13,6 +13,7 @@ public partial class Changelog
public static readonly Log[] LOGS = public static readonly Log[] LOGS =
[ [
new (173, "v0.8.11, build 173 (2024-08-21 07:03 UTC)", "v0.8.11.md"),
new (172, "v0.8.10, build 172 (2024-08-18 19:44 UTC)", "v0.8.10.md"), new (172, "v0.8.10, build 172 (2024-08-18 19:44 UTC)", "v0.8.10.md"),
new (171, "v0.8.9, build 171 (2024-08-18 10:35 UTC)", "v0.8.9.md"), new (171, "v0.8.9, build 171 (2024-08-18 10:35 UTC)", "v0.8.9.md"),
new (170, "v0.8.8, build 170 (2024-08-14 06:30 UTC)", "v0.8.8.md"), new (170, "v0.8.8, build 170 (2024-08-14 06:30 UTC)", "v0.8.8.md"),
@@ -1,4 +1,3 @@
@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()"> <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) @foreach (var log in LOGS)
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class Changelog : ComponentBase public partial class Changelog : ComponentBase
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
/// <summary> /// <summary>
/// Configuration component for any boolean option. /// Configuration component for any boolean option.
@@ -3,7 +3,7 @@ using AIStudio.Tools;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ConfigurationProviderSelection : ComponentBase, IMessageBusReceiver, IDisposable public partial class ConfigurationProviderSelection : ComponentBase, IMessageBusReceiver, IDisposable
{ {
@@ -2,7 +2,7 @@ using AIStudio.Settings;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
/// <summary> /// <summary>
/// Configuration component for selecting a value from a list. /// Configuration component for selecting a value from a list.
@@ -2,7 +2,7 @@ using System.Numerics;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ConfigurationSlider<T> : ConfigurationBase where T : struct, INumber<T> public partial class ConfigurationSlider<T> : ConfigurationBase where T : struct, INumber<T>
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ConfigurationText : ConfigurationBase public partial class ConfigurationText : ConfigurationBase
{ {
@@ -2,7 +2,7 @@ using AIStudio.Settings;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class EnumSelection<T> : EnumSelectionBase where T : struct, Enum public partial class EnumSelection<T> : EnumSelectionBase where T : struct, Enum
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public abstract class EnumSelectionBase : ComponentBase public abstract class EnumSelectionBase : ComponentBase
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ExpansionPanel : ComponentBase public partial class ExpansionPanel : ComponentBase
{ {
@@ -0,0 +1,3 @@
namespace AIStudio.Components;
public interface ITreeItem;
@@ -1,9 +1,9 @@
using AIStudio.Components.Layout; using AIStudio.Layout;
using AIStudio.Tools; using AIStudio.Tools;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class InnerScrolling : MSGComponentBase public partial class InnerScrolling : MSGComponentBase
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class Issues : ComponentBase public partial class Issues : ComponentBase
{ {
@@ -1,3 +0,0 @@
namespace AIStudio.Components.Layout;
public record NavBarItem(string Name, string Icon, Color IconColor, string Path, bool MatchAll);
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class Motivation : ComponentBase public partial class Motivation : ComponentBase
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class MudTextList : ComponentBase public partial class MudTextList : ComponentBase
{ {
@@ -2,7 +2,7 @@ using System.Numerics;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class MudTextSlider<T> : ComponentBase where T : struct, INumber<T> public partial class MudTextSlider<T> : ComponentBase where T : struct, INumber<T>
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class MudTextSwitch : ComponentBase public partial class MudTextSwitch : ComponentBase
{ {
@@ -1,5 +0,0 @@
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Pages;
public partial class Assistants : ComponentBase;
@@ -2,7 +2,7 @@ using AIStudio.Tools;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ProcessComponent<T> : ComponentBase where T : struct, Enum public partial class ProcessComponent<T> : ComponentBase where T : struct, Enum
{ {
@@ -2,7 +2,7 @@ using AIStudio.Settings;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ProviderSelection : ComponentBase public partial class ProviderSelection : ComponentBase
{ {
@@ -5,7 +5,7 @@ using AIStudio.Tools;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ReadWebContent : ComponentBase public partial class ReadWebContent : ComponentBase
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public enum ReadWebContentSteps public enum ReadWebContentSteps
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class SplitButton<T> : ComponentBase public partial class SplitButton<T> : ComponentBase
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class ThirdPartyComponent : ComponentBase public partial class ThirdPartyComponent : ComponentBase
{ {
@@ -1,3 +1,3 @@
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public readonly record struct TreeButton(WorkspaceBranch Branch, int Depth, string Text, string Icon, Func<Task> Action) : ITreeItem; public readonly record struct TreeButton(WorkspaceBranch Branch, int Depth, string Text, string Icon, Func<Task> Action) : ITreeItem;
@@ -0,0 +1,3 @@
namespace AIStudio.Components;
public readonly record struct TreeDivider : ITreeItem;
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public class TreeItemData : ITreeItem public class TreeItemData : ITreeItem
{ {
@@ -8,7 +8,7 @@ public class TreeItemData : ITreeItem
public string Text { get; init; } = string.Empty; public string Text { get; init; } = string.Empty;
public string ShortenedText => Text.Length > 30 ? this.Text[..30] + "..." : this.Text; public string ShortenedText => this.Text.Length > 30 ? this.Text[..30] + "..." : this.Text;
public string Icon { get; init; } = string.Empty; public string Icon { get; init; } = string.Empty;
@@ -18,5 +18,7 @@ public class TreeItemData : ITreeItem
public bool Expandable { get; init; } = true; public bool Expandable { get; init; } = true;
public DateTimeOffset LastEditTime { get; init; }
public IReadOnlyCollection<TreeItemData<ITreeItem>> Children { get; init; } = []; public IReadOnlyCollection<TreeItemData<ITreeItem>> Children { get; init; } = [];
} }
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public enum TreeItemType public enum TreeItemType
{ {
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class Vision : ComponentBase public partial class Vision : ComponentBase
{ {
@@ -1,4 +1,4 @@
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public enum WorkspaceBranch public enum WorkspaceBranch
{ {
@@ -3,15 +3,15 @@ using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using AIStudio.Chat; using AIStudio.Chat;
using AIStudio.Components.CommonDialogs; using AIStudio.Dialogs;
using AIStudio.Settings; using AIStudio.Settings;
using AIStudio.Tools; using AIStudio.Tools;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using DialogOptions = AIStudio.Components.CommonDialogs.DialogOptions; using DialogOptions = AIStudio.Dialogs.DialogOptions;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components;
public partial class Workspaces : ComponentBase public partial class Workspaces : ComponentBase
{ {
@@ -109,42 +109,44 @@ public partial class Workspaces : ComponentBase
private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadTemporaryChats() private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadTemporaryChats()
{ {
var tempChildren = new List<TreeItemData<ITreeItem>>(); var tempChildren = new List<TreeItemData>();
// // Get the temp root directory:
// Search for workspace folders in the data directory:
//
// Get the workspace root directory:
var temporaryDirectories = Path.Join(SettingsManager.DataDirectory, "tempChats"); var temporaryDirectories = Path.Join(SettingsManager.DataDirectory, "tempChats");
// Ensure the directory exists: // Ensure the directory exists:
Directory.CreateDirectory(temporaryDirectories); Directory.CreateDirectory(temporaryDirectories);
// Enumerate the workspace directories: // Enumerate the chat directories:
foreach (var tempChatDirPath in Directory.EnumerateDirectories(temporaryDirectories)) foreach (var tempChatDirPath in Directory.EnumerateDirectories(temporaryDirectories))
{ {
// Read the `name` file: // Read the `name` file:
var chatNamePath = Path.Join(tempChatDirPath, "name"); var chatNamePath = Path.Join(tempChatDirPath, "name");
var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8); var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8);
tempChildren.Add(new TreeItemData<ITreeItem> // Read the last change time of the chat:
var chatThreadPath = Path.Join(tempChatDirPath, "thread.json");
var lastEditTime = File.GetLastWriteTimeUtc(chatThreadPath);
tempChildren.Add(new TreeItemData
{ {
Type = TreeItemType.CHAT,
Depth = 1,
Branch = WorkspaceBranch.TEMPORARY_CHATS,
Text = chatName,
Icon = Icons.Material.Filled.Timer,
Expandable = false, Expandable = false,
Value = new TreeItemData Path = tempChatDirPath,
{ LastEditTime = lastEditTime,
Type = TreeItemType.CHAT,
Depth = 1,
Branch = WorkspaceBranch.TEMPORARY_CHATS,
Text = chatName,
Icon = Icons.Material.Filled.Timer,
Expandable = false,
Path = tempChatDirPath,
},
}); });
} }
return tempChildren; var result = new List<TreeItemData<ITreeItem>>(tempChildren.OrderByDescending(n => n.LastEditTime).Select(n => new TreeItemData<ITreeItem>
{
Expandable = false,
Value = n,
}));
return result;
} }
public async Task<string> LoadWorkspaceName(Guid workspaceId) public async Task<string> LoadWorkspaceName(Guid workspaceId)
@@ -205,7 +207,7 @@ public partial class Workspaces : ComponentBase
private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadWorkspaceChats(string workspacePath) private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadWorkspaceChats(string workspacePath)
{ {
var workspaceChats = new List<TreeItemData<ITreeItem>>(); var workspaceChats = new List<TreeItemData>();
// Enumerate the workspace directory: // Enumerate the workspace directory:
foreach (var chatPath in Directory.EnumerateDirectories(workspacePath)) foreach (var chatPath in Directory.EnumerateDirectories(workspacePath))
@@ -213,30 +215,37 @@ public partial class Workspaces : ComponentBase
// Read the `name` file: // Read the `name` file:
var chatNamePath = Path.Join(chatPath, "name"); var chatNamePath = Path.Join(chatPath, "name");
var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8); var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8);
// Read the last change time of the chat:
var chatThreadPath = Path.Join(chatPath, "thread.json");
var lastEditTime = File.GetLastWriteTimeUtc(chatThreadPath);
workspaceChats.Add(new TreeItemData<ITreeItem> workspaceChats.Add(new TreeItemData
{ {
Type = TreeItemType.CHAT,
Depth = 2,
Branch = WorkspaceBranch.WORKSPACES,
Text = chatName,
Icon = Icons.Material.Filled.Chat,
Expandable = false, Expandable = false,
Value = new TreeItemData Path = chatPath,
{ LastEditTime = lastEditTime,
Type = TreeItemType.CHAT,
Depth = 2,
Branch = WorkspaceBranch.WORKSPACES,
Text = chatName,
Icon = Icons.Material.Filled.Chat,
Expandable = false,
Path = chatPath,
},
}); });
} }
workspaceChats.Add(new TreeItemData<ITreeItem> var result = new List<TreeItemData<ITreeItem>>(workspaceChats.OrderByDescending(n => n.LastEditTime).Select(n => new TreeItemData<ITreeItem>
{
Expandable = false,
Value = n,
}));
result.Add(new()
{ {
Expandable = false, Expandable = false,
Value = new TreeButton(WorkspaceBranch.WORKSPACES, 2, "Add chat",Icons.Material.Filled.AddComment, () => this.AddChat(workspacePath)), Value = new TreeButton(WorkspaceBranch.WORKSPACES, 2, "Add chat",Icons.Material.Filled.AddComment, () => this.AddChat(workspacePath)),
}); });
return workspaceChats; return result;
} }
public async Task StoreChat(ChatThread chat) public async Task StoreChat(ChatThread chat)
@@ -1,12 +1,3 @@
@using System.Net.Http @using AIStudio
@using System.Net.Http.Json @using AIStudio.Tools
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using AIStudio
@using AIStudio.Components
@using AIStudio.Components.Blocks
@using MudBlazor @using MudBlazor
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.CommonDialogs; namespace AIStudio.Dialogs;
/// <summary> /// <summary>
/// A confirmation dialog that can be used to ask the user for confirmation. /// A confirmation dialog that can be used to ask the user for confirmation.
@@ -1,4 +1,4 @@
namespace AIStudio.Components.CommonDialogs; namespace AIStudio.Dialogs;
public static class DialogOptions public static class DialogOptions
{ {
@@ -2,7 +2,7 @@ using AIStudio.Settings;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.CommonDialogs; namespace AIStudio.Dialogs;
public partial class SingleInputDialog : ComponentBase public partial class SingleInputDialog : ComponentBase
{ {
@@ -1,4 +1,3 @@
@using AIStudio.Tools
<MudDialog> <MudDialog>
<DialogContent> <DialogContent>
<MudText Typo="Typo.h4" Class="d-inline-flex align-center"> <MudText Typo="Typo.h4" Class="d-inline-flex align-center">
@@ -4,7 +4,7 @@ using AIStudio.Tools;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.CommonDialogs; namespace AIStudio.Dialogs;
/// <summary> /// <summary>
/// The update dialog that is used to inform the user about an available update. /// The update dialog that is used to inform the user about an available update.
Loaded 100 of 145 files, more files were not shown because too many files have changed in this diff. Show more