Refresh web UI and make ML imports optional
All checks were successful
ci / tests (push) Successful in 21s

This commit is contained in:
dan
2025-12-25 09:15:10 +03:00
parent f542747d5e
commit 2499deb071
49 changed files with 4367 additions and 500 deletions

View File

@@ -280,8 +280,8 @@ def list_games() -> Dict[str, Any]:
@app.post("/games")
def create_game(payload: CreateGameRequest) -> Dict[str, Any]:
if payload.max_players < 2 or payload.max_players > 4:
raise HTTPException(status_code=400, detail="max_players must be 2-4")
if payload.max_players < 3 or payload.max_players > 4:
raise HTTPException(status_code=400, detail="max_players must be 3-4")
game = manager.create_game(payload.name, payload.max_players, created_by=payload.created_by or "host")
return _to_game_summary(game).model_dump()
@@ -361,8 +361,8 @@ async def start_game(game_id: str) -> Dict[str, Any]:
raise HTTPException(status_code=400, detail="Game already started")
slots = game.slots.get("slots", [])
names = [slot.get("name") for slot in slots if slot.get("name")]
if len(names) < 2:
raise HTTPException(status_code=400, detail="Not enough players")
if len(names) < 3:
raise HTTPException(status_code=400, detail="Not enough players (need 3-4)")
colors = ["red", "blue", "orange", "white"]
for slot, color in zip(slots, colors):
if slot.get("name"):