From 3dae306c75b91667f305a016033bf33bc58df17e Mon Sep 17 00:00:00 2001 From: Mykhailo Bilodid Date: Wed, 15 Nov 2023 23:58:49 +0200 Subject: [PATCH] Bug fixed --- .../Services/ProductService.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs b/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs index bb3d83d..a67809a 100644 --- a/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs +++ b/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs @@ -64,12 +64,24 @@ public class ProductService : IProductService foreach (var item in previousMessages.Items) { - messagesForOpenAI - .Add(new OpenAiMessage() - { - Role = item.Role.ToLower(), - Content = item.Text - }); + if (item.Role == "Application") + { + messagesForOpenAI + .Add(new OpenAiMessage() + { + Role = OpenAiRole.Assistant.RequestConvert(), + Content = item.Text + }); + } + else + { + messagesForOpenAI + .Add(new OpenAiMessage() + { + Role = item.Role.ToLower(), + Content = item.Text + }); + } } messagesForOpenAI.Add(new OpenAiMessage()