remove the first message in the post method

This commit is contained in:
Parsa Nazer
2025-01-02 15:31:21 +03:30
parent fe3f2d10c7
commit bb46a65bc2
+1 -1
View File
@@ -169,7 +169,7 @@ class ProductChatView(APIView):
formatted_messages = [] formatted_messages = []
for message in message_response.data: for message in message_response.data:
for content in message.content: 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' sender = 'user' if message.role == 'user' else 'ai'
formatted_messages.append({'sender': sender, 'content': content.text.value}) formatted_messages.append({'sender': sender, 'content': content.text.value})