Always load durable user conversation context #298
@@ -513,9 +513,12 @@ func main() {
|
||||
var conversationHistory []interaction.HumanUtterance
|
||||
if request.ConversationID != "" {
|
||||
conversationHistory, _ = interactionRepository.Utterances(r.Context(), conversation.ID)
|
||||
} else {
|
||||
conversationHistory, _ = interactionRepository.RecentUtterancesForPrincipal(r.Context(), session.ActorID, session.PrincipalID, 64)
|
||||
}
|
||||
// Keep durable user context available even when the web client carries a
|
||||
// conversation ID; a new or rotated conversation must not erase learned
|
||||
// preferences.
|
||||
recentUserHistory, _ := interactionRepository.RecentUtterancesForPrincipal(r.Context(), session.ActorID, session.PrincipalID, 64)
|
||||
conversationHistory = append(conversationHistory, recentUserHistory...)
|
||||
if request.ConversationID != "" && interactiondomain.IsRetryRequest(utterance.Content) {
|
||||
if len(conversationHistory) > 0 {
|
||||
for index := len(conversationHistory) - 1; index >= 0; index-- {
|
||||
|
||||
Reference in New Issue
Block a user