# 🎉 LiveKit Voice AI - 局域网测试最终方案

## ✅ 服务状态

```
✅ Agent Worker:     PID 74404 (voice-ai-agent, 已注册)
✅ FunASR STT:      localhost:8080 (healthy)
✅ LiveKit Server:  localhost:7880 (Docker)
✅ HTTP Server:     localhost:8877 (运行中)
```

## 🔗 访问地址

### 方式一：浏览器测试（推荐）📱
**手机浏览器打开:**
```
http://192.168.31.229:8877/web-test.html
```

### 方式二：React Native App
```bash
npx react-native run-ios --device
```

### 方式三：在线 Playground
```
https://livekit-agent-playground.vercel.app/
```

## 🔑 连接信息

```
Server URL: ws://192.168.31.229:7880
Room:       voice-ai-meeting
Token:      eyJhbG...ajh4
Identity:   phone-user
```

## 📱 手机测试步骤

1. **确保手机和 Mac 在同一 WiFi**
2. **打开手机浏览器** (Safari/Chrome)
3. **访问:** `http://192.168.31.229:8877/web-test.html`
4. **点击"连接"按钮** - 观察状态变为"已连接 ✓"
5. **按住麦克风按钮** - 说话后松开
6. **听 Agent 回复** - Edge TTS 语音输出

## ⚠️ 如果无法访问

### 检查防火墙
```bash
# macOS 系统设置 → 网络 → 防火墙
# 临时关闭测试: sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
```

### 检查服务
```bash
lsof -i :8877  # 应该看到 python 进程
curl -s http://127.0.0.1:8877/web-test.html | head -5  # 应该返回 HTML
```

### 获取新 Token
```bash
source ~/s2s-env/bin/activate
python3 /Users/leo/.hermes/workspace/livekit-agents/gen_token.py
```

## 📁 文件位置

- 测试页面: `/Users/leo/.hermes/workspace/livekit-agents/web-test.html`
- Token 生成: `python3 gen_token.py room identity`
- Agent 启动: `python3 agent_server.py start`
