Delay persisting message to allow message content to be changed in hook.

This commit is contained in:
Haiping Chen 2024-03-26 11:10:27 -05:00
parent 098aa92be2
commit 691c3b2654

View file

@ -32,8 +32,6 @@ public partial class ConversationService
message.SenderId = _user.Id;
}
_storage.Append(_conversationId, message);
var conv = _services.GetRequiredService<IConversationService>();
var dialogs = conv.GetDialogHistory();
@ -72,6 +70,12 @@ public partial class ConversationService
}
}
// Persist to storage
_storage.Append(_conversationId, message);
// Add to thread
dialogs.Add(message);
if (!stopCompletion)
{
// Routing with reasoning