Prevent duplicate record to be inserted
This commit is contained in:
parent
8cc9776a0f
commit
601b64b50a
|
|
@ -38,6 +38,13 @@ public class ConversationStorage : IConversationStorage
|
|||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
var dialogElements = new List<DialogElement>();
|
||||
|
||||
// Prevent duplicate record to be inserted
|
||||
var dialogs = db.GetConversationDialogs(conversationId);
|
||||
if (dialogs.Any(x => x.MetaData.MessageId == dialog.MessageId && x.Content == dialog.Content))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialog.Role == AgentRole.Function)
|
||||
{
|
||||
var meta = new DialogMetaData
|
||||
|
|
|
|||
Loading…
Reference in a new issue