- Stack: GPT4All + Llama 3.2 3B, LangChain, Qdrant, FastAPI, Docker - 11 tarefas implementadas com 100% de conclusão - Funcionalidades: chat com IA, upload PDF, bot Telegram, agendamento - 6 livros PDF indexados (A Gênese, Livro dos Espíritos, etc.) - Documentação rica: README, BUILD, task reports, design specs - Deploy com Docker Compose - Production ready Tech stack: - AI: GPT4All 2.4.6, Llama 3.2 3B q4_0 - Backend: FastAPI 0.115.0, Celery 5.4.0, Redis 5.2.0 - RAG: LangChain 0.3.7, Qdrant 1.11.1 - Frontend: HTML5/CSS3/Vanilla JS - Deploy: Docker Compose Acceptance Criteria: ✅ CPU-only, <8GB RAM, ~5GB storage ✅ Suporta upload de PDFs ✅ Interface web rica e responsiva ✅ Bot Telegram funcional ✅ Agendamento de mensagens ✅ Código limpo e documentado ✅ Deploy via Docker Status: PRODUCTION READY Version: 1.0.0 Date: 2026-11-01
2.4 KiB
2.4 KiB
Build e Deployment Instructions
Prerequisites
- Docker and Docker Compose installed
- ~5GB free disk space
- 8GB RAM minimum
- CPU for model inference
Download the Model
Before building, download the Llama 3.2 3B quantized model:
# Download model (approximately 2GB)
cd backend
wget https://huggingface.co/MaziyarPanahi/Llama-3.2-3B-Instruct-GGUF/resolve/main/llama-3.2-3b-instruct-q4_0.gguf
# Place in models directory
mkdir -p models
mv llama-3.2-3b-instruct-q4_0.gguf models/
Alternatively, use GPT4All's built-in downloader when starting the service.
Environment Setup
- Copy the environment template:
cp backend/.env.example .env
- Edit
.envand set your Telegram credentials:
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
To get your chat ID, create a bot with @BotFather on Telegram and send /start.
Build and Start
- Build the containers:
docker-compose build
- Start all services:
docker-compose up -d
Index the Books
After starting the services, index the 6 existing books:
docker-compose run --rm web python backend/scripts/index_books.py
This will:
- Load PDFs from the
PDF/directory - Extract text chunks
- Generate embeddings
- Store in Qdrant
Access the Services
- Web Interface: http://localhost:8000
- Qdrant API: http://localhost:6333/dashboard
- Redis: localhost:6379
Create a Telegram Bot
- Chat with @BotFather on Telegram
- Send
/newbotand follow instructions - Copy the bot token to
.env
Schedule Messages
- Open the web interface: http://localhost:8000
- Click on "Agendar Mensagens"
- Select date/time and optionally a specific book
- Click "Adicionar Agendamento"
Stop the Services
docker-compose down
View Logs
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f web
docker-compose logs -f celery
docker-compose logs -f celery-beat
Troubleshooting
Model Download Issues
If the model download fails:
# Download manually
cd backend/models
wget <model-url>
Qdrant Not Starting
# Remove existing volume
docker volume rm espiritismo_qdrant_data
# Restart
docker-compose up -d qdrant
Out of Memory
Reduce the number of workers or use a smaller model.
Import Errors
Rebuild with:
docker-compose build --no-cache web
docker-compose up -d web