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:
+95
-2
@@ -165,7 +165,100 @@ button:hover { background: #2e2e36; }
|
||||
|
||||
dialog {
|
||||
background: #15151a; color: #e7e5e4; border: 1px solid #2a2a30;
|
||||
padding: 16px; border-radius: 6px;
|
||||
padding: 16px; border-radius: 8px;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.6);
|
||||
}
|
||||
dialog form { display: flex; flex-direction: column; gap: 10px; min-width: 320px; }
|
||||
dialog::backdrop { background: rgba(0,0,0,0.55); }
|
||||
dialog form { display: flex; flex-direction: column; gap: 12px; min-width: 320px; }
|
||||
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 0; }
|
||||
dialog h3 { margin: 0; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
|
||||
dialog select, dialog input[type="number"], dialog input[type="text"] {
|
||||
background: #1f1f25; color: #e7e5e4; border: 1px solid #34343a;
|
||||
border-radius: 4px; padding: 4px 6px; font-size: 12px;
|
||||
}
|
||||
|
||||
/* setup dialog */
|
||||
#setup-dialog { min-width: 580px; }
|
||||
.setup-header { display: flex; justify-content: space-between; align-items: center; }
|
||||
.setup-actions { display: flex; gap: 8px; }
|
||||
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
|
||||
.setup-side {
|
||||
border: 1px solid #34343a; border-radius: 6px; padding: 10px 12px;
|
||||
display: flex; flex-direction: column; gap: 8px;
|
||||
background: #1a1a20;
|
||||
}
|
||||
.setup-side legend { padding: 0 6px; font-size: 11px; letter-spacing: 0.1em; opacity: 0.8; }
|
||||
.setup-white legend { color: #e7e5e4; }
|
||||
.setup-black legend { color: #c0a060; }
|
||||
.setup-side label {
|
||||
display: flex; flex-direction: column; gap: 3px;
|
||||
font-size: 10px; opacity: 0.55; text-transform: uppercase; letter-spacing: 0.08em;
|
||||
}
|
||||
.setup-side select { font-size: 13px; opacity: 1; text-transform: none; letter-spacing: 0; }
|
||||
.setup-promptdesc {
|
||||
margin: 4px 0 0; font-size: 11px; opacity: 0.55; line-height: 1.4;
|
||||
min-height: 2.4em;
|
||||
}
|
||||
#setup-warning { background: #3a2a1a; border: 1px solid #5a4020; color: #f0c080; padding: 8px 10px; border-radius: 4px; font-size: 12px; margin: 0; }
|
||||
#setup-start { background: #3d342a; color: #f0d090; }
|
||||
#games-link { font-size: 12px; color: #c0a060; text-decoration: none; margin-right: 4px; }
|
||||
#games-link:hover { text-decoration: underline; }
|
||||
#games-link.disabled { color: #555; cursor: not-allowed; }
|
||||
#games-link.disabled:hover { text-decoration: none; }
|
||||
|
||||
/* ============ /games page ============ */
|
||||
#games-page {
|
||||
max-width: 1500px; margin: 0 auto; padding: 24px;
|
||||
display: flex; flex-direction: column; gap: 18px;
|
||||
}
|
||||
#games-page-header {
|
||||
display: flex; align-items: baseline; gap: 16px;
|
||||
border-bottom: 1px solid #2a2a30; padding-bottom: 12px;
|
||||
}
|
||||
#games-page-header h1 { margin: 0; font-size: 18px; letter-spacing: 0.05em; }
|
||||
#games-count { opacity: 0.55; font-size: 12px; }
|
||||
#back-link { color: #c0a060; text-decoration: none; }
|
||||
#back-link:hover { text-decoration: underline; }
|
||||
|
||||
#blocked-banner {
|
||||
background: #3a2a1a; border: 1px solid #5a4020; color: #f0c080;
|
||||
padding: 12px 14px; border-radius: 6px;
|
||||
}
|
||||
#blocked-banner a { color: #f0d090; }
|
||||
|
||||
#page-grid {
|
||||
display: grid; grid-template-columns: 420px 1fr; gap: 18px;
|
||||
}
|
||||
#stats-pane, #games-pane {
|
||||
background: #15151a; border: 1px solid #2a2a30; border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
#stats-pane table, #games-pane table {
|
||||
width: 100%; border-collapse: collapse; font-size: 12.5px;
|
||||
}
|
||||
#stats-pane th, #stats-pane td, #games-pane th, #games-pane td {
|
||||
padding: 6px 10px; text-align: left; border-bottom: 1px solid #1f1f24;
|
||||
}
|
||||
#stats-pane th, #games-pane th {
|
||||
font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
|
||||
opacity: 0.55; font-weight: 600;
|
||||
}
|
||||
#stats-pane td:nth-child(n+2), #games-pane td:nth-child(n+4) { font-variant-numeric: tabular-nums; }
|
||||
.persona { font-size: 10px; opacity: 0.5; }
|
||||
.result-1-0 { color: #f0eee6; font-weight: 700; }
|
||||
.result-0-1 { color: #c0a060; font-weight: 700; }
|
||||
.result-1_2-1_2 { color: #88c0a0; font-weight: 700; }
|
||||
.result-_ { opacity: 0.4; }
|
||||
|
||||
/* replay */
|
||||
#replay-wrap { border-top: 1px solid #2a2a30; padding: 14px; }
|
||||
#replay-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; }
|
||||
#replay-board { width: 360px; aspect-ratio: 1/1; }
|
||||
#replay-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
|
||||
#replay-controls { display: flex; gap: 6px; align-items: center; font-size: 12px; }
|
||||
#replay-controls button { padding: 2px 8px; }
|
||||
#replay-ply { opacity: 0.6; margin-left: 8px; }
|
||||
#replay-eval { margin-left: auto; font-weight: 700; color: #f0d090; }
|
||||
#replay-history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; max-height: 540px; overflow-y: auto; }
|
||||
.replay-row { font-size: 12px; }
|
||||
#replay-close { background: #25252b; }
|
||||
|
||||
Reference in New Issue
Block a user