Merged PagePath into Routes

This commit is contained in:
Thorsten Sommer 2024-08-21 08:06:45 +02:00
parent 040e32b05b
commit 862de83b62
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
17 changed files with 41 additions and 39 deletions

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANT_AGENDA)]
@attribute [Route(Routes.ASSISTANT_AGENDA)]
@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"/>

View File

@ -181,17 +181,17 @@ public abstract partial class AssistantBase : ComponentBase
var (eventItem, path) = destination switch
{
SendTo.AGENDA_ASSISTANT => (Event.SEND_TO_AGENDA_ASSISTANT, PagePath.ASSISTANT_AGENDA),
SendTo.CODING_ASSISTANT => (Event.SEND_TO_CODING_ASSISTANT, PagePath.ASSISTANT_CODING),
SendTo.REWRITE_ASSISTANT => (Event.SEND_TO_REWRITE_ASSISTANT, PagePath.ASSISTANT_REWRITE),
SendTo.TRANSLATION_ASSISTANT => (Event.SEND_TO_TRANSLATION_ASSISTANT, PagePath.ASSISTANT_TRANSLATION),
SendTo.ICON_FINDER_ASSISTANT => (Event.SEND_TO_ICON_FINDER_ASSISTANT, PagePath.ASSISTANT_ICON_FINDER),
SendTo.GRAMMAR_SPELLING_ASSISTANT => (Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, PagePath.ASSISTANT_GRAMMAR_SPELLING),
SendTo.TEXT_SUMMARIZER_ASSISTANT => (Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, PagePath.ASSISTANT_SUMMARIZER),
SendTo.AGENDA_ASSISTANT => (Event.SEND_TO_AGENDA_ASSISTANT, Routes.ASSISTANT_AGENDA),
SendTo.CODING_ASSISTANT => (Event.SEND_TO_CODING_ASSISTANT, Routes.ASSISTANT_CODING),
SendTo.REWRITE_ASSISTANT => (Event.SEND_TO_REWRITE_ASSISTANT, Routes.ASSISTANT_REWRITE),
SendTo.TRANSLATION_ASSISTANT => (Event.SEND_TO_TRANSLATION_ASSISTANT, Routes.ASSISTANT_TRANSLATION),
SendTo.ICON_FINDER_ASSISTANT => (Event.SEND_TO_ICON_FINDER_ASSISTANT, Routes.ASSISTANT_ICON_FINDER),
SendTo.GRAMMAR_SPELLING_ASSISTANT => (Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, Routes.ASSISTANT_GRAMMAR_SPELLING),
SendTo.TEXT_SUMMARIZER_ASSISTANT => (Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, Routes.ASSISTANT_SUMMARIZER),
SendTo.CHAT => (Event.SEND_TO_CHAT, PagePath.CHAT),
SendTo.CHAT => (Event.SEND_TO_CHAT, Routes.CHAT),
_ => (Event.NONE, PagePath.ASSISTANTS),
_ => (Event.NONE, Routes.ASSISTANTS),
};
switch (destination)
@ -214,7 +214,7 @@ public abstract partial class AssistantBase : ComponentBase
this.resultingContentBlock = null;
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);
this.ResetFrom();

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANT_CODING)]
@attribute [Route(Routes.ASSISTANT_CODING)]
@inherits AssistantBaseCore
<MudExpansionPanels Class="mb-3">

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANT_GRAMMAR_SPELLING)]
@attribute [Route(Routes.ASSISTANT_GRAMMAR_SPELLING)]
@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"/>

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANT_ICON_FINDER)]
@attribute [Route(Routes.ASSISTANT_ICON_FINDER)]
@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"/>

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANT_REWRITE)]
@attribute [Route(Routes.ASSISTANT_REWRITE)]
@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"/>

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANT_SUMMARIZER)]
@attribute [Route(Routes.ASSISTANT_SUMMARIZER)]
@inherits AssistantBaseCore
@if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader)

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANT_TRANSLATION)]
@attribute [Route(Routes.ASSISTANT_TRANSLATION)]
@inherits AssistantBaseCore
@if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)

View File

@ -51,12 +51,12 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, IDis
private static readonly IReadOnlyCollection<NavBarItem> NAV_ITEMS = new List<NavBarItem>
{
new("Home", Icons.Material.Filled.Home, Color.Default, PagePath.HOME, true),
new("Chat", Icons.Material.Filled.Chat, Color.Default, PagePath.CHAT, false),
new("Assistants", Icons.Material.Filled.Apps, Color.Default, PagePath.ASSISTANTS, false),
new("Supporters", Icons.Material.Filled.Favorite, Color.Error, PagePath.SUPPORTERS, false),
new("About", Icons.Material.Filled.Info, Color.Default, PagePath.ABOUT, false),
new("Settings", Icons.Material.Filled.Settings, Color.Default, PagePath.SETTINGS, false),
new("Home", Icons.Material.Filled.Home, Color.Default, Routes.HOME, true),
new("Chat", Icons.Material.Filled.Chat, Color.Default, Routes.CHAT, false),
new("Assistants", Icons.Material.Filled.Apps, Color.Default, Routes.ASSISTANTS, false),
new("Supporters", Icons.Material.Filled.Favorite, Color.Error, Routes.SUPPORTERS, false),
new("About", Icons.Material.Filled.Info, Color.Default, Routes.ABOUT, false),
new("Settings", Icons.Material.Filled.Settings, Color.Default, Routes.SETTINGS, false),
};
#region Overrides of ComponentBase

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ABOUT)]
@attribute [Route(Routes.ABOUT)]
<MudText Typo="Typo.h3" Class="mb-2">About MindWork AI Studio</MudText>

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.ASSISTANTS)]
@attribute [Route(Routes.ASSISTANTS)]
<MudText Typo="Typo.h3" Class="mb-2 mr-3">
Assistants
@ -10,25 +10,25 @@
General
</MudText>
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
<AssistantBlock Name="Text Summarizer" Description="Using a LLM to summarize a given text." Icon="@Icons.Material.Filled.TextSnippet" Link="@PagePath.ASSISTANT_SUMMARIZER"/>
<AssistantBlock Name="Translation" Description="Translate text into another language." Icon="@Icons.Material.Filled.Translate" Link="@PagePath.ASSISTANT_TRANSLATION"/>
<AssistantBlock Name="Grammar & Spelling" Description="Check grammar and spelling of a given text." Icon="@Icons.Material.Filled.Edit" Link="@PagePath.ASSISTANT_GRAMMAR_SPELLING"/>
<AssistantBlock Name="Rewrite & Improve" Description="Rewrite and improve a given text for a chosen style." Icon="@Icons.Material.Filled.Edit" Link="@PagePath.ASSISTANT_REWRITE"/>
<AssistantBlock Name="Text Summarizer" Description="Using a LLM to summarize a given text." Icon="@Icons.Material.Filled.TextSnippet" Link="@Routes.ASSISTANT_SUMMARIZER"/>
<AssistantBlock Name="Translation" Description="Translate text into another language." Icon="@Icons.Material.Filled.Translate" Link="@Routes.ASSISTANT_TRANSLATION"/>
<AssistantBlock Name="Grammar & Spelling" Description="Check grammar and spelling of a given text." Icon="@Icons.Material.Filled.Edit" Link="@Routes.ASSISTANT_GRAMMAR_SPELLING"/>
<AssistantBlock Name="Rewrite & Improve" Description="Rewrite and improve a given text for a chosen style." Icon="@Icons.Material.Filled.Edit" Link="@Routes.ASSISTANT_REWRITE"/>
</MudStack>
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
Business
</MudText>
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
<AssistantBlock Name="Agenda Planner" Description="Generate an agenda for a given meeting, seminar, etc." Icon="@Icons.Material.Filled.CalendarToday" Link="@PagePath.ASSISTANT_AGENDA"/>
<AssistantBlock Name="Icon Finder" Description="Using a LLM to find an icon for a given context." Icon="@Icons.Material.Filled.FindInPage" Link="@PagePath.ASSISTANT_ICON_FINDER"/>
<AssistantBlock Name="Agenda Planner" Description="Generate an agenda for a given meeting, seminar, etc." Icon="@Icons.Material.Filled.CalendarToday" Link="@Routes.ASSISTANT_AGENDA"/>
<AssistantBlock Name="Icon Finder" Description="Using a LLM to find an icon for a given context." Icon="@Icons.Material.Filled.FindInPage" Link="@Routes.ASSISTANT_ICON_FINDER"/>
</MudStack>
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
Software Engineering
</MudText>
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
<AssistantBlock Name="Coding" Description="Get coding and debugging support from a LLM." Icon="@Icons.Material.Filled.Code" Link="@PagePath.ASSISTANT_CODING"/>
<AssistantBlock Name="Coding" Description="Get coding and debugging support from a LLM." Icon="@Icons.Material.Filled.Code" Link="@Routes.ASSISTANT_CODING"/>
</MudStack>
</InnerScrolling>

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.CHAT)]
@attribute [Route(Routes.CHAT)]
@using AIStudio.Chat
@using AIStudio.Settings.DataModel

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.HOME)]
@attribute [Route(Routes.HOME)]
<MudImage Src="svg/banner.svg" />
<MudText Typo="Typo.h3" Class="mt-2 mb-2">Let's get started</MudText>

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.SETTINGS)]
@attribute [Route(Routes.SETTINGS)]
@using AIStudio.Assistants.Coding
@using AIStudio.Assistants.TextSummarizer
@using AIStudio.Provider

View File

@ -1,4 +1,4 @@
@attribute [Route(PagePath.SUPPORTERS)]
@attribute [Route(Routes.SUPPORTERS)]
<MudText Typo="Typo.h3" Class="mb-2">Supporters</MudText>

View File

@ -1,6 +1,6 @@
namespace AIStudio;
public static class PagePath
public sealed partial class Routes
{
public const string HOME = "/";
public const string CHAT = "/chat";
@ -9,6 +9,7 @@ public static class PagePath
public const string SETTINGS = "/settings";
public const string SUPPORTERS = "/supporters";
// ReSharper disable InconsistentNaming
public const string ASSISTANT_TRANSLATION = "/assistant/translation";
public const string ASSISTANT_REWRITE = "/assistant/rewrite-improve";
public const string ASSISTANT_ICON_FINDER = "/assistant/icons";
@ -16,4 +17,5 @@ public static class PagePath
public const string ASSISTANT_SUMMARIZER = "/assistant/summarizer";
public const string ASSISTANT_CODING = "/assistant/coding";
public const string ASSISTANT_AGENDA = "/assistant/agenda";
}
// ReSharper restore InconsistentNaming
}

View File

@ -1,7 +1,7 @@
@using AIStudio.Components
@using AIStudio.Provider
@using AIStudio.Provider.SelfHosted
@using MudBlazor
@using AIStudio.Components
<MudDialog>
<DialogContent>