Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,7 +66,8 @@ def initialize_session_state():
|
|
| 66 |
'reinitialize_chat': defaults.reinitialize_chat,
|
| 67 |
'initialized': True,
|
| 68 |
'data_path': data_path,
|
| 69 |
-
'vector_store_path': vector_store_path
|
|
|
|
| 70 |
})
|
| 71 |
|
| 72 |
def initialize_chat_system(collection_id: Optional[int] = None) -> bool:
|
|
@@ -275,7 +276,7 @@ def display_header():
|
|
| 275 |
|
| 276 |
with col1:
|
| 277 |
if os.path.exists("img/logo.png"):
|
| 278 |
-
st.image("img/logo.png", width=150)
|
| 279 |
else:
|
| 280 |
st.info("Logo missing: img/logo.png")
|
| 281 |
|
|
@@ -283,20 +284,26 @@ def display_header():
|
|
| 283 |
st.markdown("##### Synaptyx RFP Analyzer Agent")
|
| 284 |
|
| 285 |
with col3:
|
| 286 |
-
cols = st.columns(
|
| 287 |
with cols[0]:
|
| 288 |
if st.button("π Home", use_container_width=True):
|
| 289 |
st.session_state.chat_ready = False
|
| 290 |
st.session_state.messages = []
|
| 291 |
st.session_state.current_chat_id = None
|
|
|
|
| 292 |
st.rerun()
|
| 293 |
with cols[1]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
if st.session_state.chat_ready and st.button("π New Chat", use_container_width=True):
|
| 295 |
st.session_state.messages = []
|
| 296 |
st.session_state.current_chat_id = None
|
| 297 |
st.rerun()
|
| 298 |
-
with cols[
|
| 299 |
-
if st.button("
|
| 300 |
st.session_state.show_collection_dialog = True
|
| 301 |
st.rerun()
|
| 302 |
|
|
@@ -341,7 +348,9 @@ def main():
|
|
| 341 |
st.error("Please enter a collection name")
|
| 342 |
|
| 343 |
# Main content area
|
| 344 |
-
if
|
|
|
|
|
|
|
| 345 |
display_welcome_screen()
|
| 346 |
else:
|
| 347 |
display_chat_interface()
|
|
|
|
| 66 |
'reinitialize_chat': defaults.reinitialize_chat,
|
| 67 |
'initialized': True,
|
| 68 |
'data_path': data_path,
|
| 69 |
+
'vector_store_path': vector_store_path,
|
| 70 |
+
'show_explorer': False # Add this flag
|
| 71 |
})
|
| 72 |
|
| 73 |
def initialize_chat_system(collection_id: Optional[int] = None) -> bool:
|
|
|
|
| 276 |
|
| 277 |
with col1:
|
| 278 |
if os.path.exists("img/logo.png"):
|
| 279 |
+
st.image("img/logo.png", width=150)
|
| 280 |
else:
|
| 281 |
st.info("Logo missing: img/logo.png")
|
| 282 |
|
|
|
|
| 284 |
st.markdown("##### Synaptyx RFP Analyzer Agent")
|
| 285 |
|
| 286 |
with col3:
|
| 287 |
+
cols = st.columns(4) # Added one more column for Document Explorer
|
| 288 |
with cols[0]:
|
| 289 |
if st.button("π Home", use_container_width=True):
|
| 290 |
st.session_state.chat_ready = False
|
| 291 |
st.session_state.messages = []
|
| 292 |
st.session_state.current_chat_id = None
|
| 293 |
+
st.session_state.show_explorer = False # Add this
|
| 294 |
st.rerun()
|
| 295 |
with cols[1]:
|
| 296 |
+
if st.button("π Explorer", use_container_width=True):
|
| 297 |
+
st.session_state.show_explorer = True # Add this
|
| 298 |
+
st.session_state.chat_ready = False
|
| 299 |
+
st.rerun()
|
| 300 |
+
with cols[2]:
|
| 301 |
if st.session_state.chat_ready and st.button("π New Chat", use_container_width=True):
|
| 302 |
st.session_state.messages = []
|
| 303 |
st.session_state.current_chat_id = None
|
| 304 |
st.rerun()
|
| 305 |
+
with cols[3]:
|
| 306 |
+
if st.button("π Upload", use_container_width=True):
|
| 307 |
st.session_state.show_collection_dialog = True
|
| 308 |
st.rerun()
|
| 309 |
|
|
|
|
| 348 |
st.error("Please enter a collection name")
|
| 349 |
|
| 350 |
# Main content area
|
| 351 |
+
if st.session_state.show_explorer:
|
| 352 |
+
display_document_chunks()
|
| 353 |
+
elif not st.session_state.chat_ready:
|
| 354 |
display_welcome_screen()
|
| 355 |
else:
|
| 356 |
display_chat_interface()
|