sankar12345 commited on
Commit
a195a45
1 Parent(s): cac7383

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -53,7 +53,12 @@ def get_conversation_chain(vectorstore):
53
 
54
 
55
  def handle_userinput(user_question):
56
- response = st.session_state.conversation({'question': user_question})
 
 
 
 
 
57
  st.session_state.chat_history = response['chat_history']
58
 
59
  for i, message in enumerate(st.session_state.chat_history):
@@ -65,6 +70,7 @@ def handle_userinput(user_question):
65
  "{{MSG}}", message.content), unsafe_allow_html=True)
66
 
67
 
 
68
  def main():
69
  load_dotenv()
70
  st.set_page_config(page_title="Chat with multiple PDFs",
 
53
 
54
 
55
  def handle_userinput(user_question):
56
+ conversation = st.session_state.conversation
57
+ if conversation is None:
58
+ st.error("Conversation not initialized. Please upload PDFs and process them.")
59
+ return
60
+
61
+ response = conversation({'question': user_question})
62
  st.session_state.chat_history = response['chat_history']
63
 
64
  for i, message in enumerate(st.session_state.chat_history):
 
70
  "{{MSG}}", message.content), unsafe_allow_html=True)
71
 
72
 
73
+
74
  def main():
75
  load_dotenv()
76
  st.set_page_config(page_title="Chat with multiple PDFs",