- 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
35 lines
No EOL
757 B
Text
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;
|
|
}
|
|
} |