cryogenic22 commited on
Commit
010e6dd
·
verified ·
1 Parent(s): 515209f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -115,10 +115,14 @@ def initialize_session_state():
115
  st.session_state.chat_ready = False
116
  if 'current_collection' not in st.session_state:
117
  st.session_state.current_collection = None
 
 
118
  if 'processed_files' not in st.session_state:
119
  st.session_state.processed_files = []
120
  if 'vector_stores' not in st.session_state:
121
  st.session_state.vector_stores = {}
 
 
122
 
123
  def display_top_bar():
124
  """Display the application's top navigation bar."""
@@ -280,25 +284,29 @@ def main():
280
  initial_sidebar_state="expanded"
281
  )
282
 
283
- # Initialize database and session state
284
  if not initialize_database():
285
- st.error("Failed to initialize database. Please check storage system.")
286
  return
287
 
288
  initialize_session_state()
289
-
290
- # Display the top navigation bar
291
  display_top_bar()
292
 
293
- # Display the collection sidebar
294
- display_collection_sidebar()
 
 
 
 
 
 
 
 
 
295
 
296
- # Show collection creation dialog if triggered
297
- if st.session_state.get('show_collection_dialog', False):
298
  display_collection_dialog()
299
 
300
- # Display chat area
301
- display_chat_area()
302
-
303
  if __name__ == "__main__":
304
  main()
 
115
  st.session_state.chat_ready = False
116
  if 'current_collection' not in st.session_state:
117
  st.session_state.current_collection = None
118
+ if 'current_document' not in st.session_state:
119
+ st.session_state.current_document = None
120
  if 'processed_files' not in st.session_state:
121
  st.session_state.processed_files = []
122
  if 'vector_stores' not in st.session_state:
123
  st.session_state.vector_stores = {}
124
+ if 'selected_collection' not in st.session_state:
125
+ st.session_state.selected_collection = None
126
 
127
  def display_top_bar():
128
  """Display the application's top navigation bar."""
 
284
  initial_sidebar_state="expanded"
285
  )
286
 
287
+ # Initialize database silently
288
  if not initialize_database():
289
+ st.error("Failed to initialize database. Please contact support.")
290
  return
291
 
292
  initialize_session_state()
 
 
293
  display_top_bar()
294
 
295
+ # Main content area with tabs
296
+ tab1, tab2 = st.tabs(["Chat", "Document Store"])
297
+
298
+ with tab1:
299
+ if st.session_state.chat_ready:
300
+ display_chat_interface()
301
+ else:
302
+ display_welcome_screen()
303
+
304
+ with tab2:
305
+ display_documents_tab()
306
 
307
+ # Show collection creation dialog if needed
308
+ if st.session_state.get('show_collection_dialog'):
309
  display_collection_dialog()
310
 
 
 
 
311
  if __name__ == "__main__":
312
  main()