changes
This commit is contained in:
97
README.md
97
README.md
@@ -66,6 +66,66 @@ OPENAI_ACTA_TIMEOUT_MS=60000
|
||||
OPENAI_ACTA_MAX_CHARS=45000
|
||||
```
|
||||
|
||||
## AI Assist Modules (M1/M2/M3/M7/M10)
|
||||
|
||||
The platform now includes assist-only AI helpers for:
|
||||
|
||||
- `M1` Diagnostic suggestions per question (apply/dismiss).
|
||||
- `M2` Strategic insights and suggested field values (explicit apply only).
|
||||
- `M3` AI fit + blended score layered on deterministic recommendations.
|
||||
- `M7` Compliance playbook recommendations (no auto state/severity updates).
|
||||
- `M10` Auditor-style findings simulation from dossier + simulation data.
|
||||
|
||||
Deterministic scoring and compliance engines remain the source of truth.
|
||||
|
||||
Environment variables:
|
||||
|
||||
```bash
|
||||
OPENAI_SMART_MODEL=gpt-4.1
|
||||
OPENAI_SMART_FALLBACK_MODEL=gpt-4.1-mini
|
||||
OPENAI_SMART_TIMEOUT_MS=75000
|
||||
OPENAI_SMART_MAX_CHARS=55000
|
||||
|
||||
# Optional module overrides
|
||||
OPENAI_M1_MODEL=gpt-4.1
|
||||
OPENAI_M2_MODEL=gpt-4.1
|
||||
OPENAI_M3_MODEL=gpt-4.1
|
||||
OPENAI_M7_MODEL=gpt-4.1
|
||||
OPENAI_M10_MODEL=gpt-4.1
|
||||
```
|
||||
|
||||
Traceability:
|
||||
|
||||
- AI suggestions are persisted in `AiSuggestion` with request/response metadata.
|
||||
- Use `POST /api/ai/suggestions/{id}/decision` with `{ "decision": "accept" | "dismiss" }` to persist user action.
|
||||
|
||||
## Mercado Pago Checkout (Planes M2-M10)
|
||||
|
||||
Se agrego integracion de checkout para vender planes:
|
||||
|
||||
- `Plan 1` -> Modulos `2-4`
|
||||
- `Plan 2` -> Modulos `5-7`
|
||||
- `Plan 3` -> Modulos `8-10`
|
||||
|
||||
Variables requeridas:
|
||||
|
||||
```bash
|
||||
MP_ACCESS_TOKEN=TEST-... # token de prueba o produccion
|
||||
MP_API_BASE_URL=https://api.mercadopago.com
|
||||
MP_PLAN_DURATION_DAYS=30
|
||||
```
|
||||
|
||||
Flujo:
|
||||
|
||||
- `GET /api/payments/checkout?plan=plan-1|plan-2|plan-3` crea preferencia y redirige a Mercado Pago.
|
||||
- `GET /api/payments/checkout/return` procesa callback y regresa a `/dashboard`.
|
||||
- `POST /api/payments/mercadopago/webhook` sincroniza pagos aprobados.
|
||||
|
||||
DB:
|
||||
|
||||
- Nuevos modelos Prisma: `ModulePlanPurchase`, `ModulePlanSubscription`.
|
||||
- Ejecuta migraciones antes de usar el checkout en un entorno nuevo.
|
||||
|
||||
## Local CLI Script (PDF -> OCR/text -> AI)
|
||||
|
||||
Run:
|
||||
@@ -87,9 +147,17 @@ Add these vars to `.env`:
|
||||
```bash
|
||||
LICITAYA_API_KEY=your-licitaya-api-key
|
||||
LICITAYA_BASE_URL=https://<licitaya-base-url>
|
||||
LICITAYA_TEST_ENDPOINT=/tender/search?items=10&page=1
|
||||
LICITAYA_TEST_ENDPOINT=/tender/SCRZJ
|
||||
LICITAYA_ACCEPT=application/json
|
||||
LICITAYA_TIMEOUT_MS=20000
|
||||
LICITAYA_ALLOW_EMPTY_SEARCH=true
|
||||
LICITAYA_ENABLED=true
|
||||
LICITAYA_ITEMS_PER_PAGE=50
|
||||
LICITAYA_MAX_PAGES_PER_RUN=3
|
||||
LICITAYA_SYNC_INTERVAL_HOURS=12
|
||||
LICITAYA_DATE_OFFSET_DAYS=1
|
||||
LICITAYA_DATE_FALLBACK_WINDOW_DAYS=3
|
||||
LICITAYA_FALLBACK_TENDER_IDS=SCRZJ
|
||||
```
|
||||
|
||||
Run the connection test:
|
||||
@@ -132,4 +200,29 @@ Notes:
|
||||
|
||||
- The script sends your key in header `X-API-KEY`.
|
||||
- It prints status code + response preview.
|
||||
- A non-2xx response exits with code `1` (useful for CI checks).
|
||||
- For `/tender/search`, you can allow an empty 404 as connectivity success with `LICITAYA_ALLOW_EMPTY_SEARCH=true` or `--allow-empty-search`.
|
||||
- A non-2xx response exits with code `1` unless empty-search mode is allowed.
|
||||
|
||||
## Compliance Cron + Persistence (M7)
|
||||
|
||||
This project now persists official-regulations verification state and suggestions in Postgres.
|
||||
|
||||
Apply migration and regenerate Prisma client:
|
||||
|
||||
```bash
|
||||
npm run prisma:migrate
|
||||
npm run prisma:generate
|
||||
```
|
||||
|
||||
Scheduler endpoints:
|
||||
|
||||
- `GET/POST /api/cron/licitations-sync` (includes periodic regulations verification by default)
|
||||
- `GET/POST /api/cron/regulations-verify` (regulations-only run)
|
||||
|
||||
Accepted auth for cron routes:
|
||||
|
||||
- Header `x-sync-token: $LICITATIONS_SYNC_TOKEN`
|
||||
- Header `Authorization: Bearer $CRON_SECRET` (Vercel cron compatible)
|
||||
- Query param `?token=$LICITATIONS_SYNC_TOKEN` (fallback)
|
||||
|
||||
Vercel schedules are included in [`vercel.json`](./vercel.json).
|
||||
|
||||
Reference in New Issue
Block a user