Manglik-R commited on
Commit
25069ce
·
verified ·
1 Parent(s): 424eb81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -45,8 +45,9 @@ def pdf_changes(pdf_doc):
45
 
46
 
47
  def query(history, text):
48
- result = qa({'question': text, 'chat_history': history})
49
- new_history = history + [tuple((text,result['answer']))]
 
50
  return new_history,""
51
 
52
  css="""
 
45
 
46
 
47
  def query(history, text):
48
+ langchain_history = [(msg[1], history[i+1][1] if i+1 < len(history) else "") for i, msg in enumerate(history) if i % 2 == 0]
49
+ result = qa({"question": text, "chat_history": langchain_history})
50
+ new_history = history + [(text,result['answer'])]
51
  return new_history,""
52
 
53
  css="""