diff --git a/backend/danswer/llm/utils.py b/backend/danswer/llm/utils.py index 4be8e14640..58fd634d7c 100644 --- a/backend/danswer/llm/utils.py +++ b/backend/danswer/llm/utils.py @@ -42,7 +42,7 @@ def translate_danswer_msg_to_langchain( # If the message is a `ChatMessage`, it doesn't have the downloaded files # attached. Just ignore them for now. Also, OpenAI doesn't allow files to # be attached to AI messages, so we must remove them - if isinstance(msg, PreviousMessage) and msg.message_type != MessageType.ASSISTANT: + if not isinstance(msg, ChatMessage) and msg.message_type != MessageType.ASSISTANT: files = msg.files content = build_content_with_imgs(msg.message, files)