🎮

AI 合作与博弈游戏

⚠️ 后端未连接 ({{serverError || '点击查看详情'}}) ✅ 后端已连接

🎭 AI 角色管理

配置参与博弈的 AI 角色及其人设与模型选择

⚠️ 以下角色的 Provider/模型组合无效,请编辑后保存:{{invalidRoles.map(r=>r.name).join('、')}}

{{testResultMsg}}

{{role.name[0]}}
{{role.name}}
{{getModelName(role.providerId, role.modelId)}}
Provider{{getProviderName(role.providerId)}}
模型{{getModelName(role.providerId, role.modelId)}}
温度{{role.temperature}}
{{role.prompt}}

⚙️ 规则配置

选择预设方案或自定义博弈参数

阶段开关
说明:当“决策行为可见/惩罚行为可见”关闭时,该行为仅对行为发起者(及被惩罚者)可见,其他 AI 不可见。
已预设:{{(roundRulePlan||[]).filter((x,i)=>i>0&&x).length}} / {{currentRuleSet.rounds}} 回合
收益公式: ({{currentRuleSet.contributionCap}} - 投入) + (公共池总额 × {{currentRuleSet.multiplier}} ÷ 参与人数)
{{game.currentRound}} / {{currentRuleSet.rounds}} 轮 {{phaseLabel}} 🤔 {{game.processingAI}} 思考中… 决策{{game.roundRule.decisionVisible ? '公开' : '隐藏'}} · 惩罚{{game.roundRule.punishVisible ? '公开' : '隐藏'}} 角色配置待修复:{{invalidRoles.length}} 个
参与者
{{role.name[0]}}
{{role.name}}
{{getTotal(role.id)}} 分
{{game.status==='idle'?'点击"开始游戏"开始博弈实验 🚀':'暂无消息'}}
{{msg.content}}
📊 第 {{msg.round}} 轮结算
{{getRoleName(msg.actorId)[0]}}
{{getRoleName(msg.actorId)}} 🔒 → {{getRoleName(msg.targetId)}} 🤝 承诺 ✅ 决策 ⚡ 惩罚 → {{getRoleName(msg.targetId)}} R{{msg.round}}
{{msg.content}}
本轮决策
等待中…
{{getRoleName(d.roleId)[0]}}
{{getRoleName(d.roleId)}}
投入 {{d.contribution}} / {{(game.roundRule||currentRuleSet).contributionCap}}
总投入{{currentRoundSummary.totalContrib}}
公共池 (×{{(game.roundRule||currentRuleSet).multiplier}}){{currentRoundSummary.poolValue.toFixed(1)}}
人均分成{{currentRoundSummary.perPerson.toFixed(1)}}
累计排行
{{i+1}}
{{getRoleName(s.roleId)[0]}}
{{getRoleName(s.roleId)}} {{s.total.toFixed(1)}}

📊 统计分析

切换 AI 视角:

{{getRoleName(selectedAIView)}} 的完整视角

📋 每轮决策记录
轮次投入承诺 违约惩罚本轮得分累计
R{{row.round}} {{row.contribution}} {{row.promise||'—'}} {{row.brokePromise?'是':'—'}} {{row.punished||'—'}} {{row.delta>=0?'+':''}}{{row.delta.toFixed(1)}} {{row.total.toFixed(1)}}
💬 沟通记录 (该AI可见的)
{{getRoleName(msg.actorId)}} 🔒→{{getRoleName(msg.targetId)}} ✅ 决策 ⚡ 惩罚→{{getRoleName(msg.targetId)}} 🤝 承诺 📢 公开 R{{msg.round}}
{{msg.content}}
暂无记录
🔍 当前轮次发送给 LLM 的完整上下文
以下是与实际发送给AI模型的系统提示词完全一致的内容:
{{getAIViewFullContext(selectedAIView)}}

📚 游戏历史

📭

暂无游戏历史记录

完成一局游戏后会自动保存

{{new Date(game.timestamp).toLocaleString()}}
{{game.roleCount}} 位角色 · {{game.rounds}} 轮 · ID: {{game.id.slice(0, 16)}}...

📜 历史游戏详情

时间: {{new Date(viewingHistoryGame.timestamp).toLocaleString()}} · {{viewingHistoryGame.roles.length}} 位角色 · {{viewingHistoryGame.ruleSet.rounds}} 轮

🏆 最终得分

{{role.name}} {{(viewingHistoryGame.finalScores[role.id] || 0).toFixed(1)}}

💬 游戏记录预览 (前20条)

[R{{msg.round}}] {{msg.content}} 🧠 {{viewingHistoryGame.roles.find(r=>r.id===msg.actorId)?.name}}: {{msg.rawContent || msg.content}} 🤝 {{viewingHistoryGame.roles.find(r=>r.id===msg.actorId)?.name}}: {{msg.rawContent || msg.content}} ✅ {{viewingHistoryGame.roles.find(r=>r.id===msg.actorId)?.name}}: {{msg.rawContent || msg.content}} ⚡ {{viewingHistoryGame.roles.find(r=>r.id===msg.actorId)?.name}}: {{msg.rawContent || msg.content}} 📢 {{viewingHistoryGame.roles.find(r=>r.id===msg.actorId)?.name}}: {{msg.rawContent || msg.content}} 🔒 {{viewingHistoryGame.roles.find(r=>r.id===msg.actorId)?.name}} → {{viewingHistoryGame.roles.find(r=>r.id===msg.targetId)?.name}}: {{msg.rawContent || msg.content}} {{msg.rawContent || msg.content}}
... 还有 {{viewingHistoryGame.messages.length - 20}} 条记录,加载到游戏大厅查看完整记录 ...

📖 AI 合作与博弈游戏 — 说明

🎯 游戏背景

这是一个基于「公共物品博弈」(Public Goods Game) 的 AI 行为实验平台。多个 AI 角色在多轮博弈中做出贡献决策,观察合作、背叛、惩罚等行为如何影响最终收益。

📋 游戏规则

  • 每轮每位玩家有 {{currentRuleSet.contributionCap}} 个代币
  • 玩家选择投入 0~{{currentRuleSet.contributionCap}} 代币到公共池
  • 公共池总额 × {{currentRuleSet.multiplier}} 后平均分给所有玩家
  • 收益 = 保留代币 + 公共池分成
  • 可花费 {{currentRuleSet.punishCost}} 代币惩罚某人,对方扣 {{currentRuleSet.punishPenalty}}

🔄 游戏阶段

  1. 承诺阶段:AI 公开声明本轮打算投入多少
  2. 私聊阶段:AI 之间可以私下沟通
  3. 公开讨论:AI 在公共频道发言
  4. 决策阶段:AI 提交最终投入金额
  5. 惩罚阶段:AI 可选择惩罚背叛者
  6. 结算:计算本轮收益并累计

🤖 角色人设

每个 AI 角色有独特的人设提示词(Prompt),决定其行为风格。例如理性分析师会计算最优策略,情感型角色可能更倾向合作或报复。

⚙️ 后端配置

API Key 保存在后端 server/data/apikeys.json,前端只需选择模型和人设。请确保后端服务已启动并配置好各 Provider 的 Key。

{{editingRole.id?'编辑':'添加'}}角色

温度越高,AI 回复越随机;越低越确定

🔧 本回合规则确认

已开启“每回合手动调整”,请确认本回合参数:

🗓️ 配置所有回合规则

共 {{currentRuleSet.rounds}} 回合

保存后,每回合将直接使用对应预设规则;未预设的回合仍会弹出确认窗口。

第 {{r}} 回合
决策{{roundRulePlanDraft[r].decisionVisible ? '公开' : '隐藏'}} · 惩罚{{roundRulePlanDraft[r].punishVisible ? '公开' : '隐藏'}}

{{confirmDialog.message}}