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.
113 lines
3.5 KiB
HTML
113 lines
3.5 KiB
HTML
<!doctype html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>ai-chess</title>
|
|
<link rel="stylesheet" href="/static/vendor/chessground.base.css" />
|
|
<link rel="stylesheet" href="/static/vendor/chessground.brown.css" />
|
|
<link rel="stylesheet" href="/static/vendor/chessground.cburnett.css" />
|
|
<link rel="stylesheet" href="/static/style.css" />
|
|
</head>
|
|
<body>
|
|
<main id="layout">
|
|
<section id="board-col">
|
|
<div id="board-row">
|
|
<div id="eval-col" title="stockfish eval">
|
|
<div id="eval-fill"></div>
|
|
<div id="eval-text">0.00</div>
|
|
</div>
|
|
<div id="board"></div>
|
|
</div>
|
|
<div id="board-footer">
|
|
<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>
|
|
<div id="moves-floating">
|
|
<span class="moves-label">moves</span>
|
|
<ol id="history-list"></ol>
|
|
</div>
|
|
</section>
|
|
|
|
<aside id="chat-col">
|
|
<header class="col-header">
|
|
<span>chat</span>
|
|
<span id="chat-counter"></span>
|
|
</header>
|
|
<div id="chat-list"></div>
|
|
</aside>
|
|
</main>
|
|
|
|
<dialog id="settings-dialog">
|
|
<form method="dialog" id="settings-form">
|
|
<h3>settings</h3>
|
|
<label><input type="checkbox" name="allow_draw_resign" /> allow draw / resign</label>
|
|
<label><input type="checkbox" name="allow_illegal_moves" /> allow illegal moves</label>
|
|
<label>stockfish depth: <input type="number" name="stockfish_depth" min="6" max="30" /></label>
|
|
<menu>
|
|
<button value="cancel">cancel</button>
|
|
<button value="save" id="settings-save">save</button>
|
|
</menu>
|
|
</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>
|