Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
| 6 |
from typing import Dict, List, Optional, Any
|
| 7 |
from datetime import datetime
|
| 8 |
from threading import Lock
|
|
|
|
| 9 |
|
| 10 |
# Components imports
|
| 11 |
from components.chat import display_chat_interface
|
|
@@ -506,6 +507,33 @@ def main():
|
|
| 506 |
initial_sidebar_state="expanded"
|
| 507 |
)
|
| 508 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 509 |
if not initialize_database():
|
| 510 |
st.error("Failed to initialize database. Please contact support.")
|
| 511 |
return
|
|
|
|
| 6 |
from typing import Dict, List, Optional, Any
|
| 7 |
from datetime import datetime
|
| 8 |
from threading import Lock
|
| 9 |
+
from utils.storage_init import initialize_storage_structure, verify_storage_access
|
| 10 |
|
| 11 |
# Components imports
|
| 12 |
from components.chat import display_chat_interface
|
|
|
|
| 507 |
initial_sidebar_state="expanded"
|
| 508 |
)
|
| 509 |
|
| 510 |
+
# Debug section to understand storage status
|
| 511 |
+
with st.expander("Storage Debug Information", expanded=True):
|
| 512 |
+
st.write("Current working directory:", os.getcwd())
|
| 513 |
+
st.write("Contents of current directory:", os.listdir())
|
| 514 |
+
if os.path.exists('/data'):
|
| 515 |
+
st.write("Contents of /data:", os.listdir('/data'))
|
| 516 |
+
else:
|
| 517 |
+
st.write("/data directory not found")
|
| 518 |
+
|
| 519 |
+
# Initialize storage
|
| 520 |
+
base_path = initialize_storage_structure()
|
| 521 |
+
if base_path:
|
| 522 |
+
st.write("Storage base path:", str(base_path))
|
| 523 |
+
if verify_storage_access(base_path):
|
| 524 |
+
st.success("Storage system verified and ready!")
|
| 525 |
+
else:
|
| 526 |
+
st.error("Storage system verification failed!")
|
| 527 |
+
|
| 528 |
+
# Store base_path in session state for other components to use
|
| 529 |
+
if base_path:
|
| 530 |
+
st.session_state['storage_path'] = base_path
|
| 531 |
+
|
| 532 |
+
# Initialize database using verified storage path
|
| 533 |
+
if not initialize_database():
|
| 534 |
+
st.error("Failed to initialize database. Please check storage system.")
|
| 535 |
+
return
|
| 536 |
+
|
| 537 |
if not initialize_database():
|
| 538 |
st.error("Failed to initialize database. Please contact support.")
|
| 539 |
return
|