Skip to content

Commit

Permalink
Merge pull request #363 from hchen2020/master
Browse files Browse the repository at this point in the history
Delay persisting message to allow message content to be changed in hook.
  • Loading branch information
Oceania2018 committed Mar 26, 2024
2 parents 098aa92 + 691c3b2 commit 71eeb01
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71eeb01

Please sign in to comment.