Implemented removal of chat messages (#246)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2025-01-03 18:01:22 +01:00
1 parent 6f5aecd92b
commit 5e445f09fa
6 files changed
+57 -2

No files matched your search

@@ -11,7 +11,7 @@
{
@if (!block.HideFromUser)
{
<ContentBlockComponent Role="@block.Role" Type="@block.ContentType" Time="@block.Time" Content="@block.Content"/>
<ContentBlockComponent Role="@block.Role" Type="@block.ContentType" Time="@block.Time" Content="@block.Content" RemoveBlockFunc="@this.RemoveBlock"/>
}
}
}
@@ -571,6 +571,17 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
await MessageBus.INSTANCE.SendMessage<bool>(this, Event.WORKSPACE_TOGGLE_OVERLAY);
}
private async Task RemoveBlock(IContent block)
{
if(this.ChatThread is null)
return;
this.ChatThread.Remove(block);
this.hasUnsavedChanges = true;
await this.SaveThread();
this.StateHasChanged();
}
#region Overrides of MSGComponentBase
public override async Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default