LANCommander/LANCommander.UI/Components/Chat/Chat.razor
Pat Hartl a92c7be6ec Enhance chat list
- Added SafeAvatar component for retrieving user avatars with fallback to initials
- Added a title/name for chat threads
- Moved chat input to a separate component
2025-11-03 23:27:05 -06:00

35 lines
No EOL
757 B
Text

@using LANCommander.SDK.Services
@inject ChatClient ChatClient
@namespace LANCommander.UI.Components
<Button OnClick="StartThread">New Thread</Button>
<ChatList Threads="_threads" />
<ChatThread Id="_currentThreadId" />
@code {
IEnumerable<SDK.Models.ChatThread> _threads = [];
Guid _currentThreadId;
protected override async Task OnInitializedAsync()
{
_threads = await ChatClient.GetThreadsAsync();
}
async Task StartThread()
{
await ChatClient.StartThreadAsync(["DoctorDalek"]);
_threads = await ChatClient.GetThreadsAsync();
await InvokeAsync(StateHasChanged);
}
async Task OpenThread(Guid threadId)
{
_currentThreadId = threadId;
}
}