#!/bin/bash # 벡터 DB를 GitHub에 업로드하는 스크립트 set -e echo "==================================================" echo "벡터 DB GitHub 업로드" echo "==================================================" # 벡터 DB 존재 확인 if [ ! -d "data/chroma_db" ]; then echo "❌ 벡터 DB가 없습니다." echo " run_indexing.sh를 먼저 실행하세요." exit 1 fi # 용량 확인 echo "" echo "📊 벡터 DB 용량 확인..." DB_SIZE=$(du -sh data/chroma_db | cut -f1) DB_SIZE_MB=$(du -sm data/chroma_db | cut -f1) echo " 크기: $DB_SIZE" echo "" if [ "$DB_SIZE_MB" -lt 100 ]; then echo "✅ 100MB 미만입니다. 일반 Git으로 업로드 가능합니다." USE_LFS=false else echo "⚠️ 100MB 이상입니다. Git LFS 사용을 권장합니다." echo "" read -p "Git LFS를 사용하시겠습니까? (Y/n): " -n 1 -r echo "" if [[ $REPLY =~ ^[Nn]$ ]]; then USE_LFS=false echo "⚠️ 주의: 100MB 이상 파일은 GitHub에서 거부될 수 있습니다." else USE_LFS=true fi fi echo "" echo "==================================================" if [ "$USE_LFS" = true ]; then echo "Git LFS로 업로드합니다..." echo "" # Git LFS 설치 확인 if ! command -v git-lfs &> /dev/null; then echo "❌ Git LFS가 설치되어 있지 않습니다." echo "" echo "설치 방법:" echo " macOS: brew install git-lfs" echo " Linux: sudo apt-get install git-lfs" echo "" exit 1 fi # Git LFS 초기화 git lfs install # 추적 설정 git lfs track "data/chroma_db/**/*" git lfs track "*.sqlite3" # .gitattributes 추가 git add .gitattributes echo "✅ Git LFS 설정 완료" fi echo "" echo "Git에 추가 중..." git add data/chroma_db/ echo "" echo "커밋 생성 중..." if [ "$USE_LFS" = true ]; then git commit -m "Add indexed vector database via Git LFS ($DB_SIZE, 2,639 papers)" else git commit -m "Add indexed vector database ($DB_SIZE, 2,639 papers)" fi echo "" echo "GitHub에 푸시 중..." BRANCH=$(git branch --show-current) git push origin "$BRANCH" echo "" echo "==================================================" echo "✅ 업로드 완료!" echo "==================================================" echo "" echo "GitHub 리포지토리에서 확인하세요:" echo "https://github.com/csjjin2025/Hallucination_and_Deception_for_financial_RAG" echo ""