adityaverma977 commited on
Commit
b2c8834
·
1 Parent(s): 258a316

Update README files for HF router workflow

Browse files
Files changed (3) hide show
  1. README.md +8 -4
  2. backend/README.md +4 -2
  3. frontend/README.md +3 -2
README.md CHANGED
@@ -19,7 +19,7 @@ The current design has fully moved on from the old volcano/lava loop. The game i
19
 
20
  ## Core Idea
21
 
22
- 1. Pick 2-6 models from Groq or supported Hugging Face sources.
23
  2. Start a simulation and click the map to place the fire.
24
  3. Agents decide each tick whether to search water, collect water, extinguish fire, escape, or vote for a leader.
25
  4. Fire grows over time, but water collection and extinguishing reduce intensity.
@@ -41,12 +41,13 @@ The current design has fully moved on from the old volcano/lava loop. The game i
41
  | --- | --- |
42
  | Frontend | Next.js 16, React 19, TypeScript, Tailwind CSS v4 |
43
  | Backend | FastAPI, Python, Uvicorn |
44
- | AI | Groq models, optional Hugging Face-backed model discovery |
45
  | Realtime | WebSockets |
46
 
47
  ## Repository Layout
48
 
49
- - [backend](backend): FastAPI API, simulation engine, model state, WebSocket streaming
 
50
  - [frontend](frontend): Next.js UI, map rendering, chat feed, model selection
51
 
52
  ## Local Setup
@@ -74,7 +75,7 @@ Then open http://localhost:3000.
74
  ### Backend
75
 
76
  ```env
77
- GROQ_API_KEY=your_groq_key
78
  ALLOWED_ORIGINS=http://localhost:3000
79
  ```
80
 
@@ -109,6 +110,9 @@ Each tick the backend:
109
  ## Notes
110
 
111
  - State is kept in memory, so simulations reset when the backend restarts.
 
 
 
112
  - The UI is designed around visible cooperation, not just survival.
113
  - Old lava/volcano docs are intentionally replaced by the fire/water scenario.
114
 
 
19
 
20
  ## Core Idea
21
 
22
+ 1. Pick 2-6 supported Hugging Face router models.
23
  2. Start a simulation and click the map to place the fire.
24
  3. Agents decide each tick whether to search water, collect water, extinguish fire, escape, or vote for a leader.
25
  4. Fire grows over time, but water collection and extinguishing reduce intensity.
 
41
  | --- | --- |
42
  | Frontend | Next.js 16, React 19, TypeScript, Tailwind CSS v4 |
43
  | Backend | FastAPI, Python, Uvicorn |
44
+ | AI | Hugging Face Router chat completions |
45
  | Realtime | WebSockets |
46
 
47
  ## Repository Layout
48
 
49
+ - [app](app): FastAPI app used by the Hugging Face Space Docker runtime
50
+ - [backend](backend): Local/backend mirror of the FastAPI app for development
51
  - [frontend](frontend): Next.js UI, map rendering, chat feed, model selection
52
 
53
  ## Local Setup
 
75
  ### Backend
76
 
77
  ```env
78
+ HUGGINGFACE_API_TOKEN=your_hf_token
79
  ALLOWED_ORIGINS=http://localhost:3000
80
  ```
81
 
 
110
  ## Notes
111
 
112
  - State is kept in memory, so simulations reset when the backend restarts.
113
+ - The backend asks models for structured JSON decisions and short radio-style chat lines.
114
+ - If the Hugging Face router starts returning `402 Payment Required`, the app switches to local fallback behavior until models become available again.
115
+ - The Hugging Face Space deploys from the root `app/` package via the root `Dockerfile`.
116
  - The UI is designed around visible cooperation, not just survival.
117
  - Old lava/volcano docs are intentionally replaced by the fire/water scenario.
118
 
backend/README.md CHANGED
@@ -30,7 +30,7 @@ FastAPI server driving the fire-suppression simulation.
30
 
31
  ## Environment Variables
32
 
33
- - `GROQ_API_KEY`: Required for agent decisions.
34
  - `ALLOWED_ORIGINS`: CORS whitelist.
35
 
36
  ## Local Run
@@ -45,4 +45,6 @@ python -m uvicorn app.main:app --reload --port 8000
45
 
46
  - Simulation state is in memory.
47
  - Fire growth, extinguish rate, and movement are tuned in `app/simulation.py`.
48
- - Model decisions are generated in `app/groq_client.py`.
 
 
 
30
 
31
  ## Environment Variables
32
 
33
+ - `HUGGINGFACE_API_TOKEN` or `HF_API_TOKEN`: Required for Hugging Face router model calls.
34
  - `ALLOWED_ORIGINS`: CORS whitelist.
35
 
36
  ## Local Run
 
45
 
46
  - Simulation state is in memory.
47
  - Fire growth, extinguish rate, and movement are tuned in `app/simulation.py`.
48
+ - Model decisions are generated in `app/groq_client.py` through `https://router.huggingface.co/v1/chat/completions`.
49
+ - `/available-models` is backed by `app/hf_spaces.py` and filters a preferred model list against the live Hugging Face router catalog.
50
+ - This `backend/` app is the local development copy; the Hugging Face Space runtime uses the root `app/` package.
frontend/README.md CHANGED
@@ -4,10 +4,10 @@ Next.js UI for the fire-suppression simulation.
4
 
5
  ## What It Shows
6
 
7
- - Model selection and simulation start flow
8
  - Map-based agent positions and fire placement
9
  - Water sources, coalition links, and leader markers
10
- - Live event chat with varied team messages
11
  - End-of-game result banner with top performer info
12
 
13
  ## Run Locally
@@ -39,4 +39,5 @@ NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
39
 
40
  - The frontend expects the backend to be running before placing a fire.
41
  - If the browser shows `Failed to fetch`, verify `http://localhost:8000/wake` first.
 
42
  - The old volcano terminology has been removed from the current gameplay flow.
 
4
 
5
  ## What It Shows
6
 
7
+ - Model selection from the backend's live Hugging Face model list
8
  - Map-based agent positions and fire placement
9
  - Water sources, coalition links, and leader markers
10
+ - Live event chat with model-generated radio-style messages
11
  - End-of-game result banner with top performer info
12
 
13
  ## Run Locally
 
39
 
40
  - The frontend expects the backend to be running before placing a fire.
41
  - If the browser shows `Failed to fetch`, verify `http://localhost:8000/wake` first.
42
+ - The model picker reads `GET /available-models` from the backend and sends those model ids back into the simulation.
43
  - The old volcano terminology has been removed from the current gameplay flow.