Add a button to copy a hand's situation as an AI prompt
Reviews and replays get a "copy for AI" button that builds a text describing the hand (stacks, positions, actions, pots, board, revealed cards, result and the site's own judgments) plus questions, ready to paste into an AI chat. Hidden opponent cards are left out so the evaluation is based only on what Hero could see. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3ddb0996e0
commit
d5ef2d310f
10 files changed
+294
-3
No files matched your search
@@ -364,3 +364,47 @@ test('レビュー付きCPU戦: 作成者だけが座れ、ハンドごとにレ
|
||||
assert.equal(saved.hands.length, 1);
|
||||
assert.equal(await reviews.get('../etc/passwd'), null);
|
||||
});
|
||||
|
||||
test('AI に質問する文章: Hero に見えていた情報だけでハンドの状況を書く', () => {
|
||||
const { buildHandPrompt } = require('../server/review/prompt');
|
||||
const cardText = (c) => c[0] + { s: '♠', h: '♥', d: '♦', c: '♣' }[c[1]];
|
||||
|
||||
// 全員が降りて終わる(ショーダウンなし): 相手の手札は書かない
|
||||
{
|
||||
const t = makeTable(3);
|
||||
const h = t.hand;
|
||||
act(t, 'raise', 30); // BTN
|
||||
act(t, 'fold'); // SB
|
||||
act(t, 'fold'); // BB
|
||||
const btn = h.button;
|
||||
const rec = analyzeHand(h, btn, { iterations: 100 });
|
||||
const text = buildHandPrompt(rec);
|
||||
assert.match(text, new RegExp(rec.hero.cards.map(cardText).join(' ')));
|
||||
assert.match(text, /BTN(Hero・私): レイズ to \$30/);
|
||||
assert.match(text, /ショーダウンなし/);
|
||||
for (const p of rec.players) {
|
||||
if (p.seat === btn) continue;
|
||||
assert.ok(!text.includes(p.cards.map(cardText).join(' ')), '公開されていない手札を書かない');
|
||||
}
|
||||
}
|
||||
|
||||
// ショーダウンまで行く: 場札と公開された手札を書く
|
||||
{
|
||||
const t = makeTable(2);
|
||||
const h = t.hand;
|
||||
for (let g = 0; g < 100 && !h.finished; g++) {
|
||||
if (h.toAct == null) {
|
||||
h.runoutStep();
|
||||
continue;
|
||||
}
|
||||
const o = h.options(h.toAct);
|
||||
act(t, o.canCheck ? 'check' : 'call');
|
||||
}
|
||||
const rec = analyzeHand(h, 0, { iterations: 100 });
|
||||
const text = buildHandPrompt(rec);
|
||||
assert.ok(text.includes(`リバー: ${cardText(rec.board[4])}`));
|
||||
const villain = rec.players.find((p) => p.seat !== 0);
|
||||
assert.ok(text.includes(villain.cards.map(cardText).join(' ')));
|
||||
assert.match(text, /## 質問/);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user