mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-29 01:19:47 +00:00
Fixed scrolling issue after send to chat call
This commit is contained in:
parent
6fbf32d8a2
commit
dfc69e28db
@ -44,6 +44,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
private bool workspacesVisible;
|
private bool workspacesVisible;
|
||||||
private Workspaces? workspaces;
|
private Workspaces? workspaces;
|
||||||
private bool mustScrollToBottomAfterRender;
|
private bool mustScrollToBottomAfterRender;
|
||||||
|
private byte scrollRenderCountdown;
|
||||||
|
|
||||||
// Unfortunately, we need the input field reference to clear it after sending a message.
|
// 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,
|
// 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();
|
await base.OnInitializedAsync();
|
||||||
@ -84,10 +92,17 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if(this.mustScrollToBottomAfterRender)
|
if(this.mustScrollToBottomAfterRender)
|
||||||
|
{
|
||||||
|
if (--this.scrollRenderCountdown == 0)
|
||||||
{
|
{
|
||||||
await this.scrollingArea.ScrollToBottom();
|
await this.scrollingArea.ScrollToBottom();
|
||||||
this.mustScrollToBottomAfterRender = false;
|
this.mustScrollToBottomAfterRender = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await base.OnAfterRenderAsync(firstRender);
|
await base.OnAfterRenderAsync(firstRender);
|
||||||
}
|
}
|
||||||
@ -384,6 +399,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
|
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
|
||||||
{
|
{
|
||||||
this.mustScrollToBottomAfterRender = true;
|
this.mustScrollToBottomAfterRender = true;
|
||||||
|
this.scrollRenderCountdown = 2;
|
||||||
this.StateHasChanged();
|
this.StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user