mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 16:53:48 +00:00
Assistant send result (#75)
This commit is contained in:
1 parent
ea0ead58f8
commit
909fbe89bb
36 files changed
+400
-63
No files matched your search
@@ -1,4 +1,4 @@
|
||||
@page "/about"
|
||||
@attribute [Route(Path.ABOUT)]
|
||||
@using AIStudio.Tools
|
||||
|
||||
<MudText Typo="Typo.h3" Class="mb-2">About MindWork AI Studio</MudText>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/assistant/agenda"
|
||||
@attribute [Route(Path.ASSISTANT_AGENDA)]
|
||||
@using AIStudio.Tools
|
||||
@inherits AssistantBaseCore
|
||||
|
||||
|
||||
@@ -93,6 +93,14 @@ public partial class AssistantAgenda : AssistantBaseCore
|
||||
- Mary Jane: Work package 3
|
||||
""";
|
||||
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendToAssistant.AGENDA_ASSISTANT,
|
||||
},
|
||||
];
|
||||
|
||||
private string inputTopic = string.Empty;
|
||||
private string inputName = string.Empty;
|
||||
private string inputContent = string.Empty;
|
||||
@@ -145,6 +153,10 @@ public partial class AssistantAgenda : AssistantBaseCore
|
||||
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.Agenda.PreselectedProvider);
|
||||
}
|
||||
|
||||
var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_AGENDA_ASSISTANT).FirstOrDefault();
|
||||
if (deferredContent is not null)
|
||||
this.inputContent = deferredContent;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/assistants"
|
||||
@attribute [Route(Path.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="/assistant/summarizer"/>
|
||||
<AssistantBlock Name="Translation" Description="Translate text into another language." Icon="@Icons.Material.Filled.Translate" Link="/assistant/translation"/>
|
||||
<AssistantBlock Name="Grammar & Spelling" Description="Check grammar and spelling of a given text." Icon="@Icons.Material.Filled.Edit" Link="/assistant/grammar-spelling"/>
|
||||
<AssistantBlock Name="Rewrite & Improve" Description="Rewrite and improve a given text for a chosen style." Icon="@Icons.Material.Filled.Edit" Link="/assistant/rewrite-improve"/>
|
||||
<AssistantBlock Name="Text Summarizer" Description="Using a LLM to summarize a given text." Icon="@Icons.Material.Filled.TextSnippet" Link="@Path.ASSISTANT_SUMMARIZER"/>
|
||||
<AssistantBlock Name="Translation" Description="Translate text into another language." Icon="@Icons.Material.Filled.Translate" Link="@Path.ASSISTANT_TRANSLATION"/>
|
||||
<AssistantBlock Name="Grammar & Spelling" Description="Check grammar and spelling of a given text." Icon="@Icons.Material.Filled.Edit" Link="@Path.ASSISTANT_GRAMMAR_SPELLING"/>
|
||||
<AssistantBlock Name="Rewrite & Improve" Description="Rewrite and improve a given text for a chosen style." Icon="@Icons.Material.Filled.Edit" Link="@Path.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="/assistant/agenda"/>
|
||||
<AssistantBlock Name="Icon Finder" Description="Using a LLM to find an icon for a given context." Icon="@Icons.Material.Filled.FindInPage" Link="/assistant/icons"/>
|
||||
<AssistantBlock Name="Agenda Planner" Description="Generate an agenda for a given meeting, seminar, etc." Icon="@Icons.Material.Filled.CalendarToday" Link="@Path.ASSISTANT_AGENDA"/>
|
||||
<AssistantBlock Name="Icon Finder" Description="Using a LLM to find an icon for a given context." Icon="@Icons.Material.Filled.FindInPage" Link="@Path.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="/assistant/coding"/>
|
||||
<AssistantBlock Name="Coding" Description="Get coding and debugging support from a LLM." Icon="@Icons.Material.Filled.Code" Link="@Path.ASSISTANT_CODING"/>
|
||||
</MudStack>
|
||||
|
||||
</InnerScrolling>
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/chat"
|
||||
@attribute [Route(Path.CHAT)]
|
||||
@using AIStudio.Chat
|
||||
@using AIStudio.Settings.DataModel
|
||||
|
||||
|
||||
@@ -250,11 +250,11 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
||||
string chatPath;
|
||||
if (this.chatThread.WorkspaceId == Guid.Empty)
|
||||
{
|
||||
chatPath = Path.Join(SettingsManager.DataDirectory, "tempChats", this.chatThread.ChatId.ToString());
|
||||
chatPath = System.IO.Path.Join(SettingsManager.DataDirectory, "tempChats", this.chatThread.ChatId.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
chatPath = Path.Join(SettingsManager.DataDirectory, "workspaces", this.chatThread.WorkspaceId.ToString(), this.chatThread.ChatId.ToString());
|
||||
chatPath = System.IO.Path.Join(SettingsManager.DataDirectory, "workspaces", this.chatThread.WorkspaceId.ToString(), this.chatThread.ChatId.ToString());
|
||||
}
|
||||
|
||||
await this.workspaces.DeleteChat(chatPath, askForConfirmation: false, unloadChat: true);
|
||||
@@ -327,12 +327,12 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
||||
if (this.chatThread!.WorkspaceId == Guid.Empty)
|
||||
{
|
||||
// Case: The chat is stored in the temporary storage:
|
||||
await this.workspaces.DeleteChat(Path.Join(SettingsManager.DataDirectory, "tempChats", this.chatThread.ChatId.ToString()), askForConfirmation: false, unloadChat: false);
|
||||
await this.workspaces.DeleteChat(System.IO.Path.Join(SettingsManager.DataDirectory, "tempChats", this.chatThread.ChatId.ToString()), askForConfirmation: false, unloadChat: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case: The chat is stored in a workspace.
|
||||
await this.workspaces.DeleteChat(Path.Join(SettingsManager.DataDirectory, "workspaces", this.chatThread.WorkspaceId.ToString(), this.chatThread.ChatId.ToString()), askForConfirmation: false, unloadChat: false);
|
||||
await this.workspaces.DeleteChat(System.IO.Path.Join(SettingsManager.DataDirectory, "workspaces", this.chatThread.WorkspaceId.ToString(), this.chatThread.ChatId.ToString()), askForConfirmation: false, unloadChat: false);
|
||||
}
|
||||
|
||||
this.chatThread!.WorkspaceId = workspaceId;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/assistant/coding"
|
||||
@attribute [Route(Path.ASSISTANT_CODING)]
|
||||
@inherits AssistantBaseCore
|
||||
|
||||
<MudExpansionPanels Class="mb-3">
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Text;
|
||||
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Components.Pages.Coding;
|
||||
|
||||
public partial class AssistantCoding : AssistantBaseCore
|
||||
@@ -24,6 +26,14 @@ public partial class AssistantCoding : AssistantBaseCore
|
||||
When the user asks in a different language than English, you answer in the same language!
|
||||
""";
|
||||
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendToAssistant.CODING_ASSISTANT,
|
||||
},
|
||||
];
|
||||
|
||||
private readonly List<CodingContext> codingContexts = new();
|
||||
private bool provideCompilerMessages;
|
||||
private string compilerMessages = string.Empty;
|
||||
@@ -39,6 +49,10 @@ public partial class AssistantCoding : AssistantBaseCore
|
||||
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.Coding.PreselectedProvider);
|
||||
}
|
||||
|
||||
var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_CODING_ASSISTANT).FirstOrDefault();
|
||||
if (deferredContent is not null)
|
||||
this.questions = deferredContent;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
@using AIStudio.Tools
|
||||
@page "/assistant/grammar-spelling"
|
||||
@attribute [Route(Path.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"/>
|
||||
|
||||
+14
-4
@@ -25,11 +25,17 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore
|
||||
|
||||
protected override bool ShowDedicatedProgress => true;
|
||||
|
||||
protected override IReadOnlyList<ButtonData> FooterButtons => new[]
|
||||
{
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.correctedText)),
|
||||
};
|
||||
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendToAssistant.GRAMMAR_SPELLING_ASSISTANT,
|
||||
UseResultingContentBlockData = false,
|
||||
GetData = () => string.IsNullOrWhiteSpace(this.correctedText) ? this.inputText : this.correctedText
|
||||
},
|
||||
];
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -41,6 +47,10 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore
|
||||
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.GrammarSpelling.PreselectedProvider);
|
||||
}
|
||||
|
||||
var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_GRAMMAR_SPELLING_ASSISTANT).FirstOrDefault();
|
||||
if (deferredContent is not null)
|
||||
this.inputText = deferredContent;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/"
|
||||
@attribute [Route(Path.HOME)]
|
||||
@using AIStudio.Tools
|
||||
|
||||
<MudImage Src="svg/banner.svg" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/assistant/icons"
|
||||
@attribute [Route(Path.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"/>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Components.Pages.IconFinder;
|
||||
|
||||
public partial class AssistantIconFinder : AssistantBaseCore
|
||||
@@ -5,21 +7,6 @@ public partial class AssistantIconFinder : AssistantBaseCore
|
||||
private string inputContext = string.Empty;
|
||||
private IconSources selectedIconSource;
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (this.SettingsManager.ConfigurationData.IconFinder.PreselectOptions)
|
||||
{
|
||||
this.selectedIconSource = this.SettingsManager.ConfigurationData.IconFinder.PreselectedSource;
|
||||
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.IconFinder.PreselectedProvider);
|
||||
}
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override string Title => "Icon Finder";
|
||||
|
||||
protected override string Description =>
|
||||
@@ -40,7 +27,34 @@ public partial class AssistantIconFinder : AssistantBaseCore
|
||||
related to the keyword "buildings" might be the best match. Provide your keywords in a Markdown list without
|
||||
quotation marks.
|
||||
""";
|
||||
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendToAssistant.ICON_FINDER_ASSISTANT,
|
||||
},
|
||||
];
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (this.SettingsManager.ConfigurationData.IconFinder.PreselectOptions)
|
||||
{
|
||||
this.selectedIconSource = this.SettingsManager.ConfigurationData.IconFinder.PreselectedSource;
|
||||
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.IconFinder.PreselectedProvider);
|
||||
}
|
||||
|
||||
var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_ICON_FINDER_ASSISTANT).FirstOrDefault();
|
||||
if (deferredContent is not null)
|
||||
this.inputContext = deferredContent;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private string? ValidatingContext(string context)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(context))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace AIStudio.Components.Pages;
|
||||
|
||||
public static class Path
|
||||
{
|
||||
public const string HOME = "/";
|
||||
public const string CHAT = "/chat";
|
||||
public const string ABOUT = "/about";
|
||||
public const string ASSISTANTS = "/assistants";
|
||||
public const string SETTINGS = "/settings";
|
||||
public const string SUPPORTERS = "/supporters";
|
||||
|
||||
public const string ASSISTANT_TRANSLATION = "/assistant/translation";
|
||||
public const string ASSISTANT_REWRITE = "/assistant/rewrite-improve";
|
||||
public const string ASSISTANT_ICON_FINDER = "/assistant/icons";
|
||||
public const string ASSISTANT_GRAMMAR_SPELLING = "/assistant/grammar-spelling";
|
||||
public const string ASSISTANT_SUMMARIZER = "/assistant/summarizer";
|
||||
public const string ASSISTANT_CODING = "/assistant/coding";
|
||||
public const string ASSISTANT_AGENDA = "/assistant/agenda";
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
@using AIStudio.Tools
|
||||
@page "/assistant/rewrite-improve"
|
||||
@attribute [Route(Path.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"/>
|
||||
|
||||
+14
-8
@@ -24,17 +24,19 @@ public partial class AssistantRewriteImprove : AssistantBaseCore
|
||||
|
||||
protected override bool ShowResult => false;
|
||||
|
||||
#region Overrides of AssistantBase
|
||||
|
||||
protected override bool ShowDedicatedProgress => true;
|
||||
|
||||
#endregion
|
||||
|
||||
protected override IReadOnlyList<ButtonData> FooterButtons => new[]
|
||||
{
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.rewrittenText)),
|
||||
};
|
||||
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendToAssistant.REWRITE_ASSISTANT,
|
||||
UseResultingContentBlockData = false,
|
||||
GetData = () => string.IsNullOrWhiteSpace(this.rewrittenText) ? this.inputText : this.rewrittenText,
|
||||
},
|
||||
];
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -47,6 +49,10 @@ public partial class AssistantRewriteImprove : AssistantBaseCore
|
||||
this.selectedWritingStyle = this.SettingsManager.ConfigurationData.RewriteImprove.PreselectedWritingStyle;
|
||||
}
|
||||
|
||||
var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_REWRITE_ASSISTANT).FirstOrDefault();
|
||||
if (deferredContent is not null)
|
||||
this.inputText = deferredContent;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AIStudio.Components.Pages;
|
||||
|
||||
public enum SendToAssistant
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
GRAMMAR_SPELLING_ASSISTANT,
|
||||
ICON_FINDER_ASSISTANT,
|
||||
REWRITE_ASSISTANT,
|
||||
TRANSLATION_ASSISTANT,
|
||||
AGENDA_ASSISTANT,
|
||||
CODING_ASSISTANT,
|
||||
TEXT_SUMMARIZER_ASSISTANT,
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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 ...",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/settings"
|
||||
@attribute [Route(Path.SETTINGS)]
|
||||
@using AIStudio.Components.Pages.Coding
|
||||
@using AIStudio.Components.Pages.TextSummarizer
|
||||
@using AIStudio.Provider
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/Supporters"
|
||||
@attribute [Route(Path.SUPPORTERS)]
|
||||
|
||||
<MudText Typo="Typo.h3" Class="mb-2">Supporters</MudText>
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@page "/assistant/summarizer"
|
||||
@attribute [Route(Path.ASSISTANT_SUMMARIZER)]
|
||||
@using AIStudio.Tools
|
||||
@inherits AssistantBaseCore
|
||||
|
||||
|
||||
+12
@@ -23,6 +23,14 @@ public partial class AssistantTextSummarizer : AssistantBaseCore
|
||||
a summary with the requested complexity. In any case, do not add any information.
|
||||
""";
|
||||
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendToAssistant.TEXT_SUMMARIZER_ASSISTANT,
|
||||
},
|
||||
];
|
||||
|
||||
private string inputText = string.Empty;
|
||||
private bool isAgentRunning;
|
||||
private CommonLanguages selectedTargetLanguage;
|
||||
@@ -43,6 +51,10 @@ public partial class AssistantTextSummarizer : AssistantBaseCore
|
||||
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedProvider);
|
||||
}
|
||||
|
||||
var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_TEXT_SUMMARIZER_ASSISTANT).FirstOrDefault();
|
||||
if (deferredContent is not null)
|
||||
this.inputText = deferredContent;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/assistant/translation"
|
||||
@attribute [Route(Path.ASSISTANT_TRANSLATION)]
|
||||
@using AIStudio.Tools
|
||||
@inherits AssistantBaseCore
|
||||
|
||||
|
||||
@@ -19,6 +19,14 @@ public partial class AssistantTranslation : AssistantBaseCore
|
||||
language requires, e.g., shorter sentences, you should split the text into shorter sentences.
|
||||
""";
|
||||
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendToAssistant.TRANSLATION_ASSISTANT,
|
||||
},
|
||||
];
|
||||
|
||||
private bool liveTranslation;
|
||||
private bool isAgentRunning;
|
||||
private string inputText = string.Empty;
|
||||
@@ -38,6 +46,10 @@ public partial class AssistantTranslation : AssistantBaseCore
|
||||
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.Translation.PreselectedProvider);
|
||||
}
|
||||
|
||||
var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_TRANSLATION_ASSISTANT).FirstOrDefault();
|
||||
if (deferredContent is not null)
|
||||
this.inputText = deferredContent;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user