feat: prompt presets, setup dialog, /games + leaderboard, one-game gate
Backend:
- prompts.py: 5 personality presets (уличный_гопник default, профессор,
поэт, молчун, шут). Each provides voice + label + description.
build_system_prompt accepts `preset` parameter; the MCP-tools section
+ must-call-move rule is shared common tail.
- coordinator: `start_new_game` now accepts `overrides` ({white: {agent,
model, prompt}, black: {...}}) — missing fields filled randomly.
MODEL_OPTIONS published per agent.
- AppState.prompts tracks the preset id per side; persisted into game's
agents dict and PGN.
- AppState.eval_cache cleared on new_game (was per-life-of-process before).
- persistence.save_game now stores full history (with comments) and the
per-position eval cache in the game JSON.
- ChessGame.abort() — manual game termination with result='*' and
Termination='aborted'.
- New endpoints:
• GET /api/options — agents, models per agent, prompt presets.
• GET /api/stats — leaderboard aggregated from games/*.json:
per (agent, model) and per persona, with score = wins + 0.5*draws.
• POST /api/abort-game — force-end current game.
- POST /api/new-game now returns 409 when a game is in progress.
- GET /api/games[/{id}[/pgn]] also 409 while in progress — gallery is
hidden behind the one-game-at-a-time rule.
Frontend:
- New setup dialog: per-side agent / model / persona selects, swap +
random shortcuts, persona description preview, abort button inline
when current game blocks the start.
- 'games & stats' link in the board footer; greyed out while a game is
active.
- /games page reworked: leaderboard (player × model + by persona),
games table with persona labels, replay panel showing eval per ply
with prev/next/first/last + arrow-key nav.
- chess.js loadPgn → load_pgn fix consolidated; replay prefers saved
history (comments + side) over PGN parse when available.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
<span id="status-line">…</span>
|
||||
<span id="sf-pv"></span>
|
||||
<button id="live-btn" hidden>live</button>
|
||||
<a id="games-link" href="/games">games & stats</a>
|
||||
<button id="new-game">new game</button>
|
||||
<button id="settings-btn" title="settings">⚙</button>
|
||||
</div>
|
||||
@@ -53,6 +54,59 @@
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<dialog id="setup-dialog">
|
||||
<form method="dialog" id="setup-form">
|
||||
<header class="setup-header">
|
||||
<h3>new game</h3>
|
||||
<div class="setup-actions">
|
||||
<button type="button" id="swap-sides" title="swap white/black">⇄ swap</button>
|
||||
<button type="button" id="randomize" title="randomize">🎲 random</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="setup-grid">
|
||||
<fieldset class="setup-side setup-white">
|
||||
<legend>WHITE</legend>
|
||||
<label>agent
|
||||
<select name="white-agent"></select>
|
||||
</label>
|
||||
<label>model
|
||||
<select name="white-model"></select>
|
||||
</label>
|
||||
<label>persona
|
||||
<select name="white-prompt"></select>
|
||||
</label>
|
||||
<p class="setup-promptdesc" data-for="white"></p>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="setup-side setup-black">
|
||||
<legend>BLACK</legend>
|
||||
<label>agent
|
||||
<select name="black-agent"></select>
|
||||
</label>
|
||||
<label>model
|
||||
<select name="black-model"></select>
|
||||
</label>
|
||||
<label>persona
|
||||
<select name="black-prompt"></select>
|
||||
</label>
|
||||
<p class="setup-promptdesc" data-for="black"></p>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<p id="setup-warning" hidden>
|
||||
⚠ Current game is in progress.
|
||||
<button type="button" id="abort-now">abort current game</button>
|
||||
to enable a new one.
|
||||
</p>
|
||||
|
||||
<menu>
|
||||
<button value="cancel">cancel</button>
|
||||
<button value="start" id="setup-start">start game</button>
|
||||
</menu>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<script src="/static/app.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user