Merge pull request #947 from hchen2020/master
Fix Push dialogs into model context
This commit is contained in:
commit
72df520c8e
|
|
@ -99,13 +99,7 @@ public class RealtimeHub : IRealtimeHub
|
|||
onModelReady: async () =>
|
||||
{
|
||||
// Not TriggerModelInference, waiting for user utter.
|
||||
await _completer.UpdateSession(_conn);
|
||||
|
||||
// Push dialogs into model context
|
||||
foreach (var message in dialogs)
|
||||
{
|
||||
await _completer.InsertConversationItem(message);
|
||||
}
|
||||
var instruction = await _completer.UpdateSession(_conn);
|
||||
|
||||
// Trigger model inference if there is no audio file in the conversation
|
||||
if (!states.ContainsState("init_audio_file"))
|
||||
|
|
@ -119,6 +113,16 @@ public class RealtimeHub : IRealtimeHub
|
|||
await _completer.TriggerModelInference("Reply based on the conversation context.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Push dialogs into model context
|
||||
foreach (var message in dialogs)
|
||||
{
|
||||
await _completer.InsertConversationItem(message);
|
||||
}
|
||||
|
||||
await _completer.TriggerModelInference($"{instruction}\r\n\r\nAssist user without repeating your previous statement.");
|
||||
}
|
||||
},
|
||||
onModelAudioDeltaReceived: async (audioDeltaData, itemId) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class TwilioStreamController : TwilioController
|
|||
|
||||
if (request.InitAudioFile != null)
|
||||
{
|
||||
instruction.SpeechPaths.Add($"twilio/voice/speeches/{request.ConversationId}/{request.InitAudioFile}");
|
||||
instruction.SpeechPaths.Add(request.InitAudioFile);
|
||||
}
|
||||
|
||||
await HookEmitter.Emit<ITwilioSessionHook>(_services, async hook =>
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ public class TwilioService
|
|||
}
|
||||
else
|
||||
{
|
||||
response.Play(new Uri($"{_settings.CallbackHost}/{speechPath}"));
|
||||
response.Play(new Uri($"{_settings.CallbackHost}/twilio/voice/speeches/{conversationalVoiceResponse.ConversationId}/{speechPath}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue