Spaces:
Build error
Build error
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,106 +1,8 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
- **Revenue telemetry** – aggregates live revenue metrics + opportunities by querying Supabase.
|
| 10 |
-
- **Book empire triggers** – proxies to Supabase functions for autonomous book pipeline and market research.
|
| 11 |
-
- **Simple API key auth** – protect every endpoint (except `/health`) with a shared `AIS3_API_KEY`.
|
| 12 |
-
|
| 13 |
-
## Directory Structure
|
| 14 |
-
|
| 15 |
-
```
|
| 16 |
-
hAPI_face2/
|
| 17 |
-
├─ Dockerfile
|
| 18 |
-
├─ package.json
|
| 19 |
-
├─ tsconfig.json
|
| 20 |
-
├─ .env.example
|
| 21 |
-
├─ README.md
|
| 22 |
-
└─ src/
|
| 23 |
-
├─ server.ts # Express bootstrap + middleware
|
| 24 |
-
├─ routes/
|
| 25 |
-
│ ├─ river.ts # /api/river/* endpoints
|
| 26 |
-
│ ├─ flows.ts # /api/flows/* endpoints
|
| 27 |
-
│ ├─ money.ts # /api/money/* endpoints
|
| 28 |
-
│ └─ bookEmpire.ts # /api/book-empire/* endpoints
|
| 29 |
-
└─ supabase.ts # Supabase client helpers
|
| 30 |
-
```
|
| 31 |
-
|
| 32 |
-
## Quick Start (local)
|
| 33 |
-
|
| 34 |
-
```bash
|
| 35 |
-
cp .env.example .env # fill with Supabase + API key values
|
| 36 |
-
npm install
|
| 37 |
-
npm run dev # hot reload with tsx
|
| 38 |
-
```
|
| 39 |
-
|
| 40 |
-
- Health check: `GET http://localhost:7860/health`
|
| 41 |
-
- Authenticated call: `curl -H "Authorization: Bearer $AIS3_API_KEY" http://localhost:7860/api/river/tools`
|
| 42 |
-
|
| 43 |
-
## Deploy to Hugging Face Space
|
| 44 |
-
|
| 45 |
-
1. Create a **Docker** Space (e.g., `acecalisto3/hAPI_face2`). Via CLI:
|
| 46 |
-
```bash
|
| 47 |
-
huggingface-cli repo create acecalisto3/hAPI_face2 \
|
| 48 |
-
--type space \
|
| 49 |
-
--sdk docker \
|
| 50 |
-
--private
|
| 51 |
-
```
|
| 52 |
-
2. Push this repo to the Space (or mirror via `huggingface-cli`).
|
| 53 |
-
3. Configure secrets in the Space Settings → *New secret*:
|
| 54 |
-
- `SUPABASE_URL`
|
| 55 |
-
- `SUPABASE_SERVICE_ROLE_KEY`
|
| 56 |
-
- `AIS3_API_KEY`
|
| 57 |
-
- Optional function overrides (`SUPABASE_FLOW_EXECUTOR`, ...)
|
| 58 |
-
4. The Space will build automatically; once running, copy the public URL (e.g. `https://acecalisto3-hapi-face2.hf.space`).
|
| 59 |
-
5. Update the Supabase `ais3-bridge` function env:
|
| 60 |
-
|
| 61 |
-
```bash
|
| 62 |
-
supabase secrets set AIS3_API_URL=https://acecalisto3-hapi-face2.hf.space/api
|
| 63 |
-
supabase secrets set AIS3_API_KEY=<same-key>
|
| 64 |
-
supabase functions deploy ais3-bridge
|
| 65 |
-
```
|
| 66 |
-
|
| 67 |
-
## Environment Variables
|
| 68 |
-
|
| 69 |
-
| Name | Description |
|
| 70 |
-
|------|-------------|
|
| 71 |
-
| `SUPABASE_URL` | Supabase project URL |
|
| 72 |
-
| `SUPABASE_SERVICE_ROLE_KEY` | Service role key used for trusted server-side access |
|
| 73 |
-
| `AIS3_API_KEY` | Shared bearer token expected from consumers |
|
| 74 |
-
| `SUPABASE_FLOW_EXECUTOR` | (optional) Supabase function that executes flows (default `flow-executor`) |
|
| 75 |
-
| `SUPABASE_AUTOMATION_FUNCTION` | (optional) Function that runs revenue automation (default `automated-revenue-generator`) |
|
| 76 |
-
| `SUPABASE_BOOK_ORCHESTRATOR` | (optional) Function that orchestrates book pipeline (default `wealth-river-orchestrator`) |
|
| 77 |
-
| `SUPABASE_MARKET_RESEARCH` | (optional) Function for book idea discovery (default `market-research`) |
|
| 78 |
-
| `SUPABASE_BOOK_GENERATOR` | (optional) Function that drafts a book manually (default `product-generation`) |
|
| 79 |
-
|
| 80 |
-
## API Overview
|
| 81 |
-
|
| 82 |
-
- `GET /health` – readiness probe (no auth)
|
| 83 |
-
- `GET /api/river/tools` – list monetized tools
|
| 84 |
-
- `GET /api/river/analytics/:toolId` – aggregate revenue + subscriber metrics for a tool
|
| 85 |
-
- `GET /api/flows` – list automation flows (supports `status`, `type` query params)
|
| 86 |
-
- `POST /api/flows/:id/execute` – execute flow via Supabase function
|
| 87 |
-
- `POST /api/flows/:id/publish` – mark flow live
|
| 88 |
-
- `POST /api/flows/:id/duplicate` – duplicate flow
|
| 89 |
-
- `POST /api/flows/:id/archive` – archive flow
|
| 90 |
-
- `GET /api/money/revenue` – revenue metrics suite
|
| 91 |
-
- `GET /api/money/opportunities` – list revenue opportunities
|
| 92 |
-
- `POST /api/money/automate` – trigger revenue automation function
|
| 93 |
-
- `POST /api/book-empire/autonomous/start` – start autonomous book pipeline
|
| 94 |
-
- `GET /api/book-empire/autonomous/status` – latest pipeline stats
|
| 95 |
-
- `POST /api/book-empire/idea/generate` – generate market-validated book idea
|
| 96 |
-
- `POST /api/book-empire/book/generate` – kick off manual book generation flow
|
| 97 |
-
|
| 98 |
-
All authenticated endpoints must receive `Authorization: Bearer <AIS3_API_KEY>`.
|
| 99 |
-
|
| 100 |
-
## Notes
|
| 101 |
-
|
| 102 |
-
- The server gracefully handles missing Supabase tables by returning empty responses instead of crashing. Adjust queries if your schema differs.
|
| 103 |
-
- Extend `src/routes/*` to add more orchestrator endpoints as your backend grows.
|
| 104 |
-
- Hugging Face Spaces provide ephemeral storage; all state should live in Supabase.
|
| 105 |
-
|
| 106 |
-
Enjoy the flow! 🚀
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: HF LLM API
|
| 3 |
+
emoji: ☯️
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 23333
|
| 8 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|