Files
Crumb-Core-v.1/load_content.sh

61 lines
1.7 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 🌲 Crumbforest Content Loader
# Loads external content (Knowledge Base) from a Git repository
CONTENT_DIR="docs"
DEFAULT_REPO="https://github.com/example/crumbforest-content.git"
echo "🌲 Crumbforest Content Loader"
echo "=============================="
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "❌ Git is not installed. Please install git first."
exit 1
fi
# Get Repo URL
if [ -z "$1" ]; then
read -p "Enter Content Repository URL (Default: $DEFAULT_REPO): " REPO_URL
REPO_URL=${REPO_URL:-$DEFAULT_REPO}
else
REPO_URL=$1
fi
echo "📦 Target Repository: $REPO_URL"
echo "📂 Target Directory: $CONTENT_DIR"
# Check if directory exists
if [ -d "$CONTENT_DIR" ]; then
echo "⚠️ Directory '$CONTENT_DIR' already exists."
read -p "Update existing content (git pull)? [Y/n] " UPDATE
UPDATE=${UPDATE:-Y}
if [[ "$UPDATE" =~ ^[Yy]$ ]]; then
cd "$CONTENT_DIR"
echo "⬇️ Pulling changes..."
git pull
cd ..
echo "✅ Content updated."
else
echo "⏹️ Operation skipped."
fi
else
echo "⬇️ Cloning content..."
git clone "$REPO_URL" "$CONTENT_DIR"
echo "✅ Content loaded."
fi
# Optional: Trigger Re-Index
read -p "🔄 Trigger RAG Re-indexing now? [y/N] " REINDEX
if [[ "$REINDEX" =~ ^[Yy]$ ]]; then
echo "🚀 Triggering Indexer..."
./test.sh quick # Using test.sh purely for connectivity check or call API directly
# Ideally should call the API endpoint
# curl -X POST http://localhost:8000/api/rag/reindex_all
echo " Please use the Admin Dashboard to re-index content."
fi
echo "🌲 Done."