From 472bf46a2fe4b0ca521678d021454b841accaf0d Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 11 Apr 2025 16:46:18 -0500 Subject: [PATCH] minor change --- .../BotSharp.Core.Realtime/Services/WaveStreamChannel.cs | 1 + .../Providers/Realtime/RealTimeCompletionProvider.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Services/WaveStreamChannel.cs b/src/Infrastructure/BotSharp.Core.Realtime/Services/WaveStreamChannel.cs index 8f7767f4..4b194efb 100644 --- a/src/Infrastructure/BotSharp.Core.Realtime/Services/WaveStreamChannel.cs +++ b/src/Infrastructure/BotSharp.Core.Realtime/Services/WaveStreamChannel.cs @@ -85,6 +85,7 @@ public class WaveStreamChannel : IStreamChannel public void ClearBuffer() { _bufferedWaveProvider?.ClearBuffer(); + _audioBufferQueue?.Clear(); } private void WaveIn_DataAvailable(object? sender, WaveInEventArgs e) diff --git a/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs b/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs index b573cc26..f4f3120f 100644 --- a/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs +++ b/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs @@ -280,7 +280,7 @@ public class RealTimeCompletionProvider : IRealTimeCompletion var agent = await agentService.LoadAgent(conn.CurrentAgentId); var (prompt, messages, options) = PrepareOptions(agent, []); - var instruction = messages.FirstOrDefault()?.Content.FirstOrDefault()?.Text ?? agent?.Description; + var instruction = messages.FirstOrDefault()?.Content.FirstOrDefault()?.Text ?? agent?.Description ?? string.Empty; var functions = options.Tools.Select(x => { var fn = new FunctionDef