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
@@ -9,6 +9,7 @@ const auth = require('./auth');
|
||||
const { TableManager, MODES } = require('./tables');
|
||||
const reviews = require('./review/store');
|
||||
const { summarize } = require('./review/summary');
|
||||
const { buildHandPrompt } = require('./review/prompt');
|
||||
|
||||
const PUBLIC = path.join(__dirname, '..', 'public');
|
||||
// 管理者専用のファイル(public の外に置き、管理者の Cookie があるときだけ返す)
|
||||
@@ -122,6 +123,17 @@ app.get('/api/reviews/:id', auth.requireAdmin, async (req, res, next) => {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
// 1ハンドの状況を AI に質問するための文章
|
||||
app.get('/api/reviews/:id/hands/:number/prompt', auth.requireAdmin, async (req, res, next) => {
|
||||
try {
|
||||
const session = await reviews.get(req.params.id);
|
||||
const hand = session && session.hands.find((h) => String(h.number) === req.params.number);
|
||||
if (!hand) return res.status(404).json({ error: '見つかりません' });
|
||||
res.json({ text: buildHandPrompt(hand) });
|
||||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/me', (req, res) => res.json({ admin: auth.isAdmin(req) }));
|
||||
app.get('/api/tables', (req, res) => res.json(tables.list(auth.isAdmin(req))));
|
||||
|
||||
Reference in new issue
Block a user