diff --git a/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs b/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs index 229a6368..c6725c33 100644 --- a/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs +++ b/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs @@ -292,7 +292,17 @@ public partial class AssistantERI : AssistantBaseCore } } - protected override IReadOnlyList FooterButtons => []; + protected override IReadOnlyList FooterButtons => + [ + new ButtonData + { + Text = T("Open in chat"), + Icon = Icons.Material.Filled.Chat, + Color = Color.Default, + AsyncAction = this.OpenInChat, + DisabledActionParam = () => !this.CanOpenInChat, + }, + ]; protected override bool ShowEntireChatThread => true; @@ -308,6 +318,22 @@ public partial class AssistantERI : AssistantBaseCore { SystemPrompt = this.SystemPrompt, }; + + /// + /// Indicates whether the generated ERI conversation can be opened in the chat view. + /// + private bool CanOpenInChat => !this.IsProcessing && this.ChatThread is { Blocks.Count: > 0 }; + + /// + /// Opens the generated ERI conversation in the chat view when a finished conversation is available. + /// + private async Task OpenInChat() + { + if (!this.CanOpenInChat) + return; + + await this.SendToAssistant(Tools.Components.CHAT, default); + } protected override void ResetForm() { @@ -1241,6 +1267,5 @@ public partial class AssistantERI : AssistantBaseCore like Docker. """, true); await this.AddAIResponseAsync(time); - await this.SendToAssistant(Tools.Components.CHAT, default); } } \ No newline at end of file