Added initial logic for jumping between assistant and settings. Currently, it only jumps to the settings page and nothing is expanded.

This commit is contained in:
Peer Schütt committed 2025-03-07 19:18:23 +01:00
1 parent 4c1e3afb71
commit bd4c9f7173
47 files changed
+188 -37

No files matched your search

@@ -1,6 +1,7 @@
using System.Text;
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.Agenda;
@@ -101,6 +102,8 @@ public partial class AssistantAgenda : AssistantBaseCore
protected override Func<Task> SubmitAction => this.CreateAgenda;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_AGENDA_PANEL;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
@@ -12,15 +12,13 @@
<ChildContent>
<MudForm @ref="@(this.form)" @bind-IsValid="@(this.inputIsValid)" @bind-Errors="@(this.inputIssues)" FieldChanged="@this.TriggerFormChange" Class="pr-2">
<MudGrid Class="mb-2">
<MudItem xs="9">
<MudItem xs="10">
<MudText Typo="Typo.body1" Align="Align.Justify">
@this.Description
</MudText>
</MudItem>
<MudItem xs="3" Class="d-flex justify-end align-start">
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Settings">
Settings
</MudButton>
<MudItem xs="2" Class="d-flex justify-end align-start">
<MudIconButton Variant="Variant.Filled" Icon="@Icons.Material.Filled.Settings" OnClick="() => this.NavigateToSettings()"/>
</MudItem>
</MudGrid>
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
using AIStudio.Provider;
using AIStudio.Settings;
using AIStudio.Tools.Services;
@@ -68,6 +69,8 @@ public abstract partial class AssistantBase : ComponentBase, IMessageBusReceiver
protected abstract string SubmitText { get; }
protected abstract Func<Task> SubmitAction { get; }
protected abstract SettingsPanel SettingsPanel { get; }
protected virtual bool SubmitDisabled => false;
@@ -317,6 +320,12 @@ public abstract partial class AssistantBase : ComponentBase, IMessageBusReceiver
return icon;
}
protected void NavigateToSettings()
{
MessageBus.INSTANCE.DeferMessage(this, Event.SWITCH_TO_SETTINGS_PANEL, this.SettingsPanel);
this.NavigationManager.NavigateTo(Routes.SETTINGS);
}
protected Task SendToAssistant(Tools.Components destination, SendToButton sendToButton)
{
if (!destination.AllowSendTo())
@@ -1,6 +1,7 @@
using System.Text;
using AIStudio.Chat;
using AIStudio.Components.Settings;
using AIStudio.Settings.DataModel;
namespace AIStudio.Assistants.BiasDay;
@@ -44,6 +45,8 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore
protected override Func<Task> SubmitAction => this.TellBias;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_BIAS_OF_THE_DAY_PANEL;
protected override bool ShowSendTo => false;
protected override bool ShowCopyResult => false;
@@ -1,4 +1,5 @@
using System.Text;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.Coding;
@@ -31,7 +32,9 @@ public partial class AssistantCoding : AssistantBaseCore
protected override string SubmitText => "Get Support";
protected override Func<Task> SubmitAction => this.GetSupport;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_CODING_PANEL;
protected override void ResetForm()
{
this.codingContexts.Clear();
@@ -1,6 +1,7 @@
using System.Text;
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.EMail;
@@ -27,7 +28,9 @@ public partial class AssistantEMail : AssistantBaseCore
protected override string SubmitText => "Create email";
protected override Func<Task> SubmitAction => this.CreateMail;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_EMAIL_PANEL;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
@@ -2,6 +2,7 @@ using System.Text;
using System.Text.RegularExpressions;
using AIStudio.Chat;
using AIStudio.Components.Settings;
using AIStudio.Dialogs;
using AIStudio.Settings.DataModel;
@@ -306,6 +307,8 @@ public partial class AssistantERI : AssistantBaseCore
protected override Func<Task> SubmitAction => this.GenerateServer;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_ERI_SERVER_PANEL;
protected override bool SubmitDisabled => this.IsNoneERIServerSelected;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.GrammarSpelling;
@@ -42,7 +43,9 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore
protected override string SubmitText => "Proofread";
protected override Func<Task> SubmitAction => this.ProofreadText;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_GRAMMAR_SPELLING_PANEL;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
@@ -1,3 +1,5 @@
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.IconFinder;
public partial class AssistantIconFinder : AssistantBaseCore
@@ -33,6 +35,8 @@ public partial class AssistantIconFinder : AssistantBaseCore
protected override Func<Task> SubmitAction => this.FindIcon;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_ICON_FINDER_PANEL;
protected override void ResetForm()
{
this.inputContext = string.Empty;
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.JobPosting;
@@ -50,6 +51,8 @@ public partial class AssistantJobPostings : AssistantBaseCore
protected override Func<Task> SubmitAction => this.CreateJobPosting;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_JOB_POSTING_PANEL;
protected override bool SubmitDisabled => false;
protected override bool AllowProfiles => false;
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.LegalCheck;
@@ -29,7 +30,9 @@ public partial class AssistantLegalCheck : AssistantBaseCore
protected override string SubmitText => "Ask your questions";
protected override Func<Task> SubmitAction => this.AksQuestions;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_LEGAL_CHECK_PANEL;
protected override bool SubmitDisabled => this.isAgentRunning;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
using AIStudio.Settings;
namespace AIStudio.Assistants.MyTasks;
@@ -34,6 +35,8 @@ public partial class AssistantMyTasks : AssistantBaseCore
protected override Func<Task> SubmitAction => this.AnalyzeText;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_MY_TASKS_PANEL;
protected override bool ShowProfileSelection => false;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.RewriteImprove;
@@ -43,7 +44,9 @@ public partial class AssistantRewriteImprove : AssistantBaseCore
protected override string SubmitText => "Improve";
protected override Func<Task> SubmitAction => this.RewriteText;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_REWRITE_PANEL;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.Synonym;
@@ -54,7 +55,9 @@ public partial class AssistantSynonyms : AssistantBaseCore
protected override string SubmitText => "Find synonyms";
protected override Func<Task> SubmitAction => this.FindSynonyms;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_SYNONYMS_PANEL;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.TextSummarizer;
@@ -32,7 +33,9 @@ public partial class AssistantTextSummarizer : AssistantBaseCore
protected override string SubmitText => "Summarize";
protected override Func<Task> SubmitAction => this.SummarizeText;
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_TEXT_SUMMARIZER_PANEL;
protected override bool SubmitDisabled => this.isAgentRunning;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
@@ -1,4 +1,5 @@
using AIStudio.Chat;
using AIStudio.Components.Settings;
namespace AIStudio.Assistants.Translation;
@@ -28,7 +29,9 @@ public partial class AssistantTranslation : AssistantBaseCore
protected override string SubmitText => "Translate";
protected override Func<Task> SubmitAction => () => this.TranslateText(true);
protected override SettingsPanel SettingsPanel => SettingsPanel.ASSISTANT_TRANSLATION_PANEL;
protected override bool SubmitDisabled => this.isAgentRunning;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with