2024-01-29 01:33:40 +00:00
|
|
|
namespace BotSharp.Core.Conversations.Services;
|
|
|
|
|
|
|
|
|
|
public partial class ConversationService : IConversationService
|
|
|
|
|
{
|
|
|
|
|
public async Task<bool> TruncateConversation(string conversationId, string messageId)
|
|
|
|
|
{
|
|
|
|
|
var db = _services.GetRequiredService<IBotSharpRepository>();
|
2024-02-28 23:37:36 +00:00
|
|
|
var isSaved = db.TruncateConversation(conversationId, messageId, true);
|
2024-03-11 20:32:13 +00:00
|
|
|
var hooks = _services.GetServices<IConversationHook>().ToList();
|
|
|
|
|
foreach (var hook in hooks)
|
|
|
|
|
{
|
|
|
|
|
await hook.OnMessageDeleted(conversationId, messageId);
|
|
|
|
|
}
|
2024-01-29 01:33:40 +00:00
|
|
|
return await Task.FromResult(isSaved);
|
|
|
|
|
}
|
|
|
|
|
}
|