Spaces:
Sleeping
Sleeping
fix conversation dir creation permissions
Browse files- multi_agent_chatbot.py +13 -3
multi_agent_chatbot.py
CHANGED
|
@@ -139,9 +139,19 @@ class MultiAgentRAGChatbot:
|
|
| 139 |
# Build the multi-agent graph
|
| 140 |
self.graph = self._build_graph()
|
| 141 |
|
| 142 |
-
# Conversations directory
|
| 143 |
-
self.conversations_dir = Path("conversations")
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
logger.info("🤖 Multi-Agent RAG Chatbot initialized")
|
| 147 |
|
|
|
|
| 139 |
# Build the multi-agent graph
|
| 140 |
self.graph = self._build_graph()
|
| 141 |
|
| 142 |
+
# Conversations directory - use absolute path in /app to ensure writability
|
| 143 |
+
self.conversations_dir = Path("/app/conversations")
|
| 144 |
+
try:
|
| 145 |
+
self.conversations_dir.mkdir(mode=0o755, exist_ok=True)
|
| 146 |
+
except (PermissionError, OSError) as e:
|
| 147 |
+
logger.warning(f"Could not create conversations directory at {self.conversations_dir}: {e}")
|
| 148 |
+
# Fallback to a relative path (current directory)
|
| 149 |
+
self.conversations_dir = Path("conversations")
|
| 150 |
+
try:
|
| 151 |
+
self.conversations_dir.mkdir(mode=0o755, exist_ok=True)
|
| 152 |
+
except (PermissionError, OSError) as e2:
|
| 153 |
+
logger.error(f"Could not create conversations directory at {self.conversations_dir}: {e2}")
|
| 154 |
+
raise RuntimeError(f"Failed to create conversations directory: {e2}")
|
| 155 |
|
| 156 |
logger.info("🤖 Multi-Agent RAG Chatbot initialized")
|
| 157 |
|