This commit is contained in:
mmrbnjd
2025-08-02 13:35:49 +03:30
parent 44afa4dbb6
commit 8aa02020b9

View File

@@ -13,6 +13,7 @@
@inject GroupService groupService
@inject ChatService chatService
@inject IJSRuntime JS
@inject ToastService toastService
@layout UserPanelLayout
<div class="container-fluid">
<div class="row" style="height:85vh">
@@ -138,7 +139,7 @@
@code {
[Parameter] public int CompanyID { get; set; }
private bool _shouldObserveVisibility = false;
int? GroupID = null;
ReadANDUpdate_CompanyDto? CompanyInfo = new();
Common.Dtos.CurrentUserInfo CurrentUser = new();
List<Read_GroupDto> CompanyGroups = new();
@@ -172,15 +173,26 @@
var model = await chatService.ADDChatResponse(LastOpenChat.ID, MsgInput, type);
LastOpenChat?.Responses.Add(model);
LastOpenChat.LastText = MsgInput;
await Task.Yield();
// Scroll to bottom for user's own messages
await JS.InvokeVoidAsync("scrollToBottom", "B1");
MsgInput = string.Empty;
}
else
{
//TODO New Chat
var model = await chatService.NewChatFromCurrentUser(new ADD_ConversationDto()
{
CompanyID = CompanyID,
GroupID = GroupID,
Question = MsgInput,
UserID = 0
});
if (model != null) LastOpenChat = model;
else toastService.Notify(new ToastMessage(ToastType.Danger, "خطا در گفتگو جدید"));
}
await Task.Yield();
// Scroll to bottom for user's own messages
await JS.InvokeVoidAsync("scrollToBottom", "B1");
MsgInput = string.Empty;
}
}