feat: add Docker setup and README

This commit is contained in:
2026-05-25 18:54:11 +02:00
parent d8d7e1a66f
commit da2a518f8a
3 changed files with 139 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
# OpusAgent
Servizio self-hosted per l'interazione programmatica con i modelli Anthropic
tramite Claude Code SDK, sfruttando un abbonamento Claude Pro/Max esistente.
## Architettura
Due container Docker:
- **fastapi-service** — API REST, autenticazione, coda richieste, rate limiting
- **claude-worker** — Processamento richieste via Claude Code SDK
## Setup
### Prerequisiti
- Docker e Docker Compose
- Un abbonamento Claude Pro/Max attivo
### Prima installazione
1. Copia e configura l'environment:
```bash
cp .env.example .env
# Edita .env: imposta API_KEY e le altre variabili
```
2. Autentica Claude Code nel worker:
```bash
docker compose run --rm claude-worker npx claude login
```
3. Avvia il sistema:
```bash
docker compose up -d
```
4. Verifica:
```bash
curl -H "X-Api-Key: TUA_KEY" http://localhost:8000/api/health
```
## Sviluppo locale
```bash
uv sync --all-groups
cp .env.example .env
# Edita .env
uv run dev
```
## Test
```bash
uv run pytest -v
```
## API
Documentazione completa: `http://localhost:8000/doc`
### Esempio d'uso
```bash
# Crea un argomento
curl -X POST http://localhost:8000/api/topics \
-H "X-Api-Key: TUA_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "coding", "system_prompt": "Sei un esperto sviluppatore."}'
# Invia una richiesta
curl -X POST http://localhost:8000/api/requests \
-H "X-Api-Key: TUA_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "Come implemento JWT in FastAPI?", "topic_id": "ID_TOPIC"}'
# Controlla il risultato
curl http://localhost:8000/api/requests/ID_RICHIESTA \
-H "X-Api-Key: TUA_KEY"
```