mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 17:19:47 +00:00
Renamed enum
This commit is contained in:
parent
8aeeda5dca
commit
9b925ac745
@ -56,9 +56,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<SendToAssistant>().OrderBy(n => n.Name().Length))
|
@foreach (var assistant in Enum.GetValues<SendTo>().OrderBy(n => n.Name().Length))
|
||||||
{
|
{
|
||||||
if(assistant is Pages.SendToAssistant.NONE || sendToButton.Self == assistant)
|
if(assistant is Pages.SendTo.NONE || sendToButton.Self == assistant)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)">
|
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)">
|
||||||
|
@ -164,7 +164,7 @@ public abstract partial class AssistantBase : ComponentBase
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task SendToAssistant(SendToAssistant assistant, SendToButton sendToButton)
|
private Task SendToAssistant(SendTo assistant, SendToButton sendToButton)
|
||||||
{
|
{
|
||||||
var contentToSend = sendToButton.UseResultingContentBlockData switch
|
var contentToSend = sendToButton.UseResultingContentBlockData switch
|
||||||
{
|
{
|
||||||
@ -178,13 +178,13 @@ public abstract partial class AssistantBase : ComponentBase
|
|||||||
|
|
||||||
var (eventItem, path) = assistant switch
|
var (eventItem, path) = assistant switch
|
||||||
{
|
{
|
||||||
Pages.SendToAssistant.AGENDA_ASSISTANT => (Event.SEND_TO_AGENDA_ASSISTANT, Path.ASSISTANT_AGENDA),
|
Pages.SendTo.AGENDA_ASSISTANT => (Event.SEND_TO_AGENDA_ASSISTANT, Path.ASSISTANT_AGENDA),
|
||||||
Pages.SendToAssistant.CODING_ASSISTANT => (Event.SEND_TO_CODING_ASSISTANT, Path.ASSISTANT_CODING),
|
Pages.SendTo.CODING_ASSISTANT => (Event.SEND_TO_CODING_ASSISTANT, Path.ASSISTANT_CODING),
|
||||||
Pages.SendToAssistant.REWRITE_ASSISTANT => (Event.SEND_TO_REWRITE_ASSISTANT, Path.ASSISTANT_REWRITE),
|
Pages.SendTo.REWRITE_ASSISTANT => (Event.SEND_TO_REWRITE_ASSISTANT, Path.ASSISTANT_REWRITE),
|
||||||
Pages.SendToAssistant.TRANSLATION_ASSISTANT => (Event.SEND_TO_TRANSLATION_ASSISTANT, Path.ASSISTANT_TRANSLATION),
|
Pages.SendTo.TRANSLATION_ASSISTANT => (Event.SEND_TO_TRANSLATION_ASSISTANT, Path.ASSISTANT_TRANSLATION),
|
||||||
Pages.SendToAssistant.ICON_FINDER_ASSISTANT => (Event.SEND_TO_ICON_FINDER_ASSISTANT, Path.ASSISTANT_ICON_FINDER),
|
Pages.SendTo.ICON_FINDER_ASSISTANT => (Event.SEND_TO_ICON_FINDER_ASSISTANT, Path.ASSISTANT_ICON_FINDER),
|
||||||
Pages.SendToAssistant.GRAMMAR_SPELLING_ASSISTANT => (Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, Path.ASSISTANT_GRAMMAR_SPELLING),
|
Pages.SendTo.GRAMMAR_SPELLING_ASSISTANT => (Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT, Path.ASSISTANT_GRAMMAR_SPELLING),
|
||||||
Pages.SendToAssistant.TEXT_SUMMARIZER_ASSISTANT => (Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, Path.ASSISTANT_SUMMARIZER),
|
Pages.SendTo.TEXT_SUMMARIZER_ASSISTANT => (Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT, Path.ASSISTANT_SUMMARIZER),
|
||||||
|
|
||||||
_ => (Event.NONE, Path.ASSISTANTS),
|
_ => (Event.NONE, Path.ASSISTANTS),
|
||||||
};
|
};
|
||||||
|
@ -97,7 +97,7 @@ public partial class AssistantAgenda : AssistantBaseCore
|
|||||||
[
|
[
|
||||||
new SendToButton
|
new SendToButton
|
||||||
{
|
{
|
||||||
Self = SendToAssistant.AGENDA_ASSISTANT,
|
Self = SendTo.AGENDA_ASSISTANT,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public partial class AssistantCoding : AssistantBaseCore
|
|||||||
[
|
[
|
||||||
new SendToButton
|
new SendToButton
|
||||||
{
|
{
|
||||||
Self = SendToAssistant.CODING_ASSISTANT,
|
Self = SendTo.CODING_ASSISTANT,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore
|
|||||||
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.correctedText)),
|
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.correctedText)),
|
||||||
new SendToButton
|
new SendToButton
|
||||||
{
|
{
|
||||||
Self = SendToAssistant.GRAMMAR_SPELLING_ASSISTANT,
|
Self = SendTo.GRAMMAR_SPELLING_ASSISTANT,
|
||||||
UseResultingContentBlockData = false,
|
UseResultingContentBlockData = false,
|
||||||
GetData = () => string.IsNullOrWhiteSpace(this.correctedText) ? this.inputText : this.correctedText
|
GetData = () => string.IsNullOrWhiteSpace(this.correctedText) ? this.inputText : this.correctedText
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,7 @@ public partial class AssistantIconFinder : AssistantBaseCore
|
|||||||
[
|
[
|
||||||
new SendToButton
|
new SendToButton
|
||||||
{
|
{
|
||||||
Self = SendToAssistant.ICON_FINDER_ASSISTANT,
|
Self = SendTo.ICON_FINDER_ASSISTANT,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public partial class AssistantRewriteImprove : AssistantBaseCore
|
|||||||
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.rewrittenText)),
|
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.rewrittenText)),
|
||||||
new SendToButton
|
new SendToButton
|
||||||
{
|
{
|
||||||
Self = SendToAssistant.REWRITE_ASSISTANT,
|
Self = SendTo.REWRITE_ASSISTANT,
|
||||||
UseResultingContentBlockData = false,
|
UseResultingContentBlockData = false,
|
||||||
GetData = () => string.IsNullOrWhiteSpace(this.rewrittenText) ? this.inputText : this.rewrittenText,
|
GetData = () => string.IsNullOrWhiteSpace(this.rewrittenText) ? this.inputText : this.rewrittenText,
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace AIStudio.Components.Pages;
|
namespace AIStudio.Components.Pages;
|
||||||
|
|
||||||
public enum SendToAssistant
|
public enum SendTo
|
||||||
{
|
{
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
namespace AIStudio.Components.Pages;
|
|
||||||
|
|
||||||
public static class SendToAssistantExtensions
|
|
||||||
{
|
|
||||||
public static string Name(this SendToAssistant assistant)
|
|
||||||
{
|
|
||||||
return assistant switch
|
|
||||||
{
|
|
||||||
SendToAssistant.GRAMMAR_SPELLING_ASSISTANT => "Grammar & Spelling Assistant",
|
|
||||||
SendToAssistant.TEXT_SUMMARIZER_ASSISTANT => "Text Summarizer Assistant",
|
|
||||||
SendToAssistant.ICON_FINDER_ASSISTANT => "Icon Finder Assistant",
|
|
||||||
SendToAssistant.TRANSLATION_ASSISTANT => "Translation Assistant",
|
|
||||||
SendToAssistant.REWRITE_ASSISTANT => "Rewrite Assistant",
|
|
||||||
SendToAssistant.AGENDA_ASSISTANT => "Agenda Assistant",
|
|
||||||
SendToAssistant.CODING_ASSISTANT => "Coding Assistant",
|
|
||||||
|
|
||||||
_ => "Send to ...",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
20
app/MindWork AI Studio/Components/Pages/SendToExtensions.cs
Normal file
20
app/MindWork AI Studio/Components/Pages/SendToExtensions.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace AIStudio.Components.Pages;
|
||||||
|
|
||||||
|
public static class SendToExtensions
|
||||||
|
{
|
||||||
|
public static string Name(this SendTo assistant)
|
||||||
|
{
|
||||||
|
return assistant switch
|
||||||
|
{
|
||||||
|
SendTo.GRAMMAR_SPELLING_ASSISTANT => "Grammar & Spelling Assistant",
|
||||||
|
SendTo.TEXT_SUMMARIZER_ASSISTANT => "Text Summarizer Assistant",
|
||||||
|
SendTo.ICON_FINDER_ASSISTANT => "Icon Finder Assistant",
|
||||||
|
SendTo.TRANSLATION_ASSISTANT => "Translation Assistant",
|
||||||
|
SendTo.REWRITE_ASSISTANT => "Rewrite Assistant",
|
||||||
|
SendTo.AGENDA_ASSISTANT => "Agenda Assistant",
|
||||||
|
SendTo.CODING_ASSISTANT => "Coding Assistant",
|
||||||
|
|
||||||
|
_ => "Send to ...",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -27,7 +27,7 @@ public partial class AssistantTextSummarizer : AssistantBaseCore
|
|||||||
[
|
[
|
||||||
new SendToButton
|
new SendToButton
|
||||||
{
|
{
|
||||||
Self = SendToAssistant.TEXT_SUMMARIZER_ASSISTANT,
|
Self = SendTo.TEXT_SUMMARIZER_ASSISTANT,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public partial class AssistantTranslation : AssistantBaseCore
|
|||||||
[
|
[
|
||||||
new SendToButton
|
new SendToButton
|
||||||
{
|
{
|
||||||
Self = SendToAssistant.TRANSLATION_ASSISTANT,
|
Self = SendTo.TRANSLATION_ASSISTANT,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@ public readonly record struct SendToButton() : IButtonData
|
|||||||
|
|
||||||
public bool UseResultingContentBlockData { get; init; } = true;
|
public bool UseResultingContentBlockData { get; init; } = true;
|
||||||
|
|
||||||
public SendToAssistant Self { get; init; } = SendToAssistant.NONE;
|
public SendTo Self { get; init; } = SendTo.NONE;
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user