chore: initial commit

- Track MiroSociety source: backend (FastAPI), frontend (Vue3/Vite), docs, configs.
- Add start.sh / deploy.sh for local dev (uv venv + npm + dev servers on 31400/31401).
- Fix pyproject.toml: missing httpx dependency.
- Tighten .gitignore: .env, .venv, node_modules, data/, *.log, uv.lock, frontend/dist, etcd.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-09-17 13:48:30 +08:00
co-authored by Claude
commit 36b0f2b660
100 changed files with 26255 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
from __future__ import annotations
from fastapi import APIRouter, Request, HTTPException
router = APIRouter(prefix="/api")
@router.get("/gallery")
async def list_gallery(request: Request, sort: str = "recent"):
sims = await request.app.state.store.list_simulations(public_only=True, sort=sort)
return {"simulations": sims}
@router.get("/gallery/{sim_id}")
async def get_gallery_item(sim_id: str, request: Request):
store = request.app.state.store
sim = await store.get_simulation(sim_id)
if not sim or not sim.get("is_public"):
raise HTTPException(404, "Simulation not found in gallery")
await store.increment_view_count(sim_id)
cached = await store.get_report(sim_id)
if cached and cached.get("status") == "ready":
return cached["report"]
narrator = request.app.state.narrator
report = await narrator.generate_report(sim_id, store)
if "error" not in report:
await store.save_report(sim_id, report)
return report