Refresh web UI and make ML imports optional
All checks were successful
ci / tests (push) Successful in 21s
All checks were successful
ci / tests (push) Successful in 21s
This commit is contained in:
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user