# 快速启动脚本

## 自动设置步骤

```bash
# 1. 进入目录
cd /Users/leo/.hermes/workspace/livekit-agents/react-native

# 2. 创建新 Expo 项目
npx create-expo-app MyVoiceTest --template blank
cd MyVoiceTest

# 3. 安装 LiveKit
npm install livekit-client

# 4. 复制 App.js
cp ../App.js .

# 5. 修改配置 - 替换你的 Mac IP
sed -i '' "s|YOUR_MAC_IP|$(ifconfig | grep 'inet ' | grep -v 127.0.0.1 | head -1 | awk '{print $2}')|g" App.js

# 6. 生成 Token
TOKEN=$(python3 -c "from livekit.api import AccessToken; t = AccessToken('devkey', 'secret'); t.with_identity('user1'); print(t.to_jwt())")
sed -i '' "s|YOUR_TOKEN|$TOKEN|g" App.js

# 7. 启动
npx expo start
```

## 或者手动执行

### 步骤 1: 获取 Mac IP
```bash
ifconfig | grep "inet " | grep -v 127.0.0.1 | head -1
```

### 步骤 2: 生成 Token
```bash
source ~/s2s-env/bin/activate
python3 -c "
from livekit.api import AccessToken
token = AccessToken('devkey', 'secret')
token.with_identity('user1').with_name('Test User')
print(token.to_jwt())
"
```

### 步骤 3: 创建项目并启动
```bash
npx create-expo-app LiveKitVoiceTest
cd LiveKitVoiceTest
npm install livekit-client
# 复制 App.js 并修改配置
npx expo start
```

## 测试连接

1. 确保 LiveKit Server 运行中
2. 确保 Agent Worker 运行中
3. 手机和 Mac 在同一 WiFi
4. 扫码或点击链接打开 App
5. 点击麦克风开始对话
