Spaces:
Running
Running
github-actions[bot] commited on
Commit ·
4a88c1a
1
Parent(s): 9594951
🚀 Auto-deploy backend from GitHub (60171cf)
Browse files- scripts/download_vectorstore_from_firebase.py +10 -2
- startup.sh +10 -1
scripts/download_vectorstore_from_firebase.py
CHANGED
|
@@ -17,7 +17,13 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
|
| 17 |
from backend.rag.firebase_storage_loader import _init_firebase_storage
|
| 18 |
|
| 19 |
REMOTE_PREFIX = "vectorstore/"
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
def download_vectorstore(dest_dir: Path, prefix: str = REMOTE_PREFIX):
|
|
@@ -59,4 +65,6 @@ def download_vectorstore(dest_dir: Path, prefix: str = REMOTE_PREFIX):
|
|
| 59 |
|
| 60 |
if __name__ == "__main__":
|
| 61 |
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
|
| 62 |
-
|
|
|
|
|
|
|
|
|
| 17 |
from backend.rag.firebase_storage_loader import _init_firebase_storage
|
| 18 |
|
| 19 |
REMOTE_PREFIX = "vectorstore/"
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def _resolve_dest_dir() -> Path:
|
| 23 |
+
raw = os.getenv("CURRICULUM_VECTORSTORE_DIR") or os.getenv("VECTORSTORE_DIR")
|
| 24 |
+
if raw:
|
| 25 |
+
return Path(raw)
|
| 26 |
+
return Path("/app/datasets/vectorstore")
|
| 27 |
|
| 28 |
|
| 29 |
def download_vectorstore(dest_dir: Path, prefix: str = REMOTE_PREFIX):
|
|
|
|
| 65 |
|
| 66 |
if __name__ == "__main__":
|
| 67 |
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
|
| 68 |
+
dest_dir = _resolve_dest_dir()
|
| 69 |
+
logger.info("Using vectorstore destination: %s", dest_dir)
|
| 70 |
+
download_vectorstore(dest_dir, REMOTE_PREFIX)
|
startup.sh
CHANGED
|
@@ -11,6 +11,7 @@ fi
|
|
| 11 |
|
| 12 |
export CURRICULUM_DIR
|
| 13 |
export VECTORSTORE_DIR
|
|
|
|
| 14 |
|
| 15 |
mkdir -p "${CURRICULUM_DIR}" "${VECTORSTORE_DIR}"
|
| 16 |
|
|
@@ -26,4 +27,12 @@ else
|
|
| 26 |
echo "INFO: Curriculum ingestion script not found at ${_ingest_script}; skipping (curriculum is optional)"
|
| 27 |
fi
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
export CURRICULUM_DIR
|
| 13 |
export VECTORSTORE_DIR
|
| 14 |
+
export CURRICULUM_VECTORSTORE_DIR="${VECTORSTORE_DIR}"
|
| 15 |
|
| 16 |
mkdir -p "${CURRICULUM_DIR}" "${VECTORSTORE_DIR}"
|
| 17 |
|
|
|
|
| 27 |
echo "INFO: Curriculum ingestion script not found at ${_ingest_script}; skipping (curriculum is optional)"
|
| 28 |
fi
|
| 29 |
|
| 30 |
+
_vectorstore_download_script="/app/scripts/download_vectorstore_from_firebase.py"
|
| 31 |
+
if [ -f "${_vectorstore_download_script}" ]; then
|
| 32 |
+
echo "INFO: Downloading vectorstore from Firebase Storage..."
|
| 33 |
+
python "${_vectorstore_download_script}" || echo "WARNING: Vectorstore download failed, continuing anyway"
|
| 34 |
+
else
|
| 35 |
+
echo "INFO: Vectorstore download script not found at ${_vectorstore_download_script}; skipping"
|
| 36 |
+
fi
|
| 37 |
+
|
| 38 |
+
exec uvicorn main:app --host 0.0.0.0 --port 7860 --workers 1
|