Merge pull request #954 from hchen2020/master

Append dialogs into model context
This commit is contained in:
Haiping 2025-03-18 15:20:17 -05:00 committed by GitHub
commit 24657bd3b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -116,13 +116,14 @@ public class RealtimeHub : IRealtimeHub
}
else
{
// Push dialogs into model context
// Append dialogs into model context
var history = "[CONVERSATION HISTORY]\r\n";
foreach (var message in dialogs)
{
await _completer.InsertConversationItem(message);
history += $"{message.Role}: {message.Content}\r\n";
}
await _completer.TriggerModelInference($"{instruction}\r\n\r\nAssist user without repeating your previous statement.");
await _completer.TriggerModelInference($"{instruction}\r\n\r\n{history}\r\n\r\nAssist user without repeating your previous statement.");
}
},
onModelAudioDeltaReceived: async (audioDeltaData, itemId) =>