Skip to content

Commit bd4f375

Browse files
author
Jicheng Lu
committed
clean code
1 parent 8b46e26 commit bd4f375

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

src/Plugins/BotSharp.Plugin.ChatHub/ChatStreamMiddleware.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ private async Task HandleWebSocket(IServiceProvider services, string agentId, st
7070
continue;
7171
}
7272

73-
Console.WriteLine($"Close status: {result.CloseStatus}, End of message: {result.EndOfMessage}");
74-
7573
var receivedText = Encoding.UTF8.GetString(buffer, 0, result.Count);
7674
if (string.IsNullOrEmpty(receivedText))
7775
{

src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -629,16 +629,16 @@ public async Task<List<RoleDialogModel>> OnResponsedDone(RealtimeHubConnection c
629629
}
630630
else if (output.Type == "message")
631631
{
632-
var content = output.Content.FirstOrDefault();
632+
var content = output.Content.FirstOrDefault()?.Transcript ?? string.Empty;
633633

634-
outputs.Add(new RoleDialogModel(output.Role, content.Transcript)
634+
outputs.Add(new RoleDialogModel(output.Role, content)
635635
{
636636
CurrentAgentId = conn.CurrentAgentId,
637637
MessageId = output.Id,
638638
MessageType = MessageTypeName.Plain
639639
});
640640

641-
prompts.Add(content.Transcript);
641+
prompts.Add(content);
642642
}
643643
}
644644

@@ -683,12 +683,4 @@ public async Task<RoleDialogModel> OnConversationItemCreated(RealtimeHubConnecti
683683

684684
return message;
685685
}
686-
}
687-
688-
class AudioMessage
689-
{
690-
public string ItemId { get; set; }
691-
public string Event { get; set; }
692-
public string ReceivedText { get; set; }
693-
public string? Transcript { get; set; }
694686
}

0 commit comments

Comments
 (0)