neo1 / replit.md
bentosmau
Add a functional AI chatbot using Gradio and OpenAI
c69a8c3
# Workspace
## Overview
pnpm workspace monorepo usando TypeScript para el backend + app Python/Gradio para el chatbot de IA.
## Stack
- **Monorepo tool**: pnpm workspaces
- **Node.js version**: 24
- **Package manager**: pnpm
- **TypeScript version**: 5.9
- **API framework**: Express 5
- **Database**: PostgreSQL + Drizzle ORM
- **Validation**: Zod (`zod/v4`), `drizzle-zod`
- **API codegen**: Orval (from OpenAPI spec)
- **Build**: esbuild (CJS bundle)
- **Python version**: 3.11
- **Chat AI**: Gradio + OpenAI (vía Replit AI Integrations)
## Aplicación Principal: Chat IA
La aplicación de chat está en `chat-app/`:
- `chat-app/app.py` — App Gradio con chat conversacional estilo ChatGPT/Gemini
- `chat-app/requirements.txt` — Dependencias Python (gradio, openai)
- `chat-app/README.md` — Configuración para Hugging Face Spaces
### Ejecutar localmente
```bash
PORT=5000 python chat-app/app.py
```
### Publicar en Hugging Face Spaces
1. Crea una cuenta en [huggingface.co](https://huggingface.co)
2. Ve a Settings → Access Tokens → New token (con permiso `write`)
3. Crea un nuevo Space en Hugging Face (tipo: Gradio)
4. Sube los archivos de `chat-app/` al Space
5. Agrega tu API key en los Secrets del Space:
- `AI_INTEGRATIONS_OPENAI_BASE_URL`
- `AI_INTEGRATIONS_OPENAI_API_KEY`
- O bien, usa `OPENAI_API_KEY` con tu propia clave de OpenAI
## Structure
```text
artifacts-monorepo/
├── chat-app/ # App Python/Gradio - Chatbot de IA
│ ├── app.py # Aplicación principal Gradio
│ ├── requirements.txt # Dependencias Python
│ └── README.md # Configuración Hugging Face Spaces
├── artifacts/ # Deployable applications (Node.js)
│ └── api-server/ # Express API server
├── lib/ # Shared libraries
│ ├── api-spec/ # OpenAPI spec + Orval codegen config
│ ├── api-client-react/ # Generated React Query hooks
│ ├── api-zod/ # Generated Zod schemas from OpenAPI
│ └── db/ # Drizzle ORM schema + DB connection
├── scripts/ # Utility scripts
└── package.json # Root package
```
## Packages
### `artifacts/api-server` (`@workspace/api-server`)
Express 5 API server (Node.js backend).
### `lib/db` (`@workspace/db`)
Database layer using Drizzle ORM with PostgreSQL.
### `lib/api-spec` (`@workspace/api-spec`)
OpenAPI 3.1 spec and Orval codegen config.