fix: game service api block when a game is running
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
- 支持盲注、四条街下注、弃牌、过牌、跟注、下注、加注、全下、边池和摊牌结算。
|
||||
- 支持本地 Agent 和 HTTP Agent。
|
||||
- 支持 Human Agent 和 OpenAI-compatible AI Agent 的终端过程输出。
|
||||
- 游戏运行中可以并发查询状态;查询返回上一手完成后的稳定快照。
|
||||
|
||||
## 运行服务
|
||||
|
||||
@@ -51,6 +52,12 @@ curl -X POST http://127.0.0.1:8000/games/demo/hands/run \
|
||||
curl http://127.0.0.1:8000/games/demo
|
||||
```
|
||||
|
||||
也可以使用单数别名:
|
||||
|
||||
```bash
|
||||
curl http://127.0.0.1:8000/game/demo
|
||||
```
|
||||
|
||||
## HTTP Agent 协议
|
||||
|
||||
玩家配置可以使用远程 HTTP Agent:
|
||||
@@ -62,12 +69,19 @@ curl http://127.0.0.1:8000/games/demo
|
||||
"agent": {
|
||||
"type": "http",
|
||||
"endpoint": "http://127.0.0.1:9101",
|
||||
"timeout_seconds": 10
|
||||
"timeout_seconds": 10,
|
||||
"game_update_timeout_seconds": 3,
|
||||
"retries": 2,
|
||||
"retry_backoff_seconds": 0.25
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
服务会向 `endpoint` 发送当前行动玩家的观察 JSON。Agent 返回:
|
||||
服务会向 `endpoint + /game` 推送每手开始时的游戏快照,向 `endpoint + /act` 发送当前行动玩家的观察 JSON。`endpoint` 也可以传入历史形式的 `/act` 或 `/game` 后缀,服务会归一化为 base URL。
|
||||
|
||||
同一个 HTTP Agent endpoint 不能同时被不同游戏占用;后创建的游戏会返回错误。服务会给 HTTP Agent 请求自动重试,`/act` 重试仍失败时,规则引擎会按 `check > call > fold` 选择默认动作,避免整桌卡死。
|
||||
|
||||
Agent 返回:
|
||||
|
||||
```json
|
||||
{"action": "call"}
|
||||
|
||||
Reference in New Issue
Block a user