From bb46a65bc2fbc01f662f9c0d15a5f864e7ffd091 Mon Sep 17 00:00:00 2001 From: Parsa Nazer Date: Thu, 2 Jan 2025 15:31:21 +0330 Subject: [PATCH] remove the first message in the post method --- backend/chat/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/chat/views.py b/backend/chat/views.py index ee3c96c..a97060c 100644 --- a/backend/chat/views.py +++ b/backend/chat/views.py @@ -169,7 +169,7 @@ class ProductChatView(APIView): formatted_messages = [] for message in message_response.data: for content in message.content: - if content.type == "text": + if content.type == "text" and 'this is the start of the chat greet the user this chat is about the product with given detail:' not in content.text.value: sender = 'user' if message.role == 'user' else 'ai' formatted_messages.append({'sender': sender, 'content': content.text.value})