Fixed chat loading by assistants (#256)

This commit is contained in:
Thorsten Sommer 2025-01-04 19:27:45 +01:00 committed by GitHub
parent e9975a5fbc
commit e4b1ea32fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -76,6 +76,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
if (deferredContent is not null) if (deferredContent is not null)
{ {
this.ChatThread = deferredContent; this.ChatThread = deferredContent;
this.Logger.LogInformation($"The chat '{this.ChatThread.Name}' with {this.ChatThread.Blocks.Count} messages was deferred and will be rendered now.");
await this.ChatThreadChanged.InvokeAsync(this.ChatThread); await this.ChatThreadChanged.InvokeAsync(this.ChatThread);
if (this.ChatThread is not null) if (this.ChatThread is not null)
@ -120,6 +121,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
{ {
this.loadChat = deferredLoading; this.loadChat = deferredLoading;
this.mustLoadChat = true; this.mustLoadChat = true;
this.Logger.LogInformation($"The loading of the chat '{this.loadChat.ChatId}' was deferred and will be loaded now.");
} }
await this.SelectProviderWhenLoadingChat(); await this.SelectProviderWhenLoadingChat();
@ -144,18 +146,23 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
if (firstRender && this.mustLoadChat) if (firstRender && this.mustLoadChat)
{ {
this.Logger.LogInformation($"Try to load the chat '{this.loadChat.ChatId}' now.");
this.mustLoadChat = false; this.mustLoadChat = false;
this.ChatThread = await WorkspaceBehaviour.LoadChat(this.loadChat); this.ChatThread = await WorkspaceBehaviour.LoadChat(this.loadChat);
if(this.ChatThread is not null) if(this.ChatThread is not null)
{ {
await this.ChatThreadChanged.InvokeAsync(this.ChatThread);
this.Logger.LogInformation($"The chat '{this.ChatThread!.ChatId}' with title '{this.ChatThread.Name}' ({this.ChatThread.Blocks.Count} messages) was loaded successfully.");
this.currentWorkspaceName = await WorkspaceBehaviour.LoadWorkspaceName(this.ChatThread.WorkspaceId); this.currentWorkspaceName = await WorkspaceBehaviour.LoadWorkspaceName(this.ChatThread.WorkspaceId);
this.WorkspaceName(this.currentWorkspaceName); this.WorkspaceName(this.currentWorkspaceName);
await this.SelectProviderWhenLoadingChat(); await this.SelectProviderWhenLoadingChat();
} }
else
this.Logger.LogWarning($"The chat '{this.loadChat.ChatId}' could not be loaded.");
this.StateHasChanged(); this.StateHasChanged();
await this.ChatThreadChanged.InvokeAsync(this.ChatThread);
} }
if(this.mustScrollToBottomAfterRender) if(this.mustScrollToBottomAfterRender)
@ -523,8 +530,6 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
this.WorkspaceName(this.currentWorkspaceName); this.WorkspaceName(this.currentWorkspaceName);
await this.SelectProviderWhenLoadingChat(); await this.SelectProviderWhenLoadingChat();
this.userInput = string.Empty;
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading) if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
{ {
this.mustScrollToBottomAfterRender = true; this.mustScrollToBottomAfterRender = true;

View File

@ -2,4 +2,5 @@
- Added xAI as a new provider. xAI provides their Grok models for generating content. - Added xAI as a new provider. xAI provides their Grok models for generating content.
- Improved the stop generation button behavior to ensure that the AI stops generating content immediately (which will save compute time, energy and financial resources). - Improved the stop generation button behavior to ensure that the AI stops generating content immediately (which will save compute time, energy and financial resources).
- Fixed the chat scrolling behavior after toggling the workspaces. - Fixed the chat scrolling behavior after toggling the workspaces.
- Fixed an issue when loading the today's bias chat, triggered by the bias assistant.
- Restructured the streaming network code to be centralized out of the individual providers. This will allow for easier maintenance and updates in the future. - Restructured the streaming network code to be centralized out of the individual providers. This will allow for easier maintenance and updates in the future.