mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 14:29:07 +00:00
Fix the send to chat scroll issue (#120)
This commit is contained in:
parent
6fbf32d8a2
commit
c861d71383
@ -44,6 +44,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
||||
private bool workspacesVisible;
|
||||
private Workspaces? workspaces;
|
||||
private bool mustScrollToBottomAfterRender;
|
||||
private byte scrollRenderCountdown;
|
||||
|
||||
// Unfortunately, we need the input field reference to clear it after sending a message.
|
||||
// This is necessary because we have to handle the key events ourselves. Otherwise,
|
||||
@ -76,6 +77,13 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
|
||||
{
|
||||
this.mustScrollToBottomAfterRender = true;
|
||||
this.scrollRenderCountdown = 2;
|
||||
this.StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
@ -85,8 +93,15 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
||||
{
|
||||
if(this.mustScrollToBottomAfterRender)
|
||||
{
|
||||
await this.scrollingArea.ScrollToBottom();
|
||||
this.mustScrollToBottomAfterRender = false;
|
||||
if (--this.scrollRenderCountdown == 0)
|
||||
{
|
||||
await this.scrollingArea.ScrollToBottom();
|
||||
this.mustScrollToBottomAfterRender = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
@ -384,6 +399,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
||||
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
|
||||
{
|
||||
this.mustScrollToBottomAfterRender = true;
|
||||
this.scrollRenderCountdown = 2;
|
||||
this.StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
# v0.9.3, build 178 (2024-09-0X xx:xx UTC)
|
||||
- Fixed the scrolling issue for long chat histories.
|
||||
- Fixed the scrolling issue for long chat histories.
|
||||
- Fixed the scrolling issue, when you send a lot of text from any assistant to a new chat.
|
Loading…
Reference in New Issue
Block a user