File size: 2,538 Bytes
c8ed262
 
 
 
c69a8c3
c8ed262
 
 
 
 
 
 
 
 
 
 
 
c69a8c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8ed262
 
 
 
 
c69a8c3
 
 
 
 
c8ed262
 
 
 
 
 
c69a8c3
 
c8ed262
 
 
 
 
 
c69a8c3
c8ed262
 
 
c69a8c3
c8ed262
 
 
c69a8c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# 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.