Anirudh1993 commited on
Commit
c5844af
·
verified ·
1 Parent(s): 7ba1e4d

Update document_chat.py

Browse files
Files changed (1) hide show
  1. document_chat.py +4 -2
document_chat.py CHANGED
@@ -48,6 +48,8 @@ def process_query_with_memory(query, chat_memory):
48
  retriever=retriever,
49
  memory=chat_memory
50
  )
51
- chat_history = chat_memory.chat_memory.messages if chat_memory else []
52
 
53
- return conversation_chain.run({"question": query, "chat_history": chat_memory.memory if chat_memory else []})
 
 
 
 
48
  retriever=retriever,
49
  memory=chat_memory
50
  )
 
51
 
52
+ # Fix: Properly load chat history
53
+ chat_history = chat_memory.load_memory_variables({}).get("chat_history", [])
54
+
55
+ return conversation_chain.run({"question": query, "chat_history": chat_history})