Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,8 +45,9 @@ def pdf_changes(pdf_doc):
|
|
45 |
|
46 |
|
47 |
def query(history, text):
|
48 |
-
|
49 |
-
|
|
|
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="""
|