mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 20:27:21 +00:00
Fixed starting new chats from the workspace list and the chat toolbar (#1075)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
c2c07a4dd4
commit
0e18cbbc58
8 files changed
+112
-65
No files matched your search
@@ -62,7 +62,7 @@
|
||||
</MudStack>
|
||||
</HeaderContent>
|
||||
<ChildContent>
|
||||
<Workspaces @ref="this.workspaces" @bind-CurrentChatThread="@this.chatThread" @bind-SearchVisible="@this.workspaceSearchVisible"/>
|
||||
<Workspaces @ref="this.workspaces" @bind-CurrentChatThread="@this.chatThread" @bind-SearchVisible="@this.workspaceSearchVisible" StartNewChatRequested="@this.StartNewChatInWorkspace"/>
|
||||
</ChildContent>
|
||||
</InnerScrolling>
|
||||
}
|
||||
@@ -88,13 +88,14 @@
|
||||
</MudStack>
|
||||
</HeaderContent>
|
||||
<ChildContent>
|
||||
<Workspaces @ref="this.workspaces" @bind-CurrentChatThread="@this.chatThread" @bind-SearchVisible="@this.workspaceSearchVisible"/>
|
||||
<Workspaces @ref="this.workspaces" @bind-CurrentChatThread="@this.chatThread" @bind-SearchVisible="@this.workspaceSearchVisible" StartNewChatRequested="@this.StartNewChatInWorkspace"/>
|
||||
</ChildContent>
|
||||
</InnerScrolling>
|
||||
}
|
||||
</StartContent>
|
||||
<EndContent>
|
||||
<ChatComponent
|
||||
@ref="this.chatComponent"
|
||||
@bind-ChatThread="@this.chatThread"
|
||||
@bind-Provider="@this.providerSettings"
|
||||
IsAnswerBeingWrittenChanged="@(isBeingWritten => this.isAnswerBeingWritten = isBeingWritten)"
|
||||
@@ -123,6 +124,7 @@
|
||||
</MudPaper>
|
||||
|
||||
<ChatComponent
|
||||
@ref="this.chatComponent"
|
||||
@bind-ChatThread="@this.chatThread"
|
||||
@bind-Provider="@this.providerSettings"
|
||||
IsAnswerBeingWrittenChanged="@(isBeingWritten => this.isAnswerBeingWritten = isBeingWritten)"
|
||||
@@ -135,6 +137,7 @@
|
||||
{
|
||||
// Case: Workspaces are disabled or shown in an overlay
|
||||
<ChatComponent
|
||||
@ref="this.chatComponent"
|
||||
@bind-ChatThread="@this.chatThread"
|
||||
@bind-Provider="@this.providerSettings"
|
||||
IsAnswerBeingWrittenChanged="@(isBeingWritten => this.isAnswerBeingWritten = isBeingWritten)"
|
||||
@@ -167,7 +170,7 @@
|
||||
</MudStack>
|
||||
</MudDrawerHeader>
|
||||
<MudDrawerContainer Class="ml-6">
|
||||
<Workspaces @ref="this.workspaces" @bind-CurrentChatThread="@this.chatThread" @bind-SearchVisible="@this.workspaceSearchVisible"/>
|
||||
<Workspaces @ref="this.workspaces" @bind-CurrentChatThread="@this.chatThread" @bind-SearchVisible="@this.workspaceSearchVisible" StartNewChatRequested="@this.StartNewChatInWorkspace"/>
|
||||
</MudDrawerContainer>
|
||||
</MudDrawer>
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public partial class Chat : MSGComponentBase
|
||||
private bool workspaceSearchVisible;
|
||||
private string currentWorkspaceName = string.Empty;
|
||||
private Workspaces? workspaces;
|
||||
private ChatComponent? chatComponent;
|
||||
private double splitterPosition = 30;
|
||||
private bool skipRenderAfterSplitterChange;
|
||||
private readonly ChatComposerState composerState = new();
|
||||
@@ -167,6 +168,23 @@ public partial class Chat : MSGComponentBase
|
||||
await this.workspaces.ToggleSearchAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts a new chat in a workspace, when the workspace tree asks for one.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The page reads its reference to the chat component only now, when the user clicked. The chat
|
||||
/// component is created anew whenever the workspace sidebar is shown or hidden, so a reference
|
||||
/// taken earlier could point to one which is gone.
|
||||
/// </remarks>
|
||||
/// <param name="workspaceId">The ID of the workspace.</param>
|
||||
private async Task StartNewChatInWorkspace(Guid workspaceId)
|
||||
{
|
||||
if (this.chatComponent is null)
|
||||
return;
|
||||
|
||||
await this.chatComponent.StartNewChatInWorkspaceAsync(workspaceId);
|
||||
}
|
||||
|
||||
#region Overrides of MSGComponentBase
|
||||
|
||||
protected override void DisposeResources()
|
||||
|
||||
Reference in new issue
Block a user