Spaces:
Sleeping
Sleeping
| echo "=== RAG System Startup ===" | |
| # Check if RAG/rag_embeddings directory exists | |
| if [ -d "RAG/rag_embeddings" ]; then | |
| echo "β RAG/rag_embeddings directory found" | |
| # Copy database files to writable /tmp directory | |
| echo "π Copying databases to writable location..." | |
| mkdir -p /tmp/rag_embeddings | |
| cp -r RAG/rag_embeddings/* /tmp/rag_embeddings/ | |
| # Remove any lock files from the copied databases | |
| find /tmp/rag_embeddings -name "*.lock" -delete 2>/dev/null || true | |
| find /tmp/rag_embeddings -name "*.db-shm" -delete 2>/dev/null || true | |
| find /tmp/rag_embeddings -name "*.db-wal" -delete 2>/dev/null || true | |
| # Set environment variable to use writable location | |
| export RAG_EMBEDDINGS_PATH="/tmp/rag_embeddings" | |
| echo "β Databases copied to writable location: /tmp/rag_embeddings" | |
| else | |
| echo "β RAG/rag_embeddings directory not found" | |
| fi | |
| echo "β Database directories ready" | |
| # Start the application | |
| echo "π Starting RAG API..." | |
| python app.py | |