Renamed enum

This commit is contained in:
Thorsten Sommer 2024-09-04 13:59:37 +02:00
parent 09c1b77414
commit 22ed3ef8be
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
14 changed files with 37 additions and 37 deletions

View File

@ -97,7 +97,7 @@ public partial class AssistantAgenda : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.AGENDA_ASSISTANT, Self = Tools.Components.AGENDA_ASSISTANT,
}, },
]; ];

View File

@ -58,9 +58,9 @@
case SendToButton sendToButton: case SendToButton sendToButton:
<MudMenu StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="Send to ..." Variant="Variant.Filled" Color="Color.Info"> <MudMenu StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="Send to ..." Variant="Variant.Filled" Color="Color.Info">
@foreach (var assistant in Enum.GetValues<SendTo>().OrderBy(n => n.Name().Length)) @foreach (var assistant in Enum.GetValues<Components>().OrderBy(n => n.Name().Length))
{ {
if(assistant is SendTo.NONE || sendToButton.Self == assistant) if(assistant is Components.NONE || sendToButton.Self == assistant)
continue; continue;
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)"> <MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)">

View File

@ -177,7 +177,7 @@ public abstract partial class AssistantBase : ComponentBase
return icon; return icon;
} }
private Task SendToAssistant(SendTo destination, SendToButton sendToButton) private Task SendToAssistant(Tools.Components destination, SendToButton sendToButton)
{ {
var contentToSend = sendToButton.UseResultingContentBlockData switch var contentToSend = sendToButton.UseResultingContentBlockData switch
{ {
@ -192,7 +192,7 @@ public abstract partial class AssistantBase : ComponentBase
var sendToData = destination.GetData(); var sendToData = destination.GetData();
switch (destination) switch (destination)
{ {
case SendTo.CHAT: case Tools.Components.CHAT:
MessageBus.INSTANCE.DeferMessage(this, sendToData.Event, this.ConvertToChatThread); MessageBus.INSTANCE.DeferMessage(this, sendToData.Event, this.ConvertToChatThread);
break; break;

View File

@ -28,7 +28,7 @@ public partial class AssistantCoding : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.CODING_ASSISTANT, Self = Tools.Components.CODING_ASSISTANT,
}, },
]; ];

View File

@ -24,7 +24,7 @@ public partial class AssistantEMail : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.EMAIL_ASSISTANT, Self = Tools.Components.EMAIL_ASSISTANT,
}, },
]; ];

View File

@ -31,7 +31,7 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.GRAMMAR_SPELLING_ASSISTANT, Self = Tools.Components.GRAMMAR_SPELLING_ASSISTANT,
UseResultingContentBlockData = false, UseResultingContentBlockData = false,
GetText = () => string.IsNullOrWhiteSpace(this.correctedText) ? this.inputText : this.correctedText GetText = () => string.IsNullOrWhiteSpace(this.correctedText) ? this.inputText : this.correctedText
}, },

View File

@ -30,7 +30,7 @@ public partial class AssistantIconFinder : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.ICON_FINDER_ASSISTANT, Self = Tools.Components.ICON_FINDER_ASSISTANT,
}, },
]; ];

View File

@ -24,7 +24,7 @@ public partial class AssistantLegalCheck : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.LEGAL_CHECK_ASSISTANT, Self = Tools.Components.LEGAL_CHECK_ASSISTANT,
}, },
]; ];

View File

@ -32,7 +32,7 @@ public partial class AssistantRewriteImprove : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.REWRITE_ASSISTANT, Self = Tools.Components.REWRITE_ASSISTANT,
UseResultingContentBlockData = false, UseResultingContentBlockData = false,
GetText = () => string.IsNullOrWhiteSpace(this.rewrittenText) ? this.inputText : this.rewrittenText, GetText = () => string.IsNullOrWhiteSpace(this.rewrittenText) ? this.inputText : this.rewrittenText,
}, },

View File

@ -27,7 +27,7 @@ public partial class AssistantTextSummarizer : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.TEXT_SUMMARIZER_ASSISTANT, Self = Tools.Components.TEXT_SUMMARIZER_ASSISTANT,
}, },
]; ];

View File

@ -23,7 +23,7 @@ public partial class AssistantTranslation : AssistantBaseCore
[ [
new SendToButton new SendToButton
{ {
Self = SendTo.TRANSLATION_ASSISTANT, Self = Tools.Components.TRANSLATION_ASSISTANT,
}, },
]; ];

View File

@ -1,6 +1,6 @@
namespace AIStudio.Tools; namespace AIStudio.Tools;
public enum SendTo public enum Components
{ {
NONE = 0, NONE = 0,

View File

@ -8,6 +8,6 @@ public readonly record struct SendToButton() : IButtonData
public bool UseResultingContentBlockData { get; init; } = true; public bool UseResultingContentBlockData { get; init; } = true;
public SendTo Self { get; init; } = SendTo.NONE; public Components Self { get; init; } = Components.NONE;
} }

View File

@ -2,36 +2,36 @@ namespace AIStudio.Tools;
public static class SendToExtensions public static class SendToExtensions
{ {
public static string Name(this SendTo assistant) => assistant switch public static string Name(this Components assistant) => assistant switch
{ {
SendTo.GRAMMAR_SPELLING_ASSISTANT => "Grammar & Spelling Assistant", Components.GRAMMAR_SPELLING_ASSISTANT => "Grammar & Spelling Assistant",
SendTo.TEXT_SUMMARIZER_ASSISTANT => "Text Summarizer Assistant", Components.TEXT_SUMMARIZER_ASSISTANT => "Text Summarizer Assistant",
SendTo.ICON_FINDER_ASSISTANT => "Icon Finder Assistant", Components.ICON_FINDER_ASSISTANT => "Icon Finder Assistant",
SendTo.TRANSLATION_ASSISTANT => "Translation Assistant", Components.TRANSLATION_ASSISTANT => "Translation Assistant",
SendTo.REWRITE_ASSISTANT => "Rewrite Assistant", Components.REWRITE_ASSISTANT => "Rewrite Assistant",
SendTo.AGENDA_ASSISTANT => "Agenda Assistant", Components.AGENDA_ASSISTANT => "Agenda Assistant",
SendTo.CODING_ASSISTANT => "Coding Assistant", Components.CODING_ASSISTANT => "Coding Assistant",
SendTo.EMAIL_ASSISTANT => "E-Mail Assistant", Components.EMAIL_ASSISTANT => "E-Mail Assistant",
SendTo.LEGAL_CHECK_ASSISTANT => "Legal Check Assistant", Components.LEGAL_CHECK_ASSISTANT => "Legal Check Assistant",
SendTo.CHAT => "New Chat", Components.CHAT => "New Chat",
_ => "Send to ...", _ => "Send to ...",
}; };
public static SendToData GetData(this SendTo destination) => destination switch public static SendToData GetData(this Components destination) => destination switch
{ {
SendTo.AGENDA_ASSISTANT => new(Event.SEND_TO_AGENDA_ASSISTANT, Routes.ASSISTANT_AGENDA), Components.AGENDA_ASSISTANT => new(Event.SEND_TO_AGENDA_ASSISTANT, Routes.ASSISTANT_AGENDA),
SendTo.CODING_ASSISTANT => new(Event.SEND_TO_CODING_ASSISTANT, Routes.ASSISTANT_CODING), Components.CODING_ASSISTANT => new(Event.SEND_TO_CODING_ASSISTANT, Routes.ASSISTANT_CODING),
SendTo.REWRITE_ASSISTANT => new(Event.SEND_TO_REWRITE_ASSISTANT, Routes.ASSISTANT_REWRITE), Components.REWRITE_ASSISTANT => new(Event.SEND_TO_REWRITE_ASSISTANT, Routes.ASSISTANT_REWRITE),
SendTo.EMAIL_ASSISTANT => new(Event.SEND_TO_EMAIL_ASSISTANT, Routes.ASSISTANT_EMAIL), Components.EMAIL_ASSISTANT => new(Event.SEND_TO_EMAIL_ASSISTANT, Routes.ASSISTANT_EMAIL),
SendTo.TRANSLATION_ASSISTANT => new(Event.SEND_TO_TRANSLATION_ASSISTANT, Routes.ASSISTANT_TRANSLATION), Components.TRANSLATION_ASSISTANT => new(Event.SEND_TO_TRANSLATION_ASSISTANT, Routes.ASSISTANT_TRANSLATION),
SendTo.ICON_FINDER_ASSISTANT => new(Event.SEND_TO_ICON_FINDER_ASSISTANT, Routes.ASSISTANT_ICON_FINDER), Components.ICON_FINDER_ASSISTANT => new(Event.SEND_TO_ICON_FINDER_ASSISTANT, Routes.ASSISTANT_ICON_FINDER),
SendTo.GRAMMAR_SPELLING_ASSISTANT => new(Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, Routes.ASSISTANT_GRAMMAR_SPELLING), Components.GRAMMAR_SPELLING_ASSISTANT => new(Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, Routes.ASSISTANT_GRAMMAR_SPELLING),
SendTo.TEXT_SUMMARIZER_ASSISTANT => new(Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, Routes.ASSISTANT_SUMMARIZER), Components.TEXT_SUMMARIZER_ASSISTANT => new(Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, Routes.ASSISTANT_SUMMARIZER),
SendTo.LEGAL_CHECK_ASSISTANT => new(Event.SEND_TO_LEGAL_CHECK_ASSISTANT, Routes.ASSISTANT_LEGAL_CHECK), Components.LEGAL_CHECK_ASSISTANT => new(Event.SEND_TO_LEGAL_CHECK_ASSISTANT, Routes.ASSISTANT_LEGAL_CHECK),
SendTo.CHAT => new(Event.SEND_TO_CHAT, Routes.CHAT), Components.CHAT => new(Event.SEND_TO_CHAT, Routes.CHAT),
_ => new(Event.NONE, Routes.ASSISTANTS), _ => new(Event.NONE, Routes.ASSISTANTS),
}; };