Skip to content

moisesz10/bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Summarizer Bot

A full-stack application for summarizing text and extracting insights using AI — built with FastAPI, Celery, Redis, PostgreSQL, and React.

FastAPI React Celery OpenAI


Features

  • Intelligent summarization — submit text and receive a summary with insights generated by GPT-4o mini
  • Asynchronous processing — Celery + Redis, without blocking the interface
  • Automatic polling — the frontend detects when the result is ready
  • Persistent history — all summaries saved in PostgreSQL
  • Auto-generated documentation — Swagger UI at /docs and ReDoc at /redoc
  • Docker Compose — start the entire stack with a single command

Tech Stack

Layer Technology
Backend FastAPI 0.115, SQLAlchemy 2, Pydantic v2
Queue Celery 5.5 + Redis 7
AI OpenAI SDK 1.x — gpt-4o-mini
Database PostgreSQL 15
Frontend React 19, Vanilla CSS (dark mode)
Infrastructure Docker, Docker Compose

Requirements


Running with Docker Compose

# 1. Clone the repository
git clone https://github.com/your-username/ai-summarizer-bot.git
cd ai-summarizer-bot

# 2. Set up environment variables
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY

# 3. Start the full stack
docker compose up --build

Running Locally (without Docker)

Backend

cd backend
python -m venv venv
source venv/bin/activate       # Linux/Mac
# venv\Scripts\activate        # Windows

pip install -r requirements.txt

export OPENAI_API_KEY=sk-...
# SQLite is used by default if DATABASE_URL is not set

uvicorn app.main:app --reload

Celery Worker (separate terminal)

cd backend
source venv/bin/activate
celery -A celery_worker.celery worker --loglevel=info

Redis is required for Celery. Run with Docker: docker run -p 6379:6379 redis:7-alpine

Frontend

cd frontend
npm install
npm start
# Opens at http://localhost:3000

Environment Variables

Copy .env.example to .env and fill in the values:

Variable Description Required
OPENAI_API_KEY OpenAI API key Yes
DATABASE_URL PostgreSQL connection URL Docker only
POSTGRES_USER Database user Docker only
POSTGRES_PASSWORD Database password Docker only
POSTGRES_DB Database name Docker only
CELERY_BROKER_URL Redis broker URL Docker only
CELERY_RESULT_BACKEND Redis result backend URL Docker only

Project Structure

ai-summarizer-bot/
├── backend/
│   ├── app/
│   │   ├── main.py          # FastAPI app, routes, CORS
│   │   ├── ai_service.py    # OpenAI integration
│   │   ├── tasks.py         # Celery tasks with retry
│   │   ├── crud.py          # Database operations
│   │   ├── models.py        # SQLAlchemy models
│   │   ├── schemas.py       # Pydantic v2 schemas
│   │   └── database.py      # SQLAlchemy connection
│   ├── celery_worker.py     # Worker entrypoint
│   ├── requirements.txt
│   └── Dockerfile
├── frontend/
│   ├── src/
│   │   ├── components/
│   │   │   └── Summarizer.jsx   # Main component
│   │   ├── api.js               # HTTP client (native fetch)
│   │   ├── App.jsx
│   │   ├── index.js
│   │   └── index.css            # Design system
│   ├── package.json
│   └── Dockerfile
├── docker-compose.yml
├── .env.example
└── README.md

API Endpoints

Method Route Description
GET / Health check
POST /summarize/ Submit text for summarization (returns task_id)
GET /task/{task_id} Poll task status
GET /history/ List past summaries

Full documentation: http://localhost:8000/docs


License

MIT — see LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors