# Voice Agent Installation Package

Version: $VERSION
Architecture: $ARCH

## Installation

```bash
sudo ./install.sh
```

## ⚠️ Important: Configuration Required

### 1. Edit Environment Variables

```bash
sudo vi /etc/voice-agent/.env
```

Required variables:
- `WS_URL` - WebSocket server URL
- `AUTH_TOKEN` - Authentication token
- `DEVICE_ID` - Device identifier
- `CLIENT_ID` - Client identifier
- `RC_IP` - Robot controller IP
- `RC_PORT` - Robot controller port

### 2. Edit Configuration (Optional)

```bash
sudo vi /etc/voice-agent/config.yaml
```

### 3. Restart Service

```bash
sudo systemctl restart voice-agent
```

## Service Management

```bash
sudo systemctl start voice-agent    # Start
sudo systemctl stop voice-agent     # Stop
sudo systemctl restart voice-agent  # Restart
sudo systemctl status voice-agent   # Status
journalctl -u voice-agent -f        # Logs
```

## Verify Environment Variables

```bash
# Check if .env is loaded
sudo systemctl show voice-agent --property=Environment
```

## Uninstallation

```bash
sudo ./uninstall.sh
```

## Directory Structure

```
/opt/voice-agent/              # Installation directory
├── bin/                       # Executables
├── lib/                       # Libraries
│   └── third_party/          # Third-party libs
├── res/                       # Resources
│   └── audio/                # Audio files (*.wav)
├── config/                    # Config symlinks
└── logs -> /var/log/voice-agent/  # Logs directory (symlink)

/etc/voice-agent/              # Configuration directory
├── config.yaml               # Main configuration
└── .env                      # Environment variables (credentials)

/var/log/voice-agent/          # Centralized logs directory
└── voice_agent*.log          # Application log files

/opt/.env                      # Symlink to /etc/voice-agent/.env
/opt/res                       # Symlink to /opt/voice-agent/res
```

## View Logs

```bash
# Real-time system logs
journalctl -u voice-agent -f

# Application log files
tail -f /var/log/voice-agent/*.log
ls -lh /var/log/voice-agent/

# Check if logs are being written
sudo systemctl status voice-agent
```

## Verify Resources

```bash
# Check audio files
ls -lh /opt/voice-agent/res/audio/
find /opt/voice-agent/res -name "*.wav"

# Verify paths in config
grep "res/audio" /etc/voice-agent/config.yaml
```
- `/etc/voice-agent/` - Configuration (preserved on uninstall)
  - `config.yaml` - Main configuration
  - `.env` - Environment variables
- `/opt/config/` - Symlink for backward compatibility
- Logs: `journalctl -u voice-agent`
