- Add vector store with sentence-transformers for semantic search - FastAPI backend with /chat and /health endpoints - Conversation state persistence via SQLite - OpenRouter integration with structured JSON responses - Discord bot with /ask slash command and reply-based follow-ups - Automated Gitea issue creation for unanswered questions - Docker support with docker-compose for easy deployment - Example rule file and ingestion script - Comprehensive documentation in README
59 lines
1.6 KiB
Bash
Executable File
59 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Setup script for Strat-Chatbot
|
|
|
|
set -e
|
|
|
|
echo "=== Strat-Chatbot Setup ==="
|
|
|
|
# Check for .env file
|
|
if [ ! -f .env ]; then
|
|
echo "Creating .env from template..."
|
|
cp .env.example .env
|
|
echo "⚠️ Please edit .env and add your OpenRouter API key (and optionally Discord/Gitea keys)"
|
|
exit 1
|
|
fi
|
|
|
|
# Create necessary directories
|
|
mkdir -p data/rules
|
|
mkdir -p data/chroma
|
|
|
|
# Check if uv is installed
|
|
if ! command -v uv &> /dev/null; then
|
|
echo "Installing uv package manager..."
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
# Install dependencies
|
|
echo "Installing Python dependencies..."
|
|
uv sync
|
|
|
|
# Initialize database
|
|
echo "Initializing database..."
|
|
uv run python -c "from app.database import ConversationManager; import asyncio; mgr = ConversationManager('sqlite+aiosqlite:///./data/conversations.db'); asyncio.run(mgr.init_db())"
|
|
|
|
# Check if rules exist
|
|
if ! ls data/rules/*.md 1> /dev/null 2>&1; then
|
|
echo "⚠️ No rule files found in data/rules/"
|
|
echo " Please add your markdown rule files to data/rules/"
|
|
exit 1
|
|
fi
|
|
|
|
# Ingest rules
|
|
echo "Ingesting rules into vector store..."
|
|
uv run python scripts/ingest_rules.py
|
|
|
|
echo "✅ Setup complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Ensure your .env file has OPENROUTER_API_KEY set"
|
|
echo "2. (Optional) Set DISCORD_BOT_TOKEN to enable Discord bot"
|
|
echo "3. Start the API:"
|
|
echo " uv run app/main.py"
|
|
echo ""
|
|
echo "Or use Docker Compose:"
|
|
echo " docker compose up -d"
|
|
echo ""
|
|
echo "API will be at: http://localhost:8000"
|
|
echo "Docs at: http://localhost:8000/docs"
|