Qazi-Mudassar-Ilyas
commited on
Commit
•
026a912
1
Parent(s):
3414fc6
Update app.py
Browse files
app.py
CHANGED
@@ -114,7 +114,7 @@ def chat(qa_chain,msg,history):
|
|
114 |
response = qa_chain.invoke({"question": msg, "chat_history": formatted_chat_history})
|
115 |
response_answer = response["answer"]
|
116 |
response_sources=response["source_documents"]
|
117 |
-
response_source1=response_sources[0].metadata["source"]
|
118 |
response_source_page=response_sources[0].metadata["page"]+1
|
119 |
new_history = history + [(msg, response_answer)]
|
120 |
return qa_chain, gr.update(value=""), new_history, response_source1, response_source_page
|
|
|
114 |
response = qa_chain.invoke({"question": msg, "chat_history": formatted_chat_history})
|
115 |
response_answer = response["answer"]
|
116 |
response_sources=response["source_documents"]
|
117 |
+
response_source1=os.path.basename(response_sources[0].metadata["source"])
|
118 |
response_source_page=response_sources[0].metadata["page"]+1
|
119 |
new_history = history + [(msg, response_answer)]
|
120 |
return qa_chain, gr.update(value=""), new_history, response_source1, response_source_page
|