File size: 1,027 Bytes
5ff6b14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

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