From 975149cc0b750807db503baa067a8781a6fd9e6f Mon Sep 17 00:00:00 2001 From: Zhou Jie Date: Thu, 20 Apr 2023 17:00:36 +0800 Subject: [PATCH] Fix #119 This is caused if upstream delta Role was not provided, then "user" will returned. --- OpenAI_API/Chat/Conversation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenAI_API/Chat/Conversation.cs b/OpenAI_API/Chat/Conversation.cs index a8be8dd..10e7263 100644 --- a/OpenAI_API/Chat/Conversation.cs +++ b/OpenAI_API/Chat/Conversation.cs @@ -190,7 +190,7 @@ public async IAsyncEnumerable StreamResponseEnumerableFromChatbotAsync() { if (res.Choices.FirstOrDefault()?.Delta is ChatMessage delta) { - if (delta.Role != null) + if (responseRole == null && delta.Role != null) responseRole = delta.Role; string deltaContent = delta.Content;