File size: 2,098 Bytes
f69033f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# AI Game Web Viewer

Real-time web interface for monitoring AI agents playing Catan.

## 🌐 Features

- **Real-time updates** - Refreshes every second
- **Player logs** - View each AI agent's thinking and responses
- **Chat history** - See all player communications
- **Agent memories** - Monitor what each AI remembers
- **Session management** - Track multiple game sessions
- **Clean UI** - Dark theme, easy navigation

## πŸš€ Quick Start

### Automatic (Recommended)
```bash
start.bat
```
This will automatically open:
1. AI Tester window
2. Web Viewer at http://localhost:5000
3. Game console

### Manual
```bash
# Terminal 1: Start web viewer
python examples/ai_testing/web_viewer.py

# Terminal 2: Start AI tester
python examples/ai_testing/test_ai_live.py

# Terminal 3: Start game
python examples/ai_testing/play_with_prompts.py
```

Then open http://localhost:5000 in your browser.

## πŸ“¦ Requirements

```bash
pip install flask markdown
```

## 🎨 Interface

### Sidebar Navigation
- **Players** - Click to view individual AI agent logs
- **Chat History** - See all player messages
- **Agent Memories** - View saved notes
- **Session Info** - Current session details

### Main Content Area
- Updates automatically every second
- Shows player logs in formatted markdown
- Chat messages with timestamps
- Agent memories organized by player

## πŸ”„ How It Works

1. `web_viewer.py` reads from the current session directory
2. Loads `chat_history.json`, `agent_memories.json`, and `player_*.md` files
3. Updates the web interface every second via AJAX
4. No need to refresh - everything updates automatically

## πŸ“ Data Sources

All data is read from:
```
examples/ai_testing/my_games/ai_logs/session_YYYYMMDD_HHMMSS/
β”œβ”€β”€ player_a.md          # AI logs
β”œβ”€β”€ player_b.md
β”œβ”€β”€ player_c.md
β”œβ”€β”€ chat_history.json    # Chat messages
└── agent_memories.json  # AI memories
```

## 🎯 Tips

- Leave the viewer open while playing
- Switch between players to see different strategies
- Monitor chat for negotiations
- Check memories to understand AI planning