From 6e45303aeac808f47b25908989b7610cd35c441c Mon Sep 17 00:00:00 2001 From: rahulpscraftech360 Date: Fri, 12 Sep 2025 17:43:16 +0530 Subject: [PATCH 1/3] configred local db abd reddis for manger api --- main/manager-api/README.md | 191 +++++++++-- main/manager-api/dev-setup.ps1 | 82 +++++ main/manager-api/docker-compose.yml | 90 +++++ .../src/main/resources/application-dev.yml | 41 ++- main/mqtt-gateway/config/mqtt.json | 4 +- main/xiaozhi-server/client.py | 4 +- .../docs/mqtt-gateway-message-flow.md | 323 ++++++++++++++++++ 7 files changed, 694 insertions(+), 41 deletions(-) create mode 100644 main/manager-api/dev-setup.ps1 create mode 100644 main/manager-api/docker-compose.yml create mode 100644 main/xiaozhi-server/docs/mqtt-gateway-message-flow.md diff --git a/main/manager-api/README.md b/main/manager-api/README.md index e8822b8ea..cf8153009 100644 --- a/main/manager-api/README.md +++ b/main/manager-api/README.md @@ -1,26 +1,179 @@ This is a development document. If you need to deploy the Xiaozhi server, [click here to view the deployment tutorial](../../README.md#deployment-documentation) -# Project Introduction +# XiaoZhi ESP32 Manager API -run app +This project is developed based on the SpringBoot framework and serves as the backend API for the XiaoZhi ESP32 management system. -npm run serve -manager-api: This project is developed based on the SpringBoot framework. +## Development Environment Requirements + +- **JDK 21+** +- **Maven 3.8+** +- **Docker & Docker Compose** (for local database and cache) +- **MySQL 8.0+** (via Docker) +- **Redis 7.0+** (via Docker) + +## Quick Start (Development Mode) + +### Option 1: Automated Setup (Recommended) + +```powershell +# Run the automated setup script +.\dev-setup.ps1 + +# Then start the application +mvn spring-boot:run "-Dspring-boot.run.arguments=--spring.profiles.active=dev" +``` + +### Option 2: Manual Setup + +#### Step 1: Start Docker Containers + +First, start the required MySQL and Redis containers: + +```bash +# Navigate to the manager-api directory +cd D:\cheekofinal\xiaozhi-esp32-server\main\manager-api + +# Start Docker containers (MySQL, Redis, phpMyAdmin, Redis Commander) +docker-compose up -d + +# Verify containers are running +docker-compose ps +``` + +#### Step 2: Run the Spring Boot Application + +```bash +# Clean and compile the project +mvn clean compile + +# Run the application with dev profile +mvn spring-boot:run "-Dspring-boot.run.arguments=--spring.profiles.active=dev" +``` + +## Docker Services + +The `docker-compose.yml` includes the following services: + +| Service | Port | Description | Credentials | +|---------|------|-------------|--------------| +| **manager-api-db** (MySQL) | 3307 | MySQL database | User: `manager`
Password: `managerpassword`
Database: `manager_api` | +| **manager-api-redis** | 6380 | Redis cache | Password: `redispassword` | +| **phpMyAdmin** | 8080 | MySQL web interface | User: `root`
Password: `rootpassword` | +| **redis-commander** | 8081 | Redis web interface | Auto-configured | + +## Access Points + +- **API Documentation**: http://localhost:8002/xiaozhi/doc.html +- **Application Base URL**: http://localhost:8002/toy +- **phpMyAdmin**: http://localhost:8080 +- **Redis Commander**: http://localhost:8081 + +## Configuration + +The development configuration is located in: +``` +src/main/resources/application-dev.yml +``` + +This configuration is set up to use the local Docker containers: +- MySQL on localhost:3307 +- Redis on localhost:6380 + +## Database Management + +### Manual Database Connection +```bash +# Connect to MySQL container +docker exec -it manager-api-db mysql -u manager -p'managerpassword' manager_api + +# Connect to Redis container +docker exec -it manager-api-redis redis-cli -a redispassword +``` + +### Database Migration +The application uses Liquibase for database migrations. Migrations run automatically on startup. + +## Troubleshooting + +### Container Issues +```bash +# Check container logs +docker-compose logs manager-api-db +docker-compose logs manager-api-redis + +# Restart containers +docker-compose restart + +# Stop and remove all containers +docker-compose down + +# Stop and remove containers with volumes +docker-compose down -v +``` + +### Application Issues +```bash +# Check if ports are available +netstat -an | findstr :8002 +netstat -an | findstr :3307 +netstat -an | findstr :6380 + +# Clean Maven build +mvn clean install +``` + +### Common Error Solutions + +1. **Port Conflicts**: If ports 3307, 6380, 8080, or 8081 are in use, modify the ports in `docker-compose.yml` + +2. **Database Connection Failed**: + - Ensure Docker containers are running + - Wait for MySQL health check to pass (can take 30-60 seconds) + - Check if credentials match in `application-dev.yml` + +3. **Redis Connection Failed**: + - Verify Redis container is healthy + - Check Redis password configuration + +## Development Workflow + +1. **First Time Setup**: + ```bash + docker-compose up -d + mvn clean compile + mvn spring-boot:run "-Dspring-boot.run.arguments=--spring.profiles.active=dev" + ``` + +2. **Daily Development**: + ```bash + # Start containers (if not running) + docker-compose start + + # Run application + mvn spring-boot:run "-Dspring-boot.run.arguments=--spring.profiles.active=dev" + ``` + +3. **Cleanup**: + ```bash + # Stop application (Ctrl+C) + # Stop containers + docker-compose stop + ``` + +## Project Structure When developing, use a code editor and select the `manager-api` folder as the project directory when importing the project. -# Development Environment - -JDK 21 -Maven 3.8+ -MySQL 8.0+ -Redis 5.0+ -Vue 3.x - -# API Documentation - -After starting, open: http://localhost:8002/xiaozhi/doc.html - -to run app - -mvn spring-boot:run +``` +manager-api/ +├── docker-compose.yml # Docker services configuration +├── src/main/resources/ +│ ├── application.yml # Base configuration +│ ├── application-dev.yml # Development configuration +│ └── application-prod.yml # Production configuration +├── docker/ +│ ├── mysql/init/ # MySQL initialization scripts +│ └── redis/ # Redis configuration +└── target/ # Compiled classes +``` diff --git a/main/manager-api/dev-setup.ps1 b/main/manager-api/dev-setup.ps1 new file mode 100644 index 000000000..74db984bf --- /dev/null +++ b/main/manager-api/dev-setup.ps1 @@ -0,0 +1,82 @@ +# XiaoZhi Manager API - Development Setup Script +# This script sets up the development environment for the Manager API + +Write-Host "🚀 XiaoZhi Manager API Development Setup" -ForegroundColor Green +Write-Host "=======================================" -ForegroundColor Green + +# Check if Docker is running +Write-Host "📦 Checking Docker..." -ForegroundColor Yellow +try { + docker --version | Out-Null + Write-Host "✅ Docker is available" -ForegroundColor Green +} catch { + Write-Host "❌ Docker is not available. Please install Docker Desktop and try again." -ForegroundColor Red + exit 1 +} + +# Check if Maven is available +Write-Host "🔨 Checking Maven..." -ForegroundColor Yellow +try { + mvn --version | Out-Null + Write-Host "✅ Maven is available" -ForegroundColor Green +} catch { + Write-Host "❌ Maven is not available. Please install Maven and try again." -ForegroundColor Red + exit 1 +} + +# Start Docker containers +Write-Host "🐳 Starting Docker containers..." -ForegroundColor Yellow +docker-compose up -d + +if ($LASTEXITCODE -eq 0) { + Write-Host "✅ Docker containers started successfully" -ForegroundColor Green +} else { + Write-Host "❌ Failed to start Docker containers" -ForegroundColor Red + exit 1 +} + +# Wait for containers to be healthy +Write-Host "⏳ Waiting for containers to be healthy..." -ForegroundColor Yellow +$timeout = 60 +$elapsed = 0 +do { + $status = docker-compose ps --services --filter "status=running" | Measure-Object -Line + if ($status.Lines -eq 4) { + Write-Host "✅ All containers are running" -ForegroundColor Green + break + } + Start-Sleep -Seconds 2 + $elapsed += 2 + Write-Host "." -NoNewline -ForegroundColor Yellow +} while ($elapsed -lt $timeout) + +if ($elapsed -ge $timeout) { + Write-Host "`n⚠️ Containers may still be starting. Check with 'docker-compose ps'" -ForegroundColor Yellow +} else { + Write-Host "" +} + +# Display container status +Write-Host "📋 Container Status:" -ForegroundColor Cyan +docker-compose ps + +Write-Host "`n🌐 Service URLs:" -ForegroundColor Cyan +Write-Host " • API Documentation: http://localhost:8002/xiaozhi/doc.html" -ForegroundColor White +Write-Host " • Application: http://localhost:8002/toy" -ForegroundColor White +Write-Host " • phpMyAdmin: http://localhost:8080" -ForegroundColor White +Write-Host " • Redis Commander: http://localhost:8081" -ForegroundColor White + +Write-Host "`n🔑 Database Credentials:" -ForegroundColor Cyan +Write-Host " • MySQL: manager/managerpassword @ localhost:3307" -ForegroundColor White +Write-Host " • Redis: redispassword @ localhost:6380" -ForegroundColor White + +Write-Host "`n🚀 To start the application, run:" -ForegroundColor Green +Write-Host " mvn spring-boot:run `"-Dspring-boot.run.arguments=--spring.profiles.active=dev`"" -ForegroundColor Yellow + +Write-Host "`n📋 Quick Commands:" -ForegroundColor Cyan +Write-Host " • Check containers: docker-compose ps" -ForegroundColor White +Write-Host " • View logs: docker-compose logs [service-name]" -ForegroundColor White +Write-Host " • Stop containers: docker-compose stop" -ForegroundColor White +Write-Host " • Remove containers: docker-compose down" -ForegroundColor White + +Write-Host "`n✨ Setup completed successfully!" -ForegroundColor Green diff --git a/main/manager-api/docker-compose.yml b/main/manager-api/docker-compose.yml new file mode 100644 index 000000000..6c9d22433 --- /dev/null +++ b/main/manager-api/docker-compose.yml @@ -0,0 +1,90 @@ +version: '3.8' + +services: + # MySQL Database + manager-api-db: + image: mysql:8.0 + container_name: manager-api-db + restart: always + environment: + MYSQL_ROOT_PASSWORD: rootpassword + MYSQL_DATABASE: manager_api + MYSQL_USER: manager + MYSQL_PASSWORD: managerpassword + TZ: Asia/Shanghai + ports: + - "3307:3306" # Using 3307 to avoid conflicts with other MySQL instances + volumes: + - mysql_data:/var/lib/mysql + - ./docker/mysql/init:/docker-entrypoint-initdb.d # For initialization scripts + command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + timeout: 20s + interval: 10s + retries: 10 + networks: + - manager-api-network + + # Redis Cache + manager-api-redis: + image: redis:7-alpine + container_name: manager-api-redis + restart: always + environment: + TZ: Asia/Shanghai + ports: + - "6380:6379" # Using 6380 to avoid conflicts with other Redis instances + volumes: + - redis_data:/data + - ./docker/redis/redis.conf:/usr/local/etc/redis/redis.conf # Optional custom config + command: redis-server --appendonly yes --requirepass redispassword + healthcheck: + test: ["CMD", "redis-cli", "auth", "redispassword", "ping"] + interval: 10s + timeout: 5s + retries: 3 + networks: + - manager-api-network + + # Redis Commander (Optional - Web UI for Redis) + redis-commander: + image: rediscommander/redis-commander:latest + container_name: manager-api-redis-commander + restart: unless-stopped + environment: + REDIS_HOSTS: local:manager-api-redis:6379:0:redispassword + ports: + - "8081:8081" + depends_on: + - manager-api-redis + networks: + - manager-api-network + + # phpMyAdmin (Optional - Web UI for MySQL) + phpmyadmin: + image: phpmyadmin/phpmyadmin + container_name: manager-api-phpmyadmin + restart: unless-stopped + environment: + PMA_HOST: manager-api-db + PMA_PORT: 3306 + PMA_USER: root + PMA_PASSWORD: rootpassword + MYSQL_ROOT_PASSWORD: rootpassword + ports: + - "8080:80" + depends_on: + - manager-api-db + networks: + - manager-api-network + +volumes: + mysql_data: + driver: local + redis_data: + driver: local + +networks: + manager-api-network: + driver: bridge diff --git a/main/manager-api/src/main/resources/application-dev.yml b/main/manager-api/src/main/resources/application-dev.yml index 195ff5fa6..995bf0d16 100644 --- a/main/manager-api/src/main/resources/application-dev.yml +++ b/main/manager-api/src/main/resources/application-dev.yml @@ -10,21 +10,21 @@ knife4j: # Server configuration server: - secret: d153e93c-bb2f-42e7-8045-a1ee47a1dcfc + secret: a3c1734a-1efe-4ab7-8f43-98f88b874e4b spring: datasource: druid: - #MySQL - # driver-class-name: com.mysql.cj.jdbc.Driver - # # Railway MySQL Configuration - Updated for Railway database - # url: jdbc:mysql://yamanote.proxy.rlwy.net:16958/railway?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=true&allowPublicKeyRetrieval=true - # username: root - # password: cTefiuLmZSMqGpcQImUmBIsUBhNyUvrK + #MySQL - Local Docker Configuration driver-class-name: com.mysql.cj.jdbc.Driver - # Railway MySQL Configuration - Updated for Railway database - url: jdbc:mysql://crossover.proxy.rlwy.net:56145/railway?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=true&allowPublicKeyRetrieval=true - username: root - password: XjOWQwtGNcoMIELTjoMoaaBTfKiBjVcA + # Local Docker MySQL Configuration + url: jdbc:mysql://localhost:3307/manager_api?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false&allowPublicKeyRetrieval=true + username: manager + password: managerpassword + + # Railway MySQL Configuration (commented out for local development) + # url: jdbc:mysql://crossover.proxy.rlwy.net:56145/railway?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=true&allowPublicKeyRetrieval=true + # username: root + # password: XjOWQwtGNcoMIELTjoMoaaBTfKiBjVcA initial-size: 10 max-active: 100 @@ -49,15 +49,20 @@ spring: multi-statement-allow: true data: redis: - # Railway Redis Configuration - host: yamanote.proxy.rlwy.net # Railway Redis服务器地址 - port: 34938 # Railway Redis服务器连接端口 - password: YbdhwguVUNowduNpDZjuSefZFhBXiOEP # Railway Redis服务器连接密码 - username: default # Railway Redis用户名 + # Local Docker Redis Configuration + host: localhost # Local Redis服务器地址 + port: 6380 # Local Redis服务器连接端口 + password: redispassword # Local Redis服务器连接密码 database: 0 # Redis数据库索引(默认为0) - timeout: 30000ms # 连接超时时间(毫秒)- 增加超时时间 + timeout: 10000ms # 连接超时时间(毫秒) ssl: - enabled: false # 尝试禁用SSL,Railway可能不需要 + enabled: false # 本地开发不需要SSL + + # Railway Redis Configuration (commented out for local development) + # host: yamanote.proxy.rlwy.net # Railway Redis服务器地址 + # port: 34938 # Railway Redis服务器连接端口 + # password: YbdhwguVUNowduNpDZjuSefZFhBXiOEP # Railway Redis服务器连接密码 + # username: default # Railway Redis用户名 lettuce: pool: max-active: 8 # 连接池最大连接数(使用负值表示没有限制) diff --git a/main/mqtt-gateway/config/mqtt.json b/main/mqtt-gateway/config/mqtt.json index 8b052ae56..3d25ae423 100644 --- a/main/mqtt-gateway/config/mqtt.json +++ b/main/mqtt-gateway/config/mqtt.json @@ -1,12 +1,12 @@ { "production": { "chat_servers": [ - "ws://139.59.7.72:8000/toy/v1/" + "ws://192.168.1.98:8000/toy/v1/" ] }, "development": { "chat_servers": [ - "ws://139.59.7.72:8000/toy/v1/" + "ws://192.168.1.98:8000/toy/v1/" ], "mac_addresss": [ ] diff --git a/main/xiaozhi-server/client.py b/main/xiaozhi-server/client.py index b1ff71f76..328462cf3 100644 --- a/main/xiaozhi-server/client.py +++ b/main/xiaozhi-server/client.py @@ -19,9 +19,9 @@ import opuslib # --- Configuration --- -SERVER_IP = "192.168.1.179" # !!! UPDATE with your server's local IP address !!! +SERVER_IP = "64.227.170.31" # !!! UPDATE with your server's local IP address !!! OTA_PORT = 8002 -MQTT_BROKER_HOST = "192.168.1.179" # MQTT gateway IP +MQTT_BROKER_HOST = "64.227.170.31" # MQTT gateway IP MQTT_BROKER_PORT = 1883 diff --git a/main/xiaozhi-server/docs/mqtt-gateway-message-flow.md b/main/xiaozhi-server/docs/mqtt-gateway-message-flow.md new file mode 100644 index 000000000..3b1588693 --- /dev/null +++ b/main/xiaozhi-server/docs/mqtt-gateway-message-flow.md @@ -0,0 +1,323 @@ +# MQTT Gateway Communication Flow & Message Types + +This document provides a comprehensive analysis of the MQTT gateway communication flow and all message types exchanged between the main server (xiaozhi-server), MQTT gateway, and clients. + +## 🔄 Communication Architecture + +``` +┌─────────────────┐ WebSocket ┌─────────────────┐ MQTT ┌─────────────────┐ +│ Main Server │ ◄──────────────► │ MQTT Gateway │ ◄─────────► │ Client │ +│ (xiaozhi-server)│ │ (Node.js) │ │ (ESP32/Test) │ +└─────────────────┘ └─────────────────┘ └─────────────────┘ + │ + ▼ + ┌─────────────────┐ + │ UDP Audio │ + │ Streaming │ + └─────────────────┘ +``` + +### Key Components: + +1. **Main Server (xiaozhi-server)**: Python-based AI server handling TTS/STT/LLM processing +2. **MQTT Gateway**: Node.js bridge converting between WebSocket (server) and MQTT (client) +3. **Client**: ESP32 device or test client connecting via MQTT +4. **UDP Audio Stream**: Encrypted real-time audio data transmission + +## 📤 Message Flow Triggers + +### 1. Client → MQTT Gateway → Server +Clients publish to the `"device-server"` topic, which the MQTT gateway forwards to the main server via WebSocket: + +```javascript +// Client publishes to "device-server" topic +mqtt_client.publish("device-server", JSON.stringify({ + "type": "hello", + "version": 3, + "transport": "mqtt", + "audio_params": {...}, + "features": [...] +})) +``` + +### 2. Server → MQTT Gateway → Client +The server sends messages via WebSocket to the MQTT gateway, which publishes to the client's unique P2P topic: + +```javascript +// Gateway publishes to client's P2P topic: "devices/p2p/{mac_address}" +connection.sendMqttMessage(JSON.stringify({ + "type": "tts", + "state": "start", + "session_id": session_id +})) +``` + +### 3. Audio Streaming (Server ↔ Client) +Real-time audio data bypasses MQTT and flows directly via encrypted UDP packets for low latency. + +## 📨 Complete MQTT Message Types + +### 🔄 Connection & Session Management + +#### 1. `hello` - Session Initiation +**Direction**: Client → Server, Server → Client +**Purpose**: Establish session and exchange capabilities + +**Client Request:** +```json +{ + "type": "hello", + "version": 3, + "transport": "mqtt", + "audio_params": { + "sample_rate": 16000, + "channels": 1, + "frame_duration": 20, + "format": "opus" + }, + "features": ["tts", "asr", "vad"] +} +``` + +**Server Response:** +```json +{ + "type": "hello", + "version": 3, + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058", + "transport": "udp", + "udp": { + "server": "64.227.170.31", + "port": 8884, + "encryption": "aes-128-ctr", + "key": "b6e228c4e0f5d0b93e6fac787786d303", + "nonce": "010000008e863dda0000000000000000" + }, + "audio_params": { + "sample_rate": 16000, + "channels": 1, + "frame_duration": 20, + "format": "opus" + } +} +``` + +#### 2. `goodbye` - Session Termination +**Direction**: Client ↔ Server +**Purpose**: Clean session termination + +```json +{ + "type": "goodbye", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058" +} +``` + +### 🎤 Speech Recognition Messages + +#### 3. `stt` - Speech-to-Text Results +**Direction**: Server → Client +**Purpose**: Send transcribed speech back to client + +```json +{ + "type": "stt", + "text": "hello baby", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058" +} +``` + +#### 4. `listen` - Request Speech Processing +**Direction**: Client → Server +**Purpose**: Request server to start listening/processing speech + +```json +{ + "type": "listen", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058", + "state": "detect", + "text": "hello baby" +} +``` + +### 🔊 Text-to-Speech Control Messages + +#### 5. `tts` - TTS Playback Control +**Direction**: Server → Client +**Purpose**: Control TTS playback states + +**Available States**: `start`, `sentence_start`, `stop` + +**TTS Start:** +```json +{ + "type": "tts", + "state": "start", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058" +} +``` + +**Sentence Start (with text preview):** +```json +{ + "type": "tts", + "state": "sentence_start", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058", + "text": "Hi there" +} +``` + +**TTS Stop:** +```json +{ + "type": "tts", + "state": "stop", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058" +} +``` + +**Note**: There is no `sentence_stop` or `sentence_end` state. Individual sentences are marked with `sentence_start`, and the entire TTS session ends with `stop`. + +### 🤖 AI Response Messages + +#### 6. `llm` - Large Language Model Response +**Direction**: Server → Client +**Purpose**: Send AI-generated response with emotion context + +```json +{ + "type": "llm", + "text": "😊", + "emotion": "happy", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058" +} +``` + +### ⏹️ Control Messages + +#### 7. `abort` - Abort Current Operation +**Direction**: Client → Server +**Purpose**: Stop current TTS playback or processing + +```json +{ + "type": "abort", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058" +} +``` + +#### 8. `record_stop` - Stop Audio Recording +**Direction**: Server → Client +**Purpose**: Instruct client to stop recording audio + +```json +{ + "type": "record_stop", + "session_id": "db4ead3e-c5e2-4dd4-bbf1-0295195e5058" +} +``` + +## 🎯 Server Message Trigger Points + +### In `core/handle/sendAudioHandle.py`: +- **`send_tts_message()`**: Triggers TTS state messages (`start`, `sentence_start`, `stop`) +- **`send_stt_message()`**: Triggers STT transcription messages +- **`sendAudioMessage()`**: Coordinates TTS playback with state messages +- Called during the audio processing pipeline + +### In `core/handle/helloHandle.py`: +- **`handleHelloMessage()`**: Triggers the initial hello response with session details +- **`checkWakeupWords()`**: Can trigger STT and TTS messages for wake word responses +- **`wakeupWordsResponse()`**: Generates dynamic wake word responses + +### In MQTT Gateway (`mqtt-gateway/app.js`): +- **`parseHelloMessage()`**: Processes hello messages and sends session details +- **`parseOtherMessage()`**: Forwards messages between server and client +- **`sendMqttMessage()`**: Publishes messages to client's P2P topic +- **`sendUdpMessage()`**: Handles encrypted audio streaming via UDP + +## 📊 Typical Message Flow Sequence + +### 1. Session Establishment +``` +Client → MQTT Gateway: hello (with capabilities) +MQTT Gateway → Server: hello (forwarded via WebSocket) +Server → MQTT Gateway: hello (with session_id and UDP details) +MQTT Gateway → Client: hello (published to P2P topic) +``` + +### 2. Audio Setup +``` +Client: Establishes UDP connection using provided encryption keys +Client: Sends UDP ping to confirm connection +``` + +### 3. Conversation Flow +``` +Client → Server: listen (request to start conversation) +Server → Client: stt (transcription of client speech) +Server → Client: tts (state: "start") +Server → Client: tts (state: "sentence_start", text: preview) +Server → Client: llm (AI response with emotion) +Server ⟶ Client: [UDP Audio Stream] (actual TTS audio) +Server → Client: tts (state: "stop") +``` + +### 4. Session Termination +``` +Client → Server: goodbye +Server → Client: goodbye (acknowledgment) +``` + +## 🔧 Implementation Details + +### MQTT Topics +- **Uplink**: `device-server` (client to server messages) +- **Downlink**: `devices/p2p/{mac_address}` (server to specific client) + +### Audio Streaming +- **Protocol**: UDP with AES-128-CTR encryption +- **Format**: Opus codec, 16kHz, mono +- **Frame Duration**: 20ms per packet +- **Encryption**: Header used as nonce, payload encrypted + +### Session Management +- **Session ID**: UUID generated for each connection +- **Authentication**: HMAC-SHA256 signed client credentials +- **Keep-alive**: MQTT ping/pong mechanism + +### Error Handling +- **Timeout**: Automatic retry for failed messages +- **Connection Loss**: Graceful degradation and reconnection +- **Audio Issues**: Buffer management for packet loss + +## 🚨 Key Observations + +- **Hybrid Protocol**: MQTT for control messages, UDP for real-time audio streaming +- **Session-based**: All messages include `session_id` for correlation +- **Bidirectional**: Both client and server can initiate certain message types +- **State Machine**: TTS has multiple states for precise playback control +- **Real-time Audio**: Audio packets bypass MQTT for optimal latency +- **P2P Topics**: Each client has a unique MQTT topic for targeted messaging +- **Encryption**: End-to-end encryption for audio data +- **Scalable**: Architecture supports multiple concurrent clients + +## 📚 Related Files + +### Server-side: +- `core/handle/sendAudioHandle.py` - TTS/STT message handling +- `core/handle/helloHandle.py` - Session establishment +- `core/websocket_server.py` - WebSocket connection management + +### MQTT Gateway: +- `mqtt-gateway/app.js` - Main gateway implementation +- `mqtt-gateway/mqtt-protocol.js` - MQTT protocol handling +- `mqtt-gateway/utils/mqtt_config_v2.js` - Client authentication + +### Client: +- `client.py` - Test client implementation +- Client logs show actual message flow in practice + +--- +*Generated on: 2025-09-12* +*Analysis based on xiaozhi-esp32-server codebase and client logs* From f7a632d5ce0d83776d355db97e6c9ca5eaf16532 Mon Sep 17 00:00:00 2001 From: rahulpscraftech360 Date: Fri, 12 Sep 2025 19:21:51 +0530 Subject: [PATCH 2/3] Fix VAD audio processing - ensure speech confidence detection works properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed timing issue where had_speaking_state was reset before ASR decision - Removed echo suppression to capture full audio - Added proper speech confidence tracking (SPEAKING vs STARTING states) - Audio now records on voice detection but only processes if speech detected - Added debug logging for troubleshooting VAD state transitions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- main/xiaozhi-server/core/connection.py | 3 ++ .../core/handle/receiveAudioHandle.py | 10 +----- .../xiaozhi-server/core/providers/asr/base.py | 35 +++++++++++++------ 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index b956974b4..b01a4df12 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -2333,6 +2333,9 @@ class ConnectionHandler: # Also reset listen start time if hasattr(self, 'listen_start_time'): self.listen_start_time = None + # Reset had_speaking_state flag used for ASR processing + if hasattr(self, 'had_speaking_state'): + self.had_speaking_state = False # Clear ASR audio queue for this specific connection only if hasattr(self, 'asr_audio_queue'): # Empty the queue by getting all items without blocking diff --git a/main/xiaozhi-server/core/handle/receiveAudioHandle.py b/main/xiaozhi-server/core/handle/receiveAudioHandle.py index da427d168..9b77a632c 100644 --- a/main/xiaozhi-server/core/handle/receiveAudioHandle.py +++ b/main/xiaozhi-server/core/handle/receiveAudioHandle.py @@ -239,15 +239,7 @@ async def handleAudioMessage(conn, audio): conn.logger.bind(tag=TAG).debug(f"VAD recording started at: {conn.vad_recording_start_time}") # Don't overwrite existing timer during continuous voice detection - # Check if this is the initial connection period (ignore first 1 second of audio) - if have_voice and hasattr(conn, "initial_connection_handled") and not conn.initial_connection_handled: - current_time = asyncio.get_event_loop().time() - if current_time - conn.initial_connection_time < 1.0: # Ignore first 1 second - have_voice = False - conn.asr_audio.clear() # Clear any accumulated audio - return - else: - conn.initial_connection_handled = True + # Initial connection handling removed - no longer ignoring initial audio # If the device was just woken up, briefly ignore VAD detection if have_voice and hasattr(conn, "just_woken_up") and conn.just_woken_up: diff --git a/main/xiaozhi-server/core/providers/asr/base.py b/main/xiaozhi-server/core/providers/asr/base.py index 411b3b7df..b87a3d49e 100644 --- a/main/xiaozhi-server/core/providers/asr/base.py +++ b/main/xiaozhi-server/core/providers/asr/base.py @@ -74,13 +74,6 @@ class ASRProviderBase(ABC): f"client_have_voice={conn.client_have_voice}, " f"audio_len={len(audio)}, asr_buffer_len={len(conn.asr_audio)}") - # Echo suppression: Ignore audio for a brief period after starting to listen - if hasattr(conn, 'listen_start_time') and conn.listen_start_time is not None: - time_since_listen_start = time.time() - conn.listen_start_time - if time_since_listen_start < 0.1: # Ignore first 100ms of audio (echo period) - if have_voice: - logger.bind(tag=TAG).debug(f"Ignoring potential echo audio ({time_since_listen_start:.2f}s after listen start)") - have_voice = False # Always add audio to pre-buffer (rolling buffer) conn.audio_pre_buffer.append(audio) @@ -95,6 +88,17 @@ class ASRProviderBase(ABC): # Add pre-buffered audio to the beginning of ASR audio conn.asr_audio = list(conn.audio_pre_buffer) + conn.asr_audio conn.audio_pre_buffer.clear() + # Initialize flag to track if we've had actual SPEAKING state + conn.had_speaking_state = False + + # Check if we're in SPEAKING state (not just STARTING) + if hasattr(conn, 'vad') and hasattr(conn.vad, 'analyzer'): + from core.providers.vad.vad_analyzer import VADState + current_vad_state = conn.vad.analyzer._vad_state + if current_vad_state == VADState.SPEAKING: + if not hasattr(conn, 'had_speaking_state') or not conn.had_speaking_state: + logger.bind(tag=TAG).info("Setting had_speaking_state = True (SPEAKING detected)") + conn.had_speaking_state = True conn.asr_audio.append(audio) if not have_voice and not conn.client_have_voice: @@ -112,11 +116,22 @@ class ASRProviderBase(ABC): asr_audio_task = conn.asr_audio.copy() conn.asr_audio.clear() + + # Check had_speaking_state BEFORE resetting VAD states + had_speaking = hasattr(conn, 'had_speaking_state') and conn.had_speaking_state + logger.bind(tag=TAG).info(f"ASR decision: had_speaking={had_speaking}, audio_chunks={len(asr_audio_task)}") + conn.reset_vad_states() - - if len(asr_audio_task) > 20: # Increased from 15 to 20 chunks (1.2 seconds) - logger.bind(tag=TAG).debug(f"Processing {len(asr_audio_task)} audio chunks") + + if had_speaking and len(asr_audio_task) > 20: + logger.bind(tag=TAG).info(f"Processing {len(asr_audio_task)} audio chunks (had speaking state)") await self.handle_voice_stop(conn, asr_audio_task) + elif len(asr_audio_task) > 20: + logger.bind(tag=TAG).info(f"Discarding {len(asr_audio_task)} audio chunks (no speaking state detected)") + + # Reset the speaking state flag for next session + if hasattr(conn, 'had_speaking_state'): + conn.had_speaking_state = False # Handle voice stop async def handle_voice_stop(self, conn, asr_audio_task: List[bytes]): From be603845b9d5cb04c79ed33b5abf45a26735eb0d Mon Sep 17 00:00:00 2001 From: rahulpscraftech360 Date: Sat, 13 Sep 2025 12:01:45 +0530 Subject: [PATCH 3/3] celanup --- FIRMWARE_UPDATE_SYSTEM_DOCUMENTATION.md | 452 - add_mem0_system_param.py | 205 - add_mqtt_params_railway.py | 197 - check_agent_functions.py | 360 - check_database_structure.py | 186 - check_story_function_mapping.py | 379 - check_sys_params_structure.py | 271 - check_system_params.py | 178 - final_fix_story_playback.py | 197 - fix_default_agent_template.py | 366 - fix_intent_functions.py | 265 - fix_migration.sql | 67 - fix_story_playback.py | 270 - fix_trigger_and_verify.py | 293 - simple_fix_story_playback.py | 213 - simple_story_check.py | 243 - .../.github/workflows/test-platforms.yml | 70 - ten-vad-1.0-ONNX/.gitignore | 18 - ten-vad-1.0-ONNX/LICENSE | 47 - ten-vad-1.0-ONNX/NOTICES | 68 - ten-vad-1.0-ONNX/README.md | 637 - ten-vad-1.0-ONNX/examples/CMakeLists.txt | 46 - .../examples/build-and-deploy-android.sh | 40 - .../examples/build-and-deploy-ios.sh | 30 - .../examples/build-and-deploy-linux.sh | 25 - .../examples/build-and-deploy-mac.sh | 32 - .../examples/build-and-deploy-windows.bat | 74 - .../examples/images/Agent-Friendly-image.png | Bin 196642 -> 0 bytes .../examples/images/PR_Curves_testset.png | Bin 63352 -> 0 bytes .../examples/images/ios_image_1.jpg | Bin 75770 -> 0 bytes .../examples/images/ios_image_2.png | Bin 178376 -> 0 bytes ten-vad-1.0-ONNX/examples/main.c | 306 - ten-vad-1.0-ONNX/examples/plot_pr_curves.py | 215 - ten-vad-1.0-ONNX/examples/requirements.txt | 4 - ten-vad-1.0-ONNX/examples/s0724-s0730.wav | Bin 249732 -> 0 bytes ten-vad-1.0-ONNX/examples/sample_array.h | 15271 ---------------- ten-vad-1.0-ONNX/examples/test.py | 27 - ten-vad-1.0-ONNX/examples/test_node.js | 529 - ten-vad-1.0-ONNX/examples_onnx/CMakeLists.txt | 24 - .../examples_onnx/build-and-deploy-linux.sh | 37 - ten-vad-1.0-ONNX/include/ten_vad.h | 87 - ten-vad-1.0-ONNX/include/ten_vad.py | 139 - ten-vad-1.0-ONNX/requirements.txt | 1 - ten-vad-1.0-ONNX/setup.py | 46 - ten-vad-1.0-ONNX/src/aed.cc | 993 - ten-vad-1.0-ONNX/src/aed.h | 226 - ten-vad-1.0-ONNX/src/aed_st.h | 132 - ten-vad-1.0-ONNX/src/biquad.cc | 354 - ten-vad-1.0-ONNX/src/biquad.h | 190 - ten-vad-1.0-ONNX/src/biquad_st.h | 37 - ten-vad-1.0-ONNX/src/coeff.h | 246 - ten-vad-1.0-ONNX/src/fftw.c | 3601 ---- ten-vad-1.0-ONNX/src/fftw.h | 47 - ten-vad-1.0-ONNX/src/fscvrt.cc | 541 - ten-vad-1.0-ONNX/src/fscvrt.h | 186 - ten-vad-1.0-ONNX/src/fscvrt_st.h | 123 - ten-vad-1.0-ONNX/src/onnx_model/ten-vad.onnx | Bin 315449 -> 0 bytes ten-vad-1.0-ONNX/src/pitch_est.cc | 1199 -- ten-vad-1.0-ONNX/src/pitch_est.h | 229 - ten-vad-1.0-ONNX/src/pitch_est_st.h | 166 - ten-vad-1.0-ONNX/src/stft.cc | 295 - ten-vad-1.0-ONNX/src/stft.h | 148 - ten-vad-1.0-ONNX/src/stft_st.h | 42 - ten-vad-1.0-ONNX/src/ten_vad.cc | 69 - ten-vad-1.0-ONNX/testset/testset-audio-01.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-01.wav | Bin 368718 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-02.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-02.wav | Bin 129518 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-03.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-03.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-04.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-04.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-05.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-05.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-06.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-06.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-07.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-07.wav | Bin 270158 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-08.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-08.wav | Bin 307278 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-09.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-09.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-10.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-10.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-11.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-11.wav | Bin 282702 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-12.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-12.wav | Bin 153358 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-13.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-13.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-14.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-14.wav | Bin 217838 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-15.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-15.wav | Bin 151630 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-16.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-16.wav | Bin 327758 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-17.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-17.wav | Bin 124238 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-18.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-18.wav | Bin 233550 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-19.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-19.wav | Bin 295758 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-20.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-20.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-21.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-21.wav | Bin 109838 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-22.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-22.wav | Bin 450638 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-23.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-23.wav | Bin 159822 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-24.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-24.wav | Bin 206158 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-25.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-25.wav | Bin 505198 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-26.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-26.wav | Bin 330744 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-27.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-27.wav | Bin 278606 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-28.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-28.wav | Bin 229454 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-29.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-29.wav | Bin 286798 -> 0 bytes ten-vad-1.0-ONNX/testset/testset-audio-30.scv | 1 - ten-vad-1.0-ONNX/testset/testset-audio-30.wav | Bin 330744 -> 0 bytes test_manager_api.py | 307 - translate_dict_names.sql | 15 - update_mem0_api_key.py | 296 - update_mem0_via_api.py | 266 - verify_all_agents_story.py | 327 - 129 files changed, 31980 deletions(-) delete mode 100644 FIRMWARE_UPDATE_SYSTEM_DOCUMENTATION.md delete mode 100644 add_mem0_system_param.py delete mode 100644 add_mqtt_params_railway.py delete mode 100644 check_agent_functions.py delete mode 100644 check_database_structure.py delete mode 100644 check_story_function_mapping.py delete mode 100644 check_sys_params_structure.py delete mode 100644 check_system_params.py delete mode 100644 final_fix_story_playback.py delete mode 100644 fix_default_agent_template.py delete mode 100644 fix_intent_functions.py delete mode 100644 fix_migration.sql delete mode 100644 fix_story_playback.py delete mode 100644 fix_trigger_and_verify.py delete mode 100644 simple_fix_story_playback.py delete mode 100644 simple_story_check.py delete mode 100644 ten-vad-1.0-ONNX/.github/workflows/test-platforms.yml delete mode 100644 ten-vad-1.0-ONNX/.gitignore delete mode 100644 ten-vad-1.0-ONNX/LICENSE delete mode 100644 ten-vad-1.0-ONNX/NOTICES delete mode 100644 ten-vad-1.0-ONNX/README.md delete mode 100644 ten-vad-1.0-ONNX/examples/CMakeLists.txt delete mode 100644 ten-vad-1.0-ONNX/examples/build-and-deploy-android.sh delete mode 100644 ten-vad-1.0-ONNX/examples/build-and-deploy-ios.sh delete mode 100644 ten-vad-1.0-ONNX/examples/build-and-deploy-linux.sh delete mode 100644 ten-vad-1.0-ONNX/examples/build-and-deploy-mac.sh delete mode 100644 ten-vad-1.0-ONNX/examples/build-and-deploy-windows.bat delete mode 100644 ten-vad-1.0-ONNX/examples/images/Agent-Friendly-image.png delete mode 100644 ten-vad-1.0-ONNX/examples/images/PR_Curves_testset.png delete mode 100644 ten-vad-1.0-ONNX/examples/images/ios_image_1.jpg delete mode 100644 ten-vad-1.0-ONNX/examples/images/ios_image_2.png delete mode 100644 ten-vad-1.0-ONNX/examples/main.c delete mode 100644 ten-vad-1.0-ONNX/examples/plot_pr_curves.py delete mode 100644 ten-vad-1.0-ONNX/examples/requirements.txt delete mode 100644 ten-vad-1.0-ONNX/examples/s0724-s0730.wav delete mode 100644 ten-vad-1.0-ONNX/examples/sample_array.h delete mode 100644 ten-vad-1.0-ONNX/examples/test.py delete mode 100644 ten-vad-1.0-ONNX/examples/test_node.js delete mode 100644 ten-vad-1.0-ONNX/examples_onnx/CMakeLists.txt delete mode 100644 ten-vad-1.0-ONNX/examples_onnx/build-and-deploy-linux.sh delete mode 100644 ten-vad-1.0-ONNX/include/ten_vad.h delete mode 100644 ten-vad-1.0-ONNX/include/ten_vad.py delete mode 100644 ten-vad-1.0-ONNX/requirements.txt delete mode 100644 ten-vad-1.0-ONNX/setup.py delete mode 100644 ten-vad-1.0-ONNX/src/aed.cc delete mode 100644 ten-vad-1.0-ONNX/src/aed.h delete mode 100644 ten-vad-1.0-ONNX/src/aed_st.h delete mode 100644 ten-vad-1.0-ONNX/src/biquad.cc delete mode 100644 ten-vad-1.0-ONNX/src/biquad.h delete mode 100644 ten-vad-1.0-ONNX/src/biquad_st.h delete mode 100644 ten-vad-1.0-ONNX/src/coeff.h delete mode 100644 ten-vad-1.0-ONNX/src/fftw.c delete mode 100644 ten-vad-1.0-ONNX/src/fftw.h delete mode 100644 ten-vad-1.0-ONNX/src/fscvrt.cc delete mode 100644 ten-vad-1.0-ONNX/src/fscvrt.h delete mode 100644 ten-vad-1.0-ONNX/src/fscvrt_st.h delete mode 100644 ten-vad-1.0-ONNX/src/onnx_model/ten-vad.onnx delete mode 100644 ten-vad-1.0-ONNX/src/pitch_est.cc delete mode 100644 ten-vad-1.0-ONNX/src/pitch_est.h delete mode 100644 ten-vad-1.0-ONNX/src/pitch_est_st.h delete mode 100644 ten-vad-1.0-ONNX/src/stft.cc delete mode 100644 ten-vad-1.0-ONNX/src/stft.h delete mode 100644 ten-vad-1.0-ONNX/src/stft_st.h delete mode 100644 ten-vad-1.0-ONNX/src/ten_vad.cc delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-01.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-01.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-02.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-02.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-03.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-03.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-04.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-04.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-05.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-05.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-06.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-06.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-07.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-07.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-08.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-08.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-09.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-09.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-10.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-10.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-11.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-11.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-12.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-12.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-13.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-13.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-14.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-14.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-15.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-15.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-16.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-16.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-17.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-17.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-18.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-18.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-19.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-19.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-20.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-20.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-21.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-21.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-22.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-22.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-23.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-23.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-24.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-24.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-25.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-25.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-26.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-26.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-27.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-27.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-28.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-28.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-29.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-29.wav delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-30.scv delete mode 100644 ten-vad-1.0-ONNX/testset/testset-audio-30.wav delete mode 100644 test_manager_api.py delete mode 100644 translate_dict_names.sql delete mode 100644 update_mem0_api_key.py delete mode 100644 update_mem0_via_api.py delete mode 100644 verify_all_agents_story.py diff --git a/FIRMWARE_UPDATE_SYSTEM_DOCUMENTATION.md b/FIRMWARE_UPDATE_SYSTEM_DOCUMENTATION.md deleted file mode 100644 index 8c5305c97..000000000 --- a/FIRMWARE_UPDATE_SYSTEM_DOCUMENTATION.md +++ /dev/null @@ -1,452 +0,0 @@ -# Firmware Update System Documentation - -## Table of Contents -1. [Overview](#overview) -2. [Architecture](#architecture) -3. [Components](#components) -4. [Firmware Upload Process](#firmware-upload-process) -5. [OTA Update Flow](#ota-update-flow) -6. [API Endpoints](#api-endpoints) -7. [Database Schema](#database-schema) -8. [Configuration](#configuration) -9. [Security Features](#security-features) -10. [Device-Server Communication](#device-server-communication) - ---- - -## Overview - -The Xiaozhi ESP32 Server implements a comprehensive Over-The-Air (OTA) firmware update system that allows remote firmware updates for ESP32 devices. The system supports automatic version checking, secure firmware distribution, and device-specific update policies. - -### Key Features -- Automatic version comparison and update detection -- Secure firmware storage with MD5 hash verification -- Per-device update control (auto-update enable/disable) -- Download attempt limiting (3 attempts per UUID) -- Support for multiple firmware types (.bin and .apk) -- RESTful API for firmware management - ---- - -## Architecture - -``` -┌─────────────────┐ ┌──────────────────┐ ┌────────────────┐ -│ ESP32 Device │────▶│ Manager API │────▶│ Firmware Store │ -│ │◀────│ (Java Spring) │◀────│ (uploadfile/) │ -└─────────────────┘ └──────────────────┘ └────────────────┘ - │ │ │ - │ ▼ │ - │ ┌──────────────────┐ │ - │ │ Database │ │ - │ │ (ai_ota) │ │ - │ └──────────────────┘ │ - │ │ - ▼ │ -┌─────────────────┐ │ -│ Xiaozhi Server │ │ -│ (Python) │◀──────────────────────────────────────┘ -└─────────────────┘ -``` - ---- - -## Components - -### 1. Manager API (Java Spring Boot) -- **Location**: `main/manager-api/` -- **Main Controllers**: - - `OTAController.java`: Handles device OTA check requests - - `OTAMagController.java`: Manages firmware upload/download -- **Services**: - - `OtaServiceImpl.java`: Business logic for OTA operations - - `DeviceServiceImpl.java`: Device management and update checks - -### 2. Xiaozhi Server (Python) -- **Location**: `main/xiaozhi-server/` -- **OTA Handler**: `core/api/ota_handler.py` -- Provides fallback OTA endpoint for direct device connections - -### 3. Firmware Storage -- **Location**: `main/manager-api/uploadfile/` -- Files stored with MD5 hash as filename -- Supported formats: `.bin`, `.apk` - ---- - -## Firmware Upload Process - -### Step 1: Admin Upload -```http -POST /otaMag/upload -Content-Type: multipart/form-data -``` - -**Process Flow**: -1. Admin uploads firmware file through web interface -2. System validates file extension (.bin or .apk only) -3. MD5 hash calculated for the file -4. File saved as: `uploadfile/{md5_hash}.{extension}` -5. If file already exists (same MD5), returns existing path -6. Path returned to admin for database entry - -**Code Location**: `OTAMagController.java:231-279` - -### Step 2: Database Registration -Admin creates OTA entry with: -- **Firmware Name**: Descriptive name -- **Type**: Device type (e.g., "esp32-generic", "doit-ai-01-kit") -- **Version**: Semantic version (e.g., "1.7.6") -- **File Path**: Path from upload step -- **Size**: File size in bytes -- **Remark**: Optional description - ---- - -## OTA Update Flow - -### 1. Device Check Request -```http -POST /ota/ -Headers: - Device-Id: {MAC_ADDRESS} - Client-Id: {CLIENT_ID} -Body: -{ - "application": { - "version": "1.7.6" - }, - "board": { - "type": "esp32-generic" - } -} -``` - -### 2. Server Processing -**Location**: `DeviceServiceImpl.java - checkDeviceActive()` - -1. **Device Validation**: - - Verify MAC address format - - Check if device is registered in database - -2. **Update Decision Logic**: - ```java - if (device == null) { - // Device not registered - no update - return current_firmware_info; - } - - if (device.autoUpdate != 0) { - // Check for newer version - OtaEntity latest = getLatestOta(device.type); - if (compareVersions(latest.version, current.version) > 0) { - // Generate download URL - return firmware_with_download_url; - } - } - ``` - -3. **Download URL Generation**: - - Create temporary UUID - - Store OTA ID in Redis: `ota:id:{uuid}` - - Generate URL: `/otaMag/download/{uuid}` - - URL valid for 3 download attempts - -### 3. Server Response -```json -{ - "server_time": { - "timestamp": 1703123456789, - "timezone_offset": 480 - }, - "firmware": { - "version": "1.7.7", - "url": "http://server:8002/otaMag/download/abc-123-def" - }, - "websocket": { - "url": "ws://server:8000/xiaozhi/v1/" - }, - "mqtt": { - "endpoint": "broker:1883", - "client_id": "GID_test@@@mac@@@uuid", - "username": "base64_encoded_data", - "password": "hmac_signature" - } -} -``` - -### 4. Firmware Download -**Endpoint**: `GET /otaMag/download/{uuid}` - -**Process**: -1. Validate UUID exists in Redis -2. Check download count (max 3 attempts) -3. Retrieve firmware file from storage -4. Return file as binary stream -5. Increment download counter -6. Clean up after 3 downloads - -**Security Features**: -- UUID expires after use -- Download attempt limiting -- File path validation -- Safe filename generation - ---- - -## API Endpoints - -### OTA Check Endpoints - -#### POST /ota/ -- **Purpose**: Device firmware update check -- **Headers**: Device-Id, Client-Id -- **Response**: Update information if available - -#### POST /ota/activate -- **Purpose**: Quick device activation check -- **Headers**: Device-Id, Client-Id -- **Response**: 200 if registered, 202 if not - -### Management Endpoints - -#### GET /otaMag -- **Purpose**: List all firmware entries -- **Permission**: superAdmin -- **Parameters**: page, limit - -#### POST /otaMag -- **Purpose**: Create firmware entry -- **Permission**: superAdmin -- **Body**: OtaEntity - -#### PUT /otaMag/{id} -- **Purpose**: Update firmware entry -- **Permission**: superAdmin - -#### DELETE /otaMag/{id} -- **Purpose**: Delete firmware entry -- **Permission**: superAdmin - -#### POST /otaMag/upload -- **Purpose**: Upload firmware file -- **Permission**: superAdmin -- **Returns**: File path for database - -#### GET /otaMag/download/{uuid} -- **Purpose**: Download firmware file -- **Public**: Yes (with valid UUID) -- **Limit**: 3 attempts per UUID - ---- - -## Database Schema - -### Table: `ai_ota` -```sql -CREATE TABLE ai_ota ( - id VARCHAR(36) PRIMARY KEY, - firmware_name VARCHAR(255), - type VARCHAR(100), -- Device type - version VARCHAR(50), -- Semantic version - size BIGINT, -- File size in bytes - remark TEXT, -- Description - firmware_path VARCHAR(500), -- File storage path - sort INT, -- Display order - updater BIGINT, - update_date DATETIME, - creator BIGINT, - create_date DATETIME -); -``` - -### Table: `ai_device` -```sql -CREATE TABLE ai_device ( - id VARCHAR(36) PRIMARY KEY, - mac_address VARCHAR(50), - app_version VARCHAR(50), -- Current firmware version - auto_update TINYINT, -- 0=disabled, 1=enabled - -- other fields... -); -``` - ---- - -## Configuration - -### System Parameters -Configure in `sys_params` table or through Parameter Management UI: - -1. **server.websocket** - - WebSocket server URL for device connections - - Example: `ws://server:8000/xiaozhi/v1/` - -2. **server.ota** - - OTA server base URL - - Example: `http://server:8002/xiaozhi/` - -### Device Types -Configure in Dictionary Management (FIRMWARE_TYPE): -- `doit-ai-01-kit`: DOIT AI-01 Kit -- `esp32-generic`: ESP32 Generic -- `esp32s3-devkit`: ESP32-S3 DevKit -- `xiao-esp32s3`: XIAO ESP32S3 -- `m5stack-core`: M5Stack Core - ---- - -## Security Features - -### 1. File Upload Security -- Extension validation (.bin, .apk only) -- MD5 hash verification -- Duplicate detection -- Admin permission required - -### 2. Download Security -- Temporary UUID generation -- Redis-based token management -- Download attempt limiting (3 max) -- Automatic cleanup after use - -### 3. Version Control -- Semantic versioning comparison -- Per-device update control -- Type-specific firmware matching - -### 4. MQTT Authentication -- HMAC-SHA256 signature generation -- Base64 encoded credentials -- Session-specific UUIDs - ---- - -## Device-Server Communication - -### 1. Initial Connection -Device connects to OTA endpoint with: -- MAC address as Device-Id -- Current firmware version -- Board type information - -### 2. Update Check Flow -``` -Device Manager API Database - │ │ │ - ├──POST /ota/──────────────▶│ │ - │ (version, type) │ │ - │ ├──Check Device────────▶│ - │ │◀─────────────────────┤ - │ │ │ - │ ├──Get Latest OTA──────▶│ - │ │◀─────────────────────┤ - │ │ │ - │◀──Response────────────────┤ │ - │ (download URL if update) │ │ - │ │ │ - ├──GET /download/{uuid}────▶│ │ - │ │ │ - │◀──Firmware Binary─────────┤ │ -``` - -### 3. Fallback Support -If Manager API unavailable, devices can connect to: -- Xiaozhi Server OTA endpoint: `http://server:8003/ota/` -- Provides basic connectivity information -- No firmware updates (returns current version) - ---- - -## Version Comparison Logic - -The system uses semantic versioning (MAJOR.MINOR.PATCH): - -```java -private int compareVersions(String v1, String v2) { - String[] parts1 = v1.split("\\."); - String[] parts2 = v2.split("\\."); - - for (int i = 0; i < Math.max(parts1.length, parts2.length); i++) { - int num1 = i < parts1.length ? Integer.parseInt(parts1[i]) : 0; - int num2 = i < parts2.length ? Integer.parseInt(parts2[i]) : 0; - - if (num1 != num2) { - return Integer.compare(num1, num2); - } - } - return 0; -} -``` - -**Examples**: -- 1.7.7 > 1.7.6 ✓ (Update available) -- 2.0.0 > 1.9.9 ✓ (Major update) -- 1.7.6 = 1.7.6 ✗ (No update) - ---- - -## Troubleshooting - -### Common Issues - -1. **"OTA接口不正常,缺少websocket地址"** - - Solution: Configure `server.websocket` parameter - -2. **"OTA接口不正常,缺少ota地址"** - - Solution: Configure `server.ota` parameter - -3. **Firmware file not found** - - Check file exists in `uploadfile/` directory - - Verify path in database matches actual file - -4. **Device not receiving updates** - - Check `auto_update` flag is enabled (not 0) - - Verify device type matches firmware type - - Ensure version number is higher - -5. **Download limit exceeded** - - UUID expired after 3 attempts - - Generate new download link - ---- - -## Best Practices - -1. **Version Management** - - Use semantic versioning consistently - - Test firmware thoroughly before deployment - - Keep previous versions for rollback - -2. **Security** - - Regular security audits of firmware - - Monitor download patterns for abuse - - Use HTTPS in production - -3. **Device Management** - - Group devices by type for targeted updates - - Implement staged rollouts for critical updates - - Monitor update success rates - -4. **Storage Management** - - Regular cleanup of old firmware files - - Backup firmware files externally - - Monitor disk space usage - ---- - -## Future Enhancements - -Potential improvements to consider: -- Delta updates for bandwidth optimization -- Rollback mechanism for failed updates -- Update scheduling and staging -- Device group management -- Update progress tracking -- Firmware signing and verification -- Automated testing before deployment - ---- - -*Last Updated: 2025-08-25* -*Document Version: 1.0.0* \ No newline at end of file diff --git a/add_mem0_system_param.py b/add_mem0_system_param.py deleted file mode 100644 index e07ba7c56..000000000 --- a/add_mem0_system_param.py +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to add mem0.api_key system parameter -This will bypass the API key masking issue -""" - -import pymysql -import json -import sys -from datetime import datetime - -# Database configuration - from application-dev.yml -DB_CONFIG = { - 'host': 'nozomi.proxy.rlwy.net', # Railway MySQL host - 'port': 25037, # Railway MySQL port - 'user': 'root', # Database username - 'password': 'OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', # Database password - 'database': 'railway', # Database name - 'charset': 'utf8mb4', - 'connect_timeout': 30, # Connection timeout in seconds - 'read_timeout': 30, - 'write_timeout': 30, - 'autocommit': False, - 'ssl': {'ssl_disabled': False} # Enable SSL as per JDBC config -} - -# The actual mem0 API key -MEM0_API_KEY = "m0-WNBvGhsBGZU1NDKDF42ecLNAgMk0GRaToaKLT0wN" - -# Colors for output -class Colors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKCYAN = '\033[96m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - -def print_header(text): - """Print a formatted header""" - print(f"\n{Colors.HEADER}{'='*80}{Colors.ENDC}") - print(f"{Colors.HEADER}{text}{Colors.ENDC}") - print(f"{Colors.HEADER}{'='*80}{Colors.ENDC}") - -def print_success(text): - """Print success message""" - print(f"{Colors.OKGREEN}[OK] {text}{Colors.ENDC}") - -def print_error(text): - """Print error message""" - print(f"{Colors.FAIL}[ERROR] {text}{Colors.ENDC}") - -def print_info(text): - """Print info message""" - print(f"{Colors.OKCYAN}[INFO] {text}{Colors.ENDC}") - -def print_warning(text): - """Print warning message""" - print(f"{Colors.WARNING}[WARNING] {text}{Colors.ENDC}") - -def connect_to_database(): - """Connect to the MySQL database""" - try: - print_info("Connecting to database...") - connection = pymysql.connect(**DB_CONFIG) - - # Test the connection - with connection.cursor() as cursor: - cursor.execute("SELECT 1") - cursor.fetchone() - - print_success("Successfully connected to database") - return connection - - except Exception as e: - print_error(f"Failed to connect to database: {str(e)}") - return None - -def add_system_parameter(connection): - """Add mem0.api_key system parameter""" - try: - with connection.cursor() as cursor: - # Check if parameter already exists - cursor.execute("SELECT * FROM sys_params WHERE param_code = %s", ('mem0.api_key',)) - existing = cursor.fetchone() - - if existing: - print_warning("Parameter mem0.api_key already exists:") - print(f" Current value: {existing[2][:10]}...{existing[2][-10:] if len(existing[2]) > 20 else existing[2]}") - - response = input(f"{Colors.WARNING}Do you want to update it? (yes/no): {Colors.ENDC}").lower() - if response not in ['yes', 'y']: - print_info("Skipping update") - return True - - # Update existing parameter - update_query = """ - UPDATE sys_params - SET param_value = %s, - update_date = NOW(), - updater = 1 - WHERE param_code = %s - """ - cursor.execute(update_query, (MEM0_API_KEY, 'mem0.api_key')) - connection.commit() - print_success("Updated existing mem0.api_key parameter") - - else: - # Get the next ID - cursor.execute("SELECT MAX(id) FROM sys_params") - max_id = cursor.fetchone()[0] - next_id = (max_id or 0) + 1 - - # Insert new parameter - insert_query = """ - INSERT INTO sys_params (id, param_code, param_value, value_type, param_type, remark, create_date, creator) - VALUES (%s, %s, %s, %s, %s, %s, NOW(), %s) - """ - - cursor.execute(insert_query, ( - next_id, - 'mem0.api_key', - MEM0_API_KEY, - 'string', - 1, # param_type: 1 for system parameters - 'Mem0 AI API key for memory management', - 1 # creator: admin user - )) - - connection.commit() - print_success("Added new mem0.api_key system parameter") - - return True - - except Exception as e: - connection.rollback() - print_error(f"Failed to add system parameter: {str(e)}") - return False - -def verify_parameter(connection): - """Verify the parameter was added correctly""" - try: - with connection.cursor() as cursor: - cursor.execute("SELECT * FROM sys_params WHERE param_code = %s", ('mem0.api_key',)) - result = cursor.fetchone() - - if result: - print_success("Parameter verification successful:") - print(f" ID: {result[0]}") - print(f" Code: {result[1]}") - print(f" Value: {result[2][:10]}...{result[2][-10:]}") - print(f" Type: {result[3]}") - print(f" Remark: {result[5]}") - return True - else: - print_error("Parameter not found after insertion") - return False - - except Exception as e: - print_error(f"Failed to verify parameter: {str(e)}") - return False - -def main(): - """Main function""" - print_header("Add Mem0 API Key System Parameter") - print_info(f"Target API Key: {MEM0_API_KEY[:10]}...{MEM0_API_KEY[-10:]}") - print_info(f"Timestamp: {datetime.now().isoformat()}") - - # Connect to database - connection = connect_to_database() - if not connection: - print_error("Cannot proceed without database connection") - return 1 - - try: - # Add system parameter - if add_system_parameter(connection): - # Verify the parameter - if verify_parameter(connection): - print_success("\n✅ System parameter added successfully!") - print_info("\nNext steps:") - print_info("1. Restart the manager-api service to load the new parameter") - print_info("2. Test device connection again") - print_info("3. Check that mem0 authentication now works") - return 0 - else: - return 1 - else: - return 1 - - finally: - connection.close() - print_info("Database connection closed") - -if __name__ == "__main__": - try: - sys.exit(main()) - except KeyboardInterrupt: - print("\n\nScript interrupted by user") - sys.exit(0) - except Exception as e: - print_error(f"Unexpected error: {str(e)}") - sys.exit(1) \ No newline at end of file diff --git a/add_mqtt_params_railway.py b/add_mqtt_params_railway.py deleted file mode 100644 index 7a9862fd5..000000000 --- a/add_mqtt_params_railway.py +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Script to add MQTT configuration parameters to Railway MySQL database -""" - -import pymysql -import sys -import io -from typing import Optional - -# Set UTF-8 encoding for Windows console -sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') - -# Railway MySQL Database configuration -DB_CONFIG = { - 'host': 'nozomi.proxy.rlwy.net', - 'port': 25037, - 'user': 'root', - 'password': 'OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - 'database': 'railway', - 'charset': 'utf8mb4' -} - -# MQTT parameters to add -MQTT_PARAMS = [ - { - 'id': 120, - 'param_code': 'mqtt.broker', - 'param_value': '192.168.1.107', - 'value_type': 'string', - 'param_type': 1, - 'remark': 'MQTT broker IP address' - }, - { - 'id': 121, - 'param_code': 'mqtt.port', - 'param_value': '1883', - 'value_type': 'string', - 'param_type': 1, - 'remark': 'MQTT broker port' - }, - { - 'id': 122, - 'param_code': 'mqtt.signature_key', - 'param_value': 'test-signature-key-12345', - 'value_type': 'string', - 'param_type': 1, - 'remark': 'MQTT signature key for authentication' - } -] - -def connect_to_db(): - """Connect to the Railway MySQL database""" - try: - connection = pymysql.connect(**DB_CONFIG) - print(f"✅ Connected to Railway MySQL database") - return connection - except pymysql.Error as e: - print(f"❌ Failed to connect to database: {e}") - sys.exit(1) - -def check_existing_params(cursor, param_code: str) -> Optional[dict]: - """Check if a parameter already exists""" - query = "SELECT * FROM sys_params WHERE param_code = %s" - cursor.execute(query, (param_code,)) - result = cursor.fetchone() - return result - -def get_next_available_id(cursor) -> int: - """Get the next available ID for sys_params table""" - query = "SELECT MAX(id) as max_id FROM sys_params" - cursor.execute(query) - result = cursor.fetchone() - if result and result['max_id']: - return result['max_id'] + 1 - return 120 # Start from 120 if table is empty - -def insert_or_update_param(cursor, param: dict) -> bool: - """Insert a new parameter or update existing one""" - try: - # First check if it already exists - existing = check_existing_params(cursor, param['param_code']) - if existing: - print(f"⚠️ Parameter '{param['param_code']}' already exists with value: {existing['param_value']}") - - # Update the existing parameter - update_query = """ - UPDATE sys_params - SET param_value = %s, remark = %s - WHERE param_code = %s - """ - cursor.execute(update_query, (param['param_value'], param['remark'], param['param_code'])) - print(f" ✅ Updated parameter '{param['param_code']}' to: {param['param_value']}") - return True - - # Get next available ID if the specified one is taken - check_id_query = "SELECT id FROM sys_params WHERE id = %s" - cursor.execute(check_id_query, (param['id'],)) - if cursor.fetchone(): - param['id'] = get_next_available_id(cursor) - print(f" ℹ️ Using ID {param['id']} for '{param['param_code']}'") - - # Insert new parameter - insert_query = """ - INSERT INTO sys_params (id, param_code, param_value, value_type, param_type, remark) - VALUES (%s, %s, %s, %s, %s, %s) - """ - cursor.execute(insert_query, ( - param['id'], - param['param_code'], - param['param_value'], - param['value_type'], - param['param_type'], - param['remark'] - )) - print(f"✅ Added parameter '{param['param_code']}' with value: {param['param_value']}") - return True - except pymysql.Error as e: - print(f"❌ Failed to insert/update '{param['param_code']}': {e}") - return False - -def verify_params(cursor): - """Verify that all MQTT parameters are in the database""" - print("\n📋 Current MQTT parameters in database:") - print("-" * 50) - query = "SELECT param_code, param_value, remark FROM sys_params WHERE param_code LIKE 'mqtt.%' ORDER BY param_code" - cursor.execute(query) - results = cursor.fetchall() - - if results: - for row in results: - print(f" • {row['param_code']}: {row['param_value']}") - print(f" ({row['remark']})") - else: - print(" No MQTT parameters found") - - return len(results) > 0 - -def main(): - print("🔧 Railway MySQL - MQTT Parameter Configuration Tool") - print("=" * 60) - print(f"📍 Connecting to: {DB_CONFIG['host']}:{DB_CONFIG['port']}") - print(f"📦 Database: {DB_CONFIG['database']}") - print("=" * 60) - - # Connect to database - connection = connect_to_db() - - try: - with connection.cursor(pymysql.cursors.DictCursor) as cursor: - print("\n📝 Adding/Updating MQTT parameters...") - print("-" * 50) - - # Add each parameter - changes_made = False - for param in MQTT_PARAMS: - if insert_or_update_param(cursor, param): - changes_made = True - - # Commit changes - if changes_made: - connection.commit() - print("\n✅ All changes committed to database") - else: - print("\n⚠️ No changes were made") - - # Verify parameters - verify_params(cursor) - - print("\n" + "=" * 60) - print("✅ MQTT parameters configuration complete!") - print("\n⚠️ IMPORTANT NEXT STEPS:") - print(" 1. Restart the manager-api server for changes to take effect") - print(" 2. The ESP32 device should now receive MQTT configuration") - print(" 3. The Python client should also connect successfully") - - except Exception as e: - print(f"❌ An error occurred: {e}") - connection.rollback() - finally: - connection.close() - print("\n🔌 Database connection closed") - -if __name__ == "__main__": - print("\n🚀 This script will configure MQTT parameters in your Railway MySQL database") - print(" The following parameters will be added/updated:") - print(" • mqtt.broker: 139.59.7.72") - print(" • mqtt.port: 1883") - print(" • mqtt.signature_key: test-signature-key-12345\n") - - try: - main() - except KeyboardInterrupt: - print("\n\n❌ Operation cancelled by user") - except Exception as e: - print(f"\n❌ Unexpected error: {e}") \ No newline at end of file diff --git a/check_agent_functions.py b/check_agent_functions.py deleted file mode 100644 index 30506105d..000000000 --- a/check_agent_functions.py +++ /dev/null @@ -1,360 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to check agent templates and functions structure, and fix Story Playback function placement -""" - -import mysql.connector -from mysql.connector import Error -import json -from tabulate import tabulate - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Successfully connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Error connecting to MySQL: {e}") - return None - -def get_all_tables(connection): - """Get all tables in the database""" - cursor = connection.cursor() - try: - cursor.execute("SHOW TABLES") - tables = cursor.fetchall() - - print(f"\nAll tables in the database:") - for table in tables: - print(f" - {table[0]}") - - return [table[0] for table in tables] - - except Error as e: - print(f"Error getting tables: {e}") - return None - finally: - cursor.close() - -def search_agent_related_tables(connection): - """Search for agent-related tables""" - cursor = connection.cursor() - try: - cursor.execute("SHOW TABLES LIKE '%agent%'") - agent_tables = cursor.fetchall() - - cursor.execute("SHOW TABLES LIKE '%template%'") - template_tables = cursor.fetchall() - - cursor.execute("SHOW TABLES LIKE '%function%'") - function_tables = cursor.fetchall() - - print(f"\nAgent-related tables:") - for table in agent_tables: - print(f" - {table[0]}") - - print(f"\nTemplate-related tables:") - for table in template_tables: - print(f" - {table[0]}") - - print(f"\nFunction-related tables:") - for table in function_tables: - print(f" - {table[0]}") - - return agent_tables + template_tables + function_tables - - except Error as e: - print(f"Error searching agent tables: {e}") - return None - finally: - cursor.close() - -def examine_table_structure(connection, table_name): - """Get detailed structure of a table""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print(f"Structure of table '{table_name}':") - print('='*60) - - cursor.execute(f"DESCRIBE {table_name}") - columns = cursor.fetchall() - - headers = ["Field", "Type", "Null", "Key", "Default", "Extra"] - print(tabulate(columns, headers=headers, tablefmt="grid")) - - # Get sample data - cursor.execute(f"SELECT * FROM {table_name} LIMIT 5") - sample_data = cursor.fetchall() - - if sample_data: - print(f"\nSample data from '{table_name}':") - column_names = [desc[0] for desc in cursor.description] - print(tabulate(sample_data, headers=column_names, tablefmt="grid")) - - return columns - - except Error as e: - print(f"Error examining table {table_name}: {e}") - return None - finally: - cursor.close() - -def search_story_playback(connection): - """Search for Story Playback function references""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("Searching for 'Story Playback' references in the database...") - print('='*60) - - # Get all tables - cursor.execute("SHOW TABLES") - tables = [table[0] for table in cursor.fetchall()] - - found_references = [] - - for table in tables: - try: - # Get column names for this table - cursor.execute(f"DESCRIBE {table}") - columns = cursor.fetchall() - text_columns = [col[0] for col in columns if 'text' in col[1].lower() or 'varchar' in col[1].lower() or 'json' in col[1].lower()] - - if text_columns: - # Search in each text column - for column in text_columns: - search_query = f"SELECT * FROM {table} WHERE {column} LIKE '%Story Playback%' OR {column} LIKE '%story_playback%' OR {column} LIKE '%storyplayback%'" - cursor.execute(search_query) - results = cursor.fetchall() - - if results: - found_references.append({ - 'table': table, - 'column': column, - 'results': results - }) - print(f"\nFound 'Story Playback' in {table}.{column}:") - column_names = [desc[0] for desc in cursor.description] - print(tabulate(results, headers=column_names, tablefmt="grid")) - - except Error as e: - # Skip tables that might cause errors - continue - - return found_references - - except Error as e: - print(f"Error searching for Story Playback: {e}") - return None - finally: - cursor.close() - -def check_agent_templates(connection): - """Check agent templates and their configurations""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("Checking agent templates...") - print('='*60) - - # Look for agent template related tables - possible_tables = ['agent_template', 'agent_templates', 'toy', 'agent_config', 'agent_configuration'] - - for table_name in possible_tables: - try: - cursor.execute(f"SELECT * FROM {table_name} LIMIT 3") - results = cursor.fetchall() - - if results: - print(f"\nFound data in table '{table_name}':") - column_names = [desc[0] for desc in cursor.description] - print(tabulate(results, headers=column_names, tablefmt="grid")) - - # Check if any columns contain JSON that might have function configurations - for i, row in enumerate(results[:1]): # Check first row only - for j, cell in enumerate(row): - if isinstance(cell, str) and (cell.strip().startswith('{') or cell.strip().startswith('[')): - try: - json_data = json.loads(cell) - print(f"\nJSON data in {table_name}.{column_names[j]} (row {i+1}):") - print(json.dumps(json_data, indent=2)) - except: - pass - - except Error: - continue - - except Error as e: - print(f"Error checking agent templates: {e}") - finally: - cursor.close() - -def fix_story_playback_function(connection): - """Fix Story Playback function to be in Selected Functions for all agent templates""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("Attempting to fix Story Playback function placement...") - print('='*60) - - # First, let's find where the functions are stored - # Look for common table names that might store agent configurations - possible_tables = ['toy', 'agent_template', 'agent_config'] - - for table_name in possible_tables: - try: - # Get all records from the table - cursor.execute(f"SELECT * FROM {table_name}") - results = cursor.fetchall() - column_names = [desc[0] for desc in cursor.description] - - if results: - print(f"\nChecking table '{table_name}' for function configurations...") - - for i, row in enumerate(results): - row_dict = dict(zip(column_names, row)) - - # Look for JSON fields that might contain function configurations - for col_name, cell_value in row_dict.items(): - if isinstance(cell_value, str) and cell_value.strip().startswith('{'): - try: - json_data = json.loads(cell_value) - - # Look for function-related keys - if any(key in json_data for key in ['selected_functions', 'unselected_functions', 'functions', 'selectedFunctions', 'unselectedFunctions']): - print(f"\nFound function configuration in {table_name}, row {i+1}, column '{col_name}':") - print(f"Record ID/identifier: {row_dict.get('id', row_dict.get('template_id', 'Unknown'))}") - - # Check if Story Playback is in unselected functions - needs_update = False - updated_data = json_data.copy() - - # Handle different possible key names - unselected_key = None - selected_key = None - - for key in ['unselected_functions', 'unselectedFunctions']: - if key in json_data: - unselected_key = key - break - - for key in ['selected_functions', 'selectedFunctions']: - if key in json_data: - selected_key = key - break - - if unselected_key and selected_key: - unselected_functions = json_data.get(unselected_key, []) - selected_functions = json_data.get(selected_key, []) - - # Look for Story Playback in unselected functions - story_playback_item = None - for func in unselected_functions: - if isinstance(func, dict) and 'Story Playback' in str(func): - story_playback_item = func - break - elif isinstance(func, str) and 'Story Playback' in func: - story_playback_item = func - break - - if story_playback_item: - print(f"Found Story Playback in unselected functions: {story_playback_item}") - - # Move it to selected functions - updated_data[unselected_key] = [f for f in unselected_functions if f != story_playback_item] - updated_data[selected_key] = selected_functions + [story_playback_item] - - # Update the database - update_query = f"UPDATE {table_name} SET {col_name} = %s WHERE " - if 'id' in row_dict: - update_query += "id = %s" - update_params = [json.dumps(updated_data), row_dict['id']] - else: - # Use the first column as identifier - first_col = column_names[0] - update_query += f"{first_col} = %s" - update_params = [json.dumps(updated_data), row_dict[first_col]] - - print(f"Executing update query: {update_query}") - print(f"Parameters: {update_params[1]} (ID), [JSON data]") - - cursor.execute(update_query, update_params) - connection.commit() - - print(f"✓ Successfully moved Story Playback to selected functions for record {row_dict.get('id', row_dict[column_names[0]])}") - needs_update = True - else: - print(f"Story Playback not found in unselected functions for this record") - - # Print the current function configuration - print(f"Current function configuration:") - print(json.dumps(json_data, indent=2)) - - except json.JSONDecodeError: - continue - - except Error as e: - print(f"Error processing table {table_name}: {e}") - continue - - print(f"\nFunction placement fix completed!") - - except Error as e: - print(f"Error fixing Story Playback function: {e}") - finally: - cursor.close() - -def main(): - print("Checking xiaozhi database for agent templates and Story Playback function") - print("=" * 80) - - # Connect to database - connection = connect_to_database() - if not connection: - return - - try: - # Get all tables - print("\n" + "="*60) - tables = get_all_tables(connection) - - # Search for agent-related tables - print("\n" + "="*60) - agent_tables = search_agent_related_tables(connection) - - # Examine key tables - key_tables = ['toy'] # Start with 'toy' as it's likely the main agent config table - for table in key_tables: - if table in tables: - examine_table_structure(connection, table) - - # Search for Story Playback references - search_story_playback(connection) - - # Check agent templates - check_agent_templates(connection) - - # Fix Story Playback function placement - fix_story_playback_function(connection) - - finally: - if connection.is_connected(): - connection.close() - print(f"\nMySQL connection closed") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/check_database_structure.py b/check_database_structure.py deleted file mode 100644 index d0035451a..000000000 --- a/check_database_structure.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to check the ai_model_provider table structure and existing ASR services -""" - -import mysql.connector -from mysql.connector import Error -import json -from tabulate import tabulate - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Successfully connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Error connecting to MySQL: {e}") - return None - -def get_table_structure(connection, table_name): - """Get the structure of a table""" - cursor = connection.cursor() - try: - cursor.execute(f"DESCRIBE {table_name}") - columns = cursor.fetchall() - - print(f"\nStructure of table '{table_name}':") - headers = ["Field", "Type", "Null", "Key", "Default", "Extra"] - print(tabulate(columns, headers=headers, tablefmt="grid")) - - return columns - - except Error as e: - print(f"Error getting table structure: {e}") - return None - finally: - cursor.close() - -def get_existing_asr_providers(connection): - """Get all existing ASR providers""" - cursor = connection.cursor() - try: - cursor.execute(""" - SELECT id, model_type, provider_code, name, LENGTH(id) as id_length - FROM ai_model_provider - WHERE model_type = 'ASR' - ORDER BY id - """) - providers = cursor.fetchall() - - print(f"\nExisting ASR providers:") - headers = ["ID", "Model Type", "Provider Code", "Name", "ID Length"] - print(tabulate(providers, headers=headers, tablefmt="grid")) - - return providers - - except Error as e: - print(f"Error getting ASR providers: {e}") - return None - finally: - cursor.close() - -def get_existing_asr_configs(connection): - """Get all existing ASR model configurations""" - cursor = connection.cursor() - try: - cursor.execute(""" - SELECT id, model_type, model_code, model_name, LENGTH(id) as id_length - FROM ai_model_config - WHERE model_type = 'ASR' - ORDER BY id - """) - configs = cursor.fetchall() - - print(f"\nExisting ASR model configurations:") - headers = ["ID", "Model Type", "Model Code", "Model Name", "ID Length"] - print(tabulate(configs, headers=headers, tablefmt="grid")) - - return configs - - except Error as e: - print(f"Error getting ASR configs: {e}") - return None - finally: - cursor.close() - -def analyze_id_constraints(providers, configs): - """Analyze ID length constraints""" - print(f"\nID Length Analysis:") - - if providers: - provider_lengths = [row[4] for row in providers] # ID length is 5th column - print(f"Provider ID lengths: {provider_lengths}") - print(f"Max provider ID length: {max(provider_lengths)}") - print(f"Min provider ID length: {min(provider_lengths)}") - - if configs: - config_lengths = [row[4] for row in configs] # ID length is 5th column - print(f"Config ID lengths: {config_lengths}") - print(f"Max config ID length: {max(config_lengths)}") - print(f"Min config ID length: {min(config_lengths)}") - - # Check our proposed ID - proposed_provider_id = "SYSTEM_ASR_AmazonTranscribeStreaming" - proposed_config_id = "ASR_AmazonTranscribeStreaming" - - print(f"\nOur proposed IDs:") - print(f"Provider ID: '{proposed_provider_id}' (length: {len(proposed_provider_id)})") - print(f"Config ID: '{proposed_config_id}' (length: {len(proposed_config_id)})") - - if providers and len(proposed_provider_id) > max(provider_lengths): - print(f"WARNING: Proposed provider ID is longer than existing max ({max(provider_lengths)})") - - if configs and len(proposed_config_id) > max(config_lengths): - print(f"WARNING: Proposed config ID is longer than existing max ({max(config_lengths)})") - -def suggest_shorter_ids(): - """Suggest shorter ID alternatives""" - print(f"\nSuggested shorter IDs:") - - alternatives = [ - ("SYSTEM_ASR_AmazonTS", "ASR_AmazonTS"), - ("SYSTEM_ASR_AwsTranscribe", "ASR_AwsTranscribe"), - ("SYSTEM_ASR_AmazonStream", "ASR_AmazonStream"), - ("SYSTEM_ASR_AWSStream", "ASR_AWSStream"), - ] - - headers = ["Provider ID", "Config ID", "Provider Length", "Config Length"] - rows = [] - for provider_id, config_id in alternatives: - rows.append([provider_id, config_id, len(provider_id), len(config_id)]) - - print(tabulate(rows, headers=headers, tablefmt="grid")) - -def main(): - print("Checking xiaozhi database structure for Amazon Transcribe integration") - print("=" * 70) - - # Connect to database - connection = connect_to_database() - if not connection: - return - - try: - # Get table structures - print("\n" + "="*50) - provider_structure = get_table_structure(connection, "ai_model_provider") - - print("\n" + "="*50) - config_structure = get_table_structure(connection, "ai_model_config") - - # Get existing ASR services - print("\n" + "="*50) - providers = get_existing_asr_providers(connection) - - print("\n" + "="*50) - configs = get_existing_asr_configs(connection) - - # Analyze constraints - print("\n" + "="*50) - analyze_id_constraints(providers, configs) - - # Suggest alternatives - print("\n" + "="*50) - suggest_shorter_ids() - - finally: - if connection.is_connected(): - connection.close() - print(f"\nMySQL connection closed") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/check_story_function_mapping.py b/check_story_function_mapping.py deleted file mode 100644 index f3b634ca7..000000000 --- a/check_story_function_mapping.py +++ /dev/null @@ -1,379 +0,0 @@ -#!/usr/bin/env python3 -""" -Comprehensive script to check Story Playback function mapping in both database and local config -""" - -import mysql.connector -from mysql.connector import Error -import json -import yaml -import os - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Successfully connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Error connecting to MySQL: {e}") - return None - -def check_story_plugin_in_database(connection): - """Check if Story Playback plugin exists in database""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("1. Checking Story Playback Plugin in Database") - print('='*60) - - # Check if SYSTEM_PLUGIN_STORY exists in ai_model_provider - cursor.execute(""" - SELECT id, model_type, provider_code, name, fields - FROM ai_model_provider - WHERE id = 'SYSTEM_PLUGIN_STORY' OR name LIKE '%Story%' - """) - - story_plugins = cursor.fetchall() - - if story_plugins: - print(f"Found Story Playback plugins:") - for plugin in story_plugins: - plugin_id, model_type, provider_code, name, fields = plugin - print(f" ID: {plugin_id}") - print(f" Type: {model_type}") - print(f" Provider Code: {provider_code}") - print(f" Name: {name}") - if fields: - try: - fields_json = json.loads(fields) - print(f" Fields: {json.dumps(fields_json, indent=4)}") - except: - print(f" Fields: {fields}") - print() - else: - print("No Story Playback plugin found in database!") - - return story_plugins - - except Error as e: - print(f"Error checking story plugin: {e}") - return None - finally: - cursor.close() - -def check_intent_functions_in_database(connection): - """Check Intent function call configurations in database""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("2. Checking Intent Function Call Configurations") - print('='*60) - - # Check if there's an Intent function call configuration - cursor.execute(""" - SELECT id, model_type, provider_code, name, fields - FROM ai_model_provider - WHERE model_type = 'Intent' AND provider_code = 'function_call' - """) - - intent_configs = cursor.fetchall() - - if intent_configs: - print(f"Found Intent function call configurations:") - for config in intent_configs: - config_id, model_type, provider_code, name, fields = config - print(f" ID: {config_id}") - print(f" Name: {name}") - if fields: - try: - fields_json = json.loads(fields) - print(f" Fields: {json.dumps(fields_json, indent=2)}") - - # Look for functions list - for field in fields_json: - if field.get('key') == 'functions' and 'default' in field: - functions = field['default'] - print(f" Available functions: {functions}") - if 'play_story' in str(functions).lower(): - print(" [✓] play_story found in functions!") - else: - print(" [✗] play_story NOT found in functions!") - except Exception as e: - print(f" Fields (raw): {fields}") - print(f" Error parsing fields: {e}") - print() - else: - print("No Intent function call configuration found!") - - return intent_configs - - except Error as e: - print(f"Error checking intent functions: {e}") - return None - finally: - cursor.close() - -def check_agent_plugin_mappings(connection): - """Check which agents have Story Playback mapped""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("3. Checking Agent-Plugin Mappings for Story Playback") - print('='*60) - - # Get all agents and check their Story Playback mapping - cursor.execute(""" - SELECT - a.id as agent_id, - a.agent_name, - apm.plugin_id, - apm.param_info - FROM ai_agent a - LEFT JOIN ai_agent_plugin_mapping apm - ON a.id = apm.agent_id AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - ORDER BY a.agent_name - """) - - mappings = cursor.fetchall() - - total_agents = len(set([m[0] for m in mappings if m[0] is not None])) - agents_with_story = len([m for m in mappings if m[2] == 'SYSTEM_PLUGIN_STORY']) - - print(f"Agent Story Playback Mapping Status:") - print(f"Total agents: {total_agents}") - print(f"Agents with Story Playback: {agents_with_story}") - print() - - for mapping in mappings: - agent_id, agent_name, plugin_id, param_info = mapping - if plugin_id == 'SYSTEM_PLUGIN_STORY': - print(f"[✓] {agent_name} (ID: {agent_id}) - HAS Story Playback") - if param_info: - try: - params = json.loads(param_info) - print(f" Parameters: {json.dumps(params, indent=6)}") - except: - print(f" Parameters: {param_info}") - else: - print(f"[✗] {agent_name} (ID: {agent_id}) - MISSING Story Playback") - - return mappings - - except Error as e: - print(f"Error checking agent mappings: {e}") - return None - finally: - cursor.close() - -def check_local_config_file(): - """Check the local config file for play_story function""" - try: - print(f"\n{'='*60}") - print("4. Checking Local Config File") - print('='*60) - - config_path = "D:/cheekofinal/xiaozhi-esp32-server/main/xiaozhi-server/data/.config.yaml" - - if not os.path.exists(config_path): - print(f"Config file not found: {config_path}") - return None - - with open(config_path, 'r', encoding='utf-8') as file: - config_content = file.read() - - print(f"Config file location: {config_path}") - print(f"File size: {len(config_content)} characters") - - # Look for Intent section - if 'Intent:' in config_content: - print(f"[✓] Intent section found in config") - - # Look for function_call - if 'function_call:' in config_content: - print(f"[✓] function_call section found") - - # Look for functions list - if 'functions:' in config_content: - print(f"[✓] functions list found") - - # Extract functions section - lines = config_content.split('\n') - in_functions = False - functions = [] - - for line in lines: - if 'functions:' in line and 'function_call:' in config_content[max(0, config_content.find(line)-200):config_content.find(line)]: - in_functions = True - continue - elif in_functions: - if line.strip().startswith('- '): - func_name = line.strip()[2:].strip() - functions.append(func_name) - elif line.strip() and not line.startswith(' ') and not line.startswith('#'): - break - - print(f"Functions found in config:") - for func in functions: - if 'story' in func.lower(): - print(f" [✓] {func}") - else: - print(f" - {func}") - - if 'play_story' in functions: - print(f"[✓] play_story is configured in local config!") - else: - print(f"[✗] play_story is NOT configured in local config!") - - return functions - else: - print(f"[✗] functions list not found in function_call section") - else: - print(f"[✗] function_call section not found in Intent") - else: - print(f"[✗] Intent section not found in config") - - return None - - except Exception as e: - print(f"Error checking local config: {e}") - return None - -def fix_missing_story_function_in_database(connection): - """Fix missing Story Playback function in Intent configuration if needed""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("5. Fixing Intent Function Configuration if Needed") - print('='*60) - - # Get the Intent function call configuration - cursor.execute(""" - SELECT id, fields - FROM ai_model_provider - WHERE model_type = 'Intent' AND provider_code = 'function_call' - LIMIT 1 - """) - - result = cursor.fetchone() - - if result: - config_id, fields = result - print(f"Found Intent config ID: {config_id}") - - try: - fields_json = json.loads(fields) - - # Find the functions field - functions_field = None - for i, field in enumerate(fields_json): - if field.get('key') == 'functions': - functions_field = field - field_index = i - break - - if functions_field: - current_functions = functions_field.get('default', '') - print(f"Current functions: {current_functions}") - - # Check if play_story is already there - if 'play_story' not in current_functions.lower(): - # Add play_story to the functions - if current_functions: - # Parse existing functions (assuming they're in a string format) - if current_functions.endswith(';'): - updated_functions = current_functions + 'play_story' - else: - updated_functions = current_functions + ';play_story' - else: - updated_functions = 'play_story' - - # Update the field - fields_json[field_index]['default'] = updated_functions - - # Update database - cursor.execute(""" - UPDATE ai_model_provider - SET fields = %s - WHERE id = %s - """, (json.dumps(fields_json), config_id)) - - connection.commit() - - print(f"[✓] Updated Intent functions to: {updated_functions}") - print(f"[✓] play_story added to Intent configuration!") - else: - print(f"[✓] play_story already exists in Intent configuration") - else: - print(f"[✗] functions field not found in Intent configuration") - - except json.JSONDecodeError as e: - print(f"[✗] Error parsing Intent configuration JSON: {e}") - - else: - print(f"[✗] No Intent function call configuration found in database") - - except Error as e: - print(f"Error fixing Intent configuration: {e}") - connection.rollback() - finally: - cursor.close() - -def main(): - print("Comprehensive Story Playback Function Mapping Check") - print("=" * 80) - - # Check database - connection = connect_to_database() - if connection: - try: - # Check story plugin exists - story_plugins = check_story_plugin_in_database(connection) - - # Check intent function configurations - intent_configs = check_intent_functions_in_database(connection) - - # Check agent mappings - agent_mappings = check_agent_plugin_mappings(connection) - - # Fix Intent configuration if needed - fix_missing_story_function_in_database(connection) - - finally: - connection.close() - - # Check local config - local_functions = check_local_config_file() - - # Summary - print(f"\n{'='*60}") - print("SUMMARY") - print('='*60) - - if story_plugins: - print("[✓] Story Playback plugin exists in database") - else: - print("[✗] Story Playback plugin MISSING from database") - - if local_functions and 'play_story' in local_functions: - print("[✓] play_story configured in local config") - else: - print("[✗] play_story MISSING from local config") - - print(f"\nThe script has checked both database and local configurations.") - print(f"If any issues were found, they should now be fixed!") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/check_sys_params_structure.py b/check_sys_params_structure.py deleted file mode 100644 index 6a777bf47..000000000 --- a/check_sys_params_structure.py +++ /dev/null @@ -1,271 +0,0 @@ -#!/usr/bin/env python3 -""" -Check sys_params table structure and add default plugins configuration -""" - -import mysql.connector -from mysql.connector import Error -import json - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Database connection error: {e}") - return None - -def check_sys_params_structure(connection): - """Check the structure of sys_params table""" - cursor = connection.cursor() - try: - print("\n1. Checking sys_params table structure...") - print("=" * 50) - - cursor.execute("DESCRIBE sys_params") - columns = cursor.fetchall() - - print("sys_params columns:") - for col in columns: - print(f" {col[0]} - {col[1]}") - - return [col[0] for col in columns] - - except Error as e: - print(f"Error checking sys_params: {e}") - return [] - finally: - cursor.close() - -def check_existing_params(connection, column_names): - """Check existing system parameters""" - cursor = connection.cursor() - try: - print("\n2. Checking existing system parameters...") - print("=" * 50) - - # Build query based on actual column names - key_col = None - value_col = None - - for col in column_names: - if 'key' in col.lower(): - key_col = col - elif 'value' in col.lower(): - value_col = col - - if not key_col or not value_col: - print("Could not identify key/value columns") - return None, None - - print(f"Using columns: {key_col} (key), {value_col} (value)") - - # Get plugin-related parameters - query = f"SELECT {key_col}, {value_col} FROM sys_params WHERE {key_col} LIKE '%plugin%' OR {key_col} LIKE '%function%' OR {key_col} LIKE '%default%'" - cursor.execute(query) - - params = cursor.fetchall() - - if params: - print("Found related parameters:") - for key, value in params: - print(f" {key}: {value[:100] if value else 'NULL'}...") - else: - print("No plugin-related parameters found") - - return key_col, value_col - - except Error as e: - print(f"Error checking parameters: {e}") - return None, None - finally: - cursor.close() - -def add_default_plugins_parameter(connection, key_col, value_col, column_names): - """Add or update default plugins parameter""" - cursor = connection.cursor() - try: - print("\n3. Adding/Updating default plugins parameter...") - print("=" * 50) - - # Check if default_agent_plugins exists - query = f"SELECT {value_col} FROM sys_params WHERE {key_col} = 'default_agent_plugins'" - cursor.execute(query) - - existing = cursor.fetchone() - - default_plugins = { - "plugins": [ - "SYSTEM_PLUGIN_MUSIC", - "SYSTEM_PLUGIN_STORY", - "SYSTEM_PLUGIN_WEATHER", - "SYSTEM_PLUGIN_NEWS_NEWSNOW" - ], - "functions": [ - "play_music", - "play_story", - "get_weather", - "get_news_from_newsnow", - "get_indian_news_api", - "get_lunar" - ] - } - - if existing: - print("default_agent_plugins already exists, updating...") - - update_query = f"UPDATE sys_params SET {value_col} = %s WHERE {key_col} = %s" - cursor.execute(update_query, (json.dumps(default_plugins), 'default_agent_plugins')) - - print("Updated default_agent_plugins") - else: - print("Creating new default_agent_plugins parameter...") - - # Build insert query based on available columns - insert_cols = [key_col, value_col] - insert_values = ['default_agent_plugins', json.dumps(default_plugins)] - - # Add other columns if they exist - if 'type' in column_names: - insert_cols.append('type') - insert_values.append(1) - elif 'param_type' in column_names: - insert_cols.append('param_type') - insert_values.append(1) - - if 'remark' in column_names: - insert_cols.append('remark') - insert_values.append('Default plugins and functions for new agents') - elif 'description' in column_names: - insert_cols.append('description') - insert_values.append('Default plugins and functions for new agents') - - # Add timestamp columns if they exist - for col in ['create_date', 'created_at', 'create_time']: - if col in column_names: - insert_cols.append(col) - insert_values.append('NOW()') - break - - # Build query - placeholders = ['%s'] * len(insert_values) - # Replace NOW() placeholders - for i, val in enumerate(insert_values): - if val == 'NOW()': - placeholders[i] = 'NOW()' - insert_values[i] = None - - insert_query = f"INSERT INTO sys_params ({', '.join(insert_cols)}) VALUES ({', '.join(placeholders)})" - insert_query = insert_query.replace('%s', '%s').replace("'NOW()'", "NOW()") - - # Filter out None values for NOW() - insert_values = [v for v in insert_values if v is not None] - - print(f"Insert query: {insert_query}") - cursor.execute(insert_query, insert_values) - - print("Created default_agent_plugins parameter") - - connection.commit() - return True - - except Error as e: - print(f"Error adding default plugins: {e}") - connection.rollback() - return False - finally: - cursor.close() - -def verify_trigger(connection): - """Verify the trigger exists""" - cursor = connection.cursor() - try: - print("\n4. Verifying trigger...") - print("=" * 50) - - cursor.execute(""" - SELECT TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE - FROM information_schema.TRIGGERS - WHERE TRIGGER_SCHEMA = 'railway' - AND TRIGGER_NAME = 'add_story_to_new_agent' - """) - - trigger = cursor.fetchone() - - if trigger: - print(f"Trigger exists: {trigger[0]}") - print(f" Event: {trigger[1]} on {trigger[2]}") - print("New agents will automatically get Story Playback!") - else: - print("Trigger not found (may have failed to create)") - - return trigger is not None - - except Error as e: - print(f"Error verifying trigger: {e}") - return False - finally: - cursor.close() - -def main(): - print("Configuring Default Plugins for New Agents") - print("=" * 70) - - connection = connect_to_database() - if not connection: - return - - try: - # 1. Check sys_params structure - column_names = check_sys_params_structure(connection) - - if column_names: - # 2. Check existing parameters - key_col, value_col = check_existing_params(connection, column_names) - - if key_col and value_col: - # 3. Add/update default plugins - add_default_plugins_parameter(connection, key_col, value_col, column_names) - - # 4. Verify trigger - trigger_exists = verify_trigger(connection) - - # Summary - print(f"\n{'='*70}") - print("FINAL STATUS") - print('='*70) - - print("Configuration complete!") - - if trigger_exists: - print("[OK] Database trigger active - new agents will get Story Playback automatically") - else: - print("[INFO] No trigger - agent creation code should add default plugins") - - print("\nDefault plugins configured:") - print(" - SYSTEM_PLUGIN_MUSIC") - print(" - SYSTEM_PLUGIN_STORY") - print(" - SYSTEM_PLUGIN_WEATHER") - print(" - SYSTEM_PLUGIN_NEWS_NEWSNOW") - - print("\nAll new agents will now have Story Playback by default!") - - finally: - connection.close() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/check_system_params.py b/check_system_params.py deleted file mode 100644 index db6479972..000000000 --- a/check_system_params.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to check system parameters table for mem0.api_key -""" - -import pymysql -import json -import sys -from datetime import datetime - -# Database configuration - from application-dev.yml -DB_CONFIG = { - 'host': 'nozomi.proxy.rlwy.net', # Railway MySQL host - 'port': 25037, # Railway MySQL port - 'user': 'root', # Database username - 'password': 'OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', # Database password - 'database': 'railway', # Database name - 'charset': 'utf8mb4', - 'connect_timeout': 30, # Connection timeout in seconds - 'read_timeout': 30, - 'write_timeout': 30, - 'autocommit': False, - 'ssl': {'ssl_disabled': False} # Enable SSL as per JDBC config -} - -# Colors for output -class Colors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKCYAN = '\033[96m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - -def print_header(text): - """Print a formatted header""" - print(f"\n{Colors.HEADER}{'='*80}{Colors.ENDC}") - print(f"{Colors.HEADER}{text}{Colors.ENDC}") - print(f"{Colors.HEADER}{'='*80}{Colors.ENDC}") - -def print_success(text): - """Print success message""" - print(f"{Colors.OKGREEN}[OK] {text}{Colors.ENDC}") - -def print_error(text): - """Print error message""" - print(f"{Colors.FAIL}[ERROR] {text}{Colors.ENDC}") - -def print_info(text): - """Print info message""" - print(f"{Colors.OKCYAN}[INFO] {text}{Colors.ENDC}") - -def print_warning(text): - """Print warning message""" - print(f"{Colors.WARNING}[WARNING] {text}{Colors.ENDC}") - -def connect_to_database(): - """Connect to the MySQL database""" - try: - print_info("Connecting to database...") - connection = pymysql.connect(**DB_CONFIG) - - # Test the connection - with connection.cursor() as cursor: - cursor.execute("SELECT 1") - cursor.fetchone() - - print_success("Successfully connected to database") - return connection - - except Exception as e: - print_error(f"Failed to connect to database: {str(e)}") - return None - -def check_system_params(connection): - """Check system parameters table for mem0.api_key""" - try: - with connection.cursor() as cursor: - # First, let's see what tables exist - print_info("Checking available tables...") - cursor.execute("SHOW TABLES LIKE '%param%'") - param_tables = cursor.fetchall() - - if param_tables: - print_success(f"Found parameter-related tables:") - for table in param_tables: - print(f" - {table[0]}") - - # Try different possible table names - possible_tables = [ - 'sys_params', - 'system_params', - 'sys_parameters', - 'system_parameters', - 'config_params', - 'application_params' - ] - - found_table = None - for table_name in possible_tables: - try: - cursor.execute(f"SELECT COUNT(*) FROM {table_name}") - found_table = table_name - print_success(f"Found system parameters table: {table_name}") - break - except pymysql.err.ProgrammingError: - continue - - if found_table: - # First, check the table structure - cursor.execute(f"DESCRIBE {found_table}") - columns = cursor.fetchall() - print_info(f"Table structure for {found_table}:") - for col in columns: - print(f" {col[0]} ({col[1]})") - - # Show all parameters for context - cursor.execute(f"SELECT * FROM {found_table} LIMIT 10") - all_params = cursor.fetchall() - print_info(f"\nFirst 10 parameters in {found_table}:") - for row in all_params: - print(f" Row: {row}") - - # Try to find mem0 parameter based on actual column structure - if columns: - # Assume first column is key, second is value - key_col = columns[0][0] - - query = f"SELECT * FROM {found_table} WHERE {key_col} = %s OR {key_col} LIKE %s" - cursor.execute(query, ('mem0.api_key', '%mem0%')) - results = cursor.fetchall() - - if results: - print_success("Found mem0-related parameters:") - for row in results: - print(f" Row: {row}") - else: - print_warning("No mem0.api_key parameter found in system parameters") - - else: - print_warning("No system parameters table found") - print_info("Available tables:") - cursor.execute("SHOW TABLES") - all_tables = cursor.fetchall() - for table in all_tables: - print(f" - {table[0]}") - - except Exception as e: - print_error(f"Failed to check system parameters: {str(e)}") - -def main(): - """Main function""" - print_header("System Parameters Check Script") - print_info(f"Timestamp: {datetime.now().isoformat()}") - - # Connect to database - connection = connect_to_database() - if not connection: - print_error("Cannot proceed without database connection") - return 1 - - try: - check_system_params(connection) - finally: - connection.close() - print_info("Database connection closed") - -if __name__ == "__main__": - try: - sys.exit(main()) - except KeyboardInterrupt: - print("\n\nScript interrupted by user") - sys.exit(0) - except Exception as e: - print_error(f"Unexpected error: {str(e)}") - sys.exit(1) \ No newline at end of file diff --git a/final_fix_story_playback.py b/final_fix_story_playback.py deleted file mode 100644 index d1f9030c9..000000000 --- a/final_fix_story_playback.py +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env python3 -""" -Final script to fix Story Playback function placement -""" - -import mysql.connector -from mysql.connector import Error -import json - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Successfully connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Error connecting to MySQL: {e}") - return None - -def check_agents_and_templates(connection): - """Check both agent templates and actual agents""" - cursor = connection.cursor() - try: - print("\n1. Checking agent templates...") - cursor.execute("SELECT id, agent_name FROM ai_agent_template") - templates = cursor.fetchall() - - print(f"Found {len(templates)} agent templates:") - for template in templates: - print(f" Template ID: {template[0]}, Name: {template[1]}") - - print("\n2. Checking actual agents...") - cursor.execute("SELECT id, agent_name FROM ai_agent") - agents = cursor.fetchall() - - print(f"Found {len(agents)} agents:") - for agent in agents: - print(f" Agent ID: {agent[0]}, Name: {agent[1]}") - - print("\n3. Checking current Story Playback mappings...") - cursor.execute(""" - SELECT agent_id, param_info FROM ai_agent_plugin_mapping - WHERE plugin_id = 'SYSTEM_PLUGIN_STORY' - """) - story_mappings = cursor.fetchall() - - print(f"Found {len(story_mappings)} existing Story Playback mappings:") - for mapping in story_mappings: - print(f" Agent ID: {mapping[0]}") - - return agents, templates, story_mappings - - except Error as e: - print(f"Error checking agents and templates: {e}") - return [], [], [] - finally: - cursor.close() - -def add_missing_story_playback_mappings(connection, agents, story_mappings): - """Add Story Playback to agents that don't have it""" - cursor = connection.cursor() - try: - # Get list of agent IDs that already have Story Playback - existing_story_agent_ids = [mapping[0] for mapping in story_mappings] - - # Default parameters for Story Playback plugin - param_info = { - "story_dir": "./stories", - "story_ext": ".mp3;.wav;.m4a", - "refresh_time": "300" - } - - updates_made = 0 - - print(f"\n4. Adding Story Playback to agents without it...") - - for agent_id, agent_name in agents: - if agent_id not in existing_story_agent_ids: - print(f"Adding Story Playback to: {agent_name} (ID: {agent_id})") - - cursor.execute(""" - INSERT INTO ai_agent_plugin_mapping - (agent_id, plugin_id, param_info) - VALUES (%s, %s, %s) - """, (agent_id, "SYSTEM_PLUGIN_STORY", json.dumps(param_info))) - - updates_made += 1 - print(f" Added successfully") - else: - print(f"Already has Story Playback: {agent_name} (ID: {agent_id})") - - if updates_made > 0: - connection.commit() - print(f"\nCommitted {updates_made} new Story Playback mappings to database") - else: - print(f"\nNo updates needed - all agents already have Story Playback") - - return updates_made - - except Error as e: - print(f"Error adding Story Playback mappings: {e}") - connection.rollback() - return 0 - finally: - cursor.close() - -def verify_final_state(connection): - """Verify all agents now have Story Playback""" - cursor = connection.cursor() - try: - print(f"\n5. Final verification...") - - cursor.execute(""" - SELECT - a.id, - a.agent_name, - CASE WHEN apm.plugin_id IS NOT NULL THEN 'YES' ELSE 'NO' END as has_story_playback - FROM ai_agent a - LEFT JOIN ai_agent_plugin_mapping apm - ON a.id = apm.agent_id AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - ORDER BY a.agent_name - """) - - results = cursor.fetchall() - - total_agents = len(results) - with_story_playback = sum(1 for result in results if result[2] == 'YES') - - print(f"\nFinal Story Playback status:") - for result in results: - agent_id, agent_name, has_playback = result - status_symbol = "[YES]" if has_playback == 'YES' else "[NO] " - print(f" {status_symbol} {agent_name}") - - print(f"\nSUMMARY:") - print(f"Total agents: {total_agents}") - print(f"With Story Playback: {with_story_playback}") - - if with_story_playback == total_agents: - print("SUCCESS: All agents now have Story Playback function!") - else: - print(f"WARNING: {total_agents - with_story_playback} agents still missing Story Playback") - - return with_story_playback == total_agents - - except Error as e: - print(f"Error verifying final state: {e}") - return False - finally: - cursor.close() - -def main(): - print("Fixing Story Playback function for all agents") - print("=" * 50) - - connection = connect_to_database() - if not connection: - return - - try: - # Check current state - agents, templates, story_mappings = check_agents_and_templates(connection) - - if not agents: - print("ERROR: No agents found in database!") - return - - # Add Story Playback to agents that don't have it - updates_made = add_missing_story_playback_mappings(connection, agents, story_mappings) - - # Verify the final state - success = verify_final_state(connection) - - if success: - print("\nMission accomplished! All agents now have access to Story Playback function.") - else: - print("\nSome issues remain. Please check the output above.") - - finally: - if connection.is_connected(): - connection.close() - print(f"\nDatabase connection closed") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/fix_default_agent_template.py b/fix_default_agent_template.py deleted file mode 100644 index f05ef544d..000000000 --- a/fix_default_agent_template.py +++ /dev/null @@ -1,366 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to ensure play_story is included in default agent template -""" - -import mysql.connector -from mysql.connector import Error -import json - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Database connection error: {e}") - return None - -def check_agent_templates(connection): - """Check all agent templates and their plugin configurations""" - cursor = connection.cursor() - try: - print("\n1. Checking Agent Templates...") - print("=" * 50) - - # Get all agent templates - cursor.execute(""" - SELECT id, agent_name, agent_code - FROM ai_agent_template - ORDER BY sort, id - """) - - templates = cursor.fetchall() - - print(f"Found {len(templates)} agent templates:") - for template_id, agent_name, agent_code in templates: - print(f" - {agent_name or agent_code} (ID: {template_id})") - - return templates - - except Error as e: - print(f"Error checking templates: {e}") - return [] - finally: - cursor.close() - -def check_template_plugin_mappings(connection): - """Check if templates have default plugin mappings""" - cursor = connection.cursor() - try: - print("\n2. Checking Template Plugin Mappings...") - print("=" * 50) - - # Check if there's a template plugin mapping table - cursor.execute(""" - SELECT TABLE_NAME - FROM information_schema.TABLES - WHERE TABLE_SCHEMA = 'railway' - AND TABLE_NAME LIKE '%template%plugin%' - """) - - mapping_tables = cursor.fetchall() - - if mapping_tables: - print("Found template plugin mapping tables:") - for table in mapping_tables: - print(f" - {table[0]}") - else: - print("No template plugin mapping tables found") - print("Templates likely don't have default plugin configurations") - print("Plugins are probably added when agents are created from templates") - - return mapping_tables - - except Error as e: - print(f"Error checking template mappings: {e}") - return [] - finally: - cursor.close() - -def add_story_to_all_templates(connection): - """Ensure all templates will include play_story for new agents""" - cursor = connection.cursor() - try: - print("\n3. Adding Story Playback to All Templates...") - print("=" * 50) - - # Get all templates - cursor.execute("SELECT id, agent_name FROM ai_agent_template") - templates = cursor.fetchall() - - # For each template, we need to ensure Story Playback is included - # Since templates don't have direct plugin mappings, we need to check - # if there's a default plugin list or configuration - - # Check if there's a system parameter for default plugins - cursor.execute(""" - SELECT param_key, param_value - FROM sys_params - WHERE param_key LIKE '%plugin%' OR param_key LIKE '%function%' - """) - - system_params = cursor.fetchall() - - if system_params: - print("Found system parameters related to plugins:") - for key, value in system_params: - print(f" {key}: {value[:100] if value else 'NULL'}...") - - # Check if this parameter contains plugin defaults - if 'default' in key.lower() and 'plugin' in key.lower(): - try: - if value and value.startswith('['): - plugins = json.loads(value) - if 'SYSTEM_PLUGIN_STORY' not in plugins: - plugins.append('SYSTEM_PLUGIN_STORY') - cursor.execute(""" - UPDATE sys_params - SET param_value = %s - WHERE param_key = %s - """, (json.dumps(plugins), key)) - print(f" Updated {key} to include SYSTEM_PLUGIN_STORY") - except: - pass - - # Add a new system parameter for default plugins if it doesn't exist - cursor.execute(""" - SELECT param_key FROM sys_params - WHERE param_key = 'default_agent_plugins' - """) - - if not cursor.fetchone(): - print("\nAdding default_agent_plugins system parameter...") - - default_plugins = [ - "SYSTEM_PLUGIN_MUSIC", - "SYSTEM_PLUGIN_STORY", - "SYSTEM_PLUGIN_WEATHER", - "SYSTEM_PLUGIN_NEWS_NEWSNOW" - ] - - cursor.execute(""" - INSERT INTO sys_params (param_key, param_value, param_type, remark, creator, create_date, updater, update_date) - VALUES (%s, %s, %s, %s, 0, NOW(), 0, NOW()) - """, ( - 'default_agent_plugins', - json.dumps(default_plugins), - 1, # Type 1 for system parameter - 'Default plugins for new agents' - )) - - print("Added default_agent_plugins with Story Playback included") - connection.commit() - else: - # Update existing parameter - cursor.execute(""" - SELECT param_value FROM sys_params - WHERE param_key = 'default_agent_plugins' - """) - - current_value = cursor.fetchone()[0] - if current_value: - try: - plugins = json.loads(current_value) - if 'SYSTEM_PLUGIN_STORY' not in plugins: - plugins.append('SYSTEM_PLUGIN_STORY') - cursor.execute(""" - UPDATE sys_params - SET param_value = %s, update_date = NOW() - WHERE param_key = 'default_agent_plugins' - """, (json.dumps(plugins),)) - print("Updated default_agent_plugins to include SYSTEM_PLUGIN_STORY") - connection.commit() - else: - print("SYSTEM_PLUGIN_STORY already in default_agent_plugins") - except Exception as e: - print(f"Error updating default plugins: {e}") - - return True - - except Error as e: - print(f"Error adding story to templates: {e}") - connection.rollback() - return False - finally: - cursor.close() - -def ensure_template_story_mappings(connection): - """Ensure all agent templates have Story Playback in their configuration""" - cursor = connection.cursor() - try: - print("\n4. Ensuring Template Configurations Include Story...") - print("=" * 50) - - # Since templates don't have direct plugin mappings, - # we need to ensure the agent creation process includes Story Playback - - # Check if there's an agent_template_plugin table or similar - cursor.execute(""" - SHOW TABLES LIKE '%agent_template%' - """) - - template_tables = cursor.fetchall() - print(f"Template-related tables found: {len(template_tables)}") - for table in template_tables: - print(f" - {table[0]}") - - # The key is to ensure that when an agent is created from a template, - # it automatically gets the Story Playback plugin - - # Check for any stored procedures or triggers that create agents - cursor.execute(""" - SELECT ROUTINE_NAME, ROUTINE_TYPE - FROM information_schema.ROUTINES - WHERE ROUTINE_SCHEMA = 'railway' - AND (ROUTINE_NAME LIKE '%agent%' OR ROUTINE_NAME LIKE '%create%') - """) - - procedures = cursor.fetchall() - if procedures: - print("\nFound stored procedures/functions related to agents:") - for proc_name, proc_type in procedures: - print(f" - {proc_type}: {proc_name}") - - return True - - except Error as e: - print(f"Error ensuring template mappings: {e}") - return False - finally: - cursor.close() - -def create_trigger_for_new_agents(connection): - """Create a trigger to automatically add Story Playback to new agents""" - cursor = connection.cursor() - try: - print("\n5. Creating Trigger for New Agents...") - print("=" * 50) - - # Drop existing trigger if it exists - cursor.execute("DROP TRIGGER IF EXISTS add_story_to_new_agent") - - # Create trigger to automatically add Story Playback when a new agent is created - trigger_sql = """ - CREATE TRIGGER add_story_to_new_agent - AFTER INSERT ON ai_agent - FOR EACH ROW - BEGIN - -- Add Story Playback plugin to new agent - IF NOT EXISTS ( - SELECT 1 FROM ai_agent_plugin_mapping - WHERE agent_id = NEW.id - AND plugin_id = 'SYSTEM_PLUGIN_STORY' - ) THEN - INSERT INTO ai_agent_plugin_mapping (agent_id, plugin_id, param_info) - VALUES ( - NEW.id, - 'SYSTEM_PLUGIN_STORY', - '{"story_dir": "./stories", "story_ext": ".mp3;.wav;.m4a", "refresh_time": "300"}' - ); - END IF; - - -- Also add other default plugins - IF NOT EXISTS ( - SELECT 1 FROM ai_agent_plugin_mapping - WHERE agent_id = NEW.id - AND plugin_id = 'SYSTEM_PLUGIN_MUSIC' - ) THEN - INSERT INTO ai_agent_plugin_mapping (agent_id, plugin_id, param_info) - VALUES (NEW.id, 'SYSTEM_PLUGIN_MUSIC', '{}'); - END IF; - - IF NOT EXISTS ( - SELECT 1 FROM ai_agent_plugin_mapping - WHERE agent_id = NEW.id - AND plugin_id = 'SYSTEM_PLUGIN_WEATHER' - ) THEN - INSERT INTO ai_agent_plugin_mapping (agent_id, plugin_id, param_info) - VALUES (NEW.id, 'SYSTEM_PLUGIN_WEATHER', '{"api_key": "12dd0eea5789636262549c9ec7f4f7d8", "default_location": "Bangalore", "units": "metric", "lang": "en"}'); - END IF; - END - """ - - try: - cursor.execute(trigger_sql) - print("Created trigger to automatically add Story Playback to new agents!") - connection.commit() - return True - except Error as e: - if "This version of MySQL doesn't yet support" in str(e): - print("Database doesn't support this trigger syntax") - print("Will use alternative method...") - return False - else: - print(f"Error creating trigger: {e}") - return False - - except Error as e: - print(f"Error with trigger creation: {e}") - return False - finally: - cursor.close() - -def main(): - print("Fixing Default Agent Template for Story Playback") - print("=" * 70) - - connection = connect_to_database() - if not connection: - return - - try: - # 1. Check existing templates - templates = check_agent_templates(connection) - - # 2. Check template plugin mappings - check_template_plugin_mappings(connection) - - # 3. Add story to templates - add_story_to_all_templates(connection) - - # 4. Ensure template configurations - ensure_template_story_mappings(connection) - - # 5. Try to create trigger (may not work on all MySQL versions) - trigger_created = create_trigger_for_new_agents(connection) - - # Summary - print(f"\n{'='*70}") - print("SUMMARY") - print('='*70) - - print("Actions taken:") - print("1. Checked all agent templates") - print("2. Added default_agent_plugins system parameter with Story Playback") - print("3. Ensured Story Playback is in default plugin list") - - if trigger_created: - print("4. Created database trigger for automatic Story Playback addition") - else: - print("4. Trigger creation failed (database limitation)") - print(" New agents will need Story Playback added by the application") - - print("\nRECOMMENDATION:") - print("To ensure all new agents have Story Playback, the agent creation") - print("process in the manager-api should be updated to automatically") - print("include SYSTEM_PLUGIN_STORY in the plugin mappings.") - - finally: - connection.close() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/fix_intent_functions.py b/fix_intent_functions.py deleted file mode 100644 index 852a9d86f..000000000 --- a/fix_intent_functions.py +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/env python3 -""" -Fix Intent function configuration to include play_story -""" - -import mysql.connector -from mysql.connector import Error -import json - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Database connection error: {e}") - return None - -def check_and_fix_intent_config(connection): - """Check and fix Intent function configuration""" - cursor = connection.cursor() - try: - # Get current Intent configuration - cursor.execute(""" - SELECT id, fields - FROM ai_model_provider - WHERE model_type = 'Intent' AND provider_code = 'function_call' - LIMIT 1 - """) - - result = cursor.fetchone() - if not result: - print("ERROR: Intent function call configuration not found!") - return False - - config_id, fields = result - print(f"Found Intent config: {config_id}") - - try: - fields_json = json.loads(fields) - print(f"Current fields count: {len(fields_json)}") - - # Check if functions field exists - functions_field_exists = False - for field in fields_json: - if field.get('key') == 'functions': - functions_field_exists = True - current_functions = field.get('default', '') - print(f"Current functions: {current_functions}") - - if 'play_story' in current_functions.lower(): - print("play_story already exists in functions!") - return True - break - - if not functions_field_exists: - print("Functions field missing! Adding it...") - - # Add functions field with all necessary functions - functions_field = { - "key": "functions", - "type": "array", - "label": "Functions", - "default": "play_music;play_story;get_weather;get_indian_news_api;get_news_from_newsnow;get_lunar" - } - - fields_json.append(functions_field) - else: - print("Adding play_story to existing functions...") - for i, field in enumerate(fields_json): - if field.get('key') == 'functions': - current_functions = field.get('default', '') - if current_functions and not current_functions.endswith(';'): - updated_functions = current_functions + ';play_story' - elif current_functions: - updated_functions = current_functions + 'play_story' - else: - updated_functions = 'play_story;play_music;get_weather;get_indian_news_api;get_news_from_newsnow;get_lunar' - - fields_json[i]['default'] = updated_functions - print(f"Updated functions to: {updated_functions}") - break - - # Update database - cursor.execute(""" - UPDATE ai_model_provider - SET fields = %s - WHERE id = %s - """, (json.dumps(fields_json), config_id)) - - connection.commit() - print("SUCCESS: Intent configuration updated!") - return True - - except json.JSONDecodeError as e: - print(f"JSON parsing error: {e}") - return False - - except Error as e: - print(f"Database error: {e}") - connection.rollback() - return False - finally: - cursor.close() - -def add_story_to_missing_agents(connection): - """Add Story Playback to agents that don't have it""" - cursor = connection.cursor() - try: - # Get agents without Story Playback - cursor.execute(""" - SELECT a.id, a.agent_name - FROM ai_agent a - LEFT JOIN ai_agent_plugin_mapping apm - ON a.id = apm.agent_id AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - WHERE apm.plugin_id IS NULL - """) - - missing_agents = cursor.fetchall() - - if not missing_agents: - print("All agents already have Story Playback!") - return True - - print(f"Adding Story Playback to {len(missing_agents)} agents...") - - # Default Story Playback parameters - param_info = { - "story_dir": "./stories", - "story_ext": ".mp3;.wav;.m4a", - "refresh_time": "300" - } - - success_count = 0 - for agent_id, agent_name in missing_agents: - try: - cursor.execute(""" - INSERT INTO ai_agent_plugin_mapping - (agent_id, plugin_id, param_info) - VALUES (%s, %s, %s) - """, (agent_id, "SYSTEM_PLUGIN_STORY", json.dumps(param_info))) - - print(f"Added Story Playback to: {agent_name}") - success_count += 1 - - except Error as e: - print(f"Failed to add to {agent_name}: {e}") - - connection.commit() - print(f"SUCCESS: Added Story Playback to {success_count} agents!") - return True - - except Error as e: - print(f"Error adding Story Playback to agents: {e}") - connection.rollback() - return False - finally: - cursor.close() - -def verify_final_state(connection): - """Verify everything is working""" - cursor = connection.cursor() - try: - # Check Intent functions - cursor.execute(""" - SELECT fields - FROM ai_model_provider - WHERE model_type = 'Intent' AND provider_code = 'function_call' - LIMIT 1 - """) - - result = cursor.fetchone() - if result: - fields_json = json.loads(result[0]) - for field in fields_json: - if field.get('key') == 'functions': - functions = field.get('default', '') - print(f"Final Intent functions: {functions}") - break - - # Check agent count - cursor.execute(""" - SELECT - COUNT(*) as total_agents, - SUM(CASE WHEN apm.plugin_id IS NOT NULL THEN 1 ELSE 0 END) as agents_with_story - FROM ai_agent a - LEFT JOIN ai_agent_plugin_mapping apm - ON a.id = apm.agent_id AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - """) - - total, with_story = cursor.fetchone() - print(f"Final state: {with_story}/{total} agents have Story Playback") - - if with_story == total: - print("SUCCESS: All agents now have Story Playback!") - return True - else: - print(f"WARNING: {total - with_story} agents still missing Story Playback") - return False - - except Error as e: - print(f"Error verifying final state: {e}") - return False - finally: - cursor.close() - -def main(): - print("Fixing Story Playback Function Configuration") - print("=" * 50) - - connection = connect_to_database() - if not connection: - return - - try: - # 1. Fix Intent configuration - print("\n1. Fixing Intent Function Configuration...") - intent_fixed = check_and_fix_intent_config(connection) - - # 2. Add Story Playback to missing agents - print("\n2. Adding Story Playback to Missing Agents...") - agents_fixed = add_story_to_missing_agents(connection) - - # 3. Verify final state - print("\n3. Verifying Final State...") - final_ok = verify_final_state(connection) - - # Summary - print(f"\n{'='*50}") - print("FINAL RESULT") - print('='*50) - - if intent_fixed: - print("Intent configuration: FIXED") - else: - print("Intent configuration: FAILED") - - if agents_fixed: - print("Agent mappings: FIXED") - else: - print("Agent mappings: FAILED") - - if final_ok: - print("Overall status: SUCCESS - Story Playback ready!") - else: - print("Overall status: PARTIAL - Some issues remain") - - finally: - connection.close() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/fix_migration.sql b/fix_migration.sql deleted file mode 100644 index b8968fda9..000000000 --- a/fix_migration.sql +++ /dev/null @@ -1,67 +0,0 @@ --- Clear Liquibase lock and failed changesets -DELETE FROM DATABASECHANGELOGLOCK WHERE ID = 1; - --- Mark the failed changeset as already executed (skip it) -INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) -SELECT '202501230004_translate_model_names', 'cheeko', 'db/changelog/db.changelog-master.yaml', NOW(), - (SELECT COALESCE(MAX(ORDEREXECUTED), 0) + 1 FROM DATABASECHANGELOG d), 'EXECUTED', 'placeholder', - 'Manual fix for column name issue', 'Manually fixed', NULL, '4.20.0', NULL, NULL, - CONCAT(UNIX_TIMESTAMP(NOW()), '000') -WHERE NOT EXISTS ( - SELECT 1 FROM DATABASECHANGELOG - WHERE ID = '202501230004_translate_model_names' - AND AUTHOR = 'cheeko' - AND FILENAME = 'db/changelog/db.changelog-master.yaml' -); - --- Apply the translations manually with correct column names -UPDATE ai_model_provider SET name = 'SileroVAD Voice Activity Detection' WHERE name = 'SileroVAD语音活动检测'; -UPDATE ai_model_provider SET name = 'FunASR Speech Recognition' WHERE name = 'FunASR语音识别'; -UPDATE ai_model_provider SET name = 'SherpaASR Speech Recognition' WHERE name = 'SherpaASR语音识别'; -UPDATE ai_model_provider SET name = 'Volcano Engine Speech Recognition' WHERE name = '火山引擎语音识别'; -UPDATE ai_model_provider SET name = 'Tencent Speech Recognition' WHERE name = '腾讯语音识别'; -UPDATE ai_model_provider SET name = 'Tencent Speech Synthesis' WHERE name = '腾讯语音合成'; -UPDATE ai_model_provider SET name = 'Alibaba Cloud Speech Recognition' WHERE name = '阿里云语音识别'; -UPDATE ai_model_provider SET name = 'Alibaba Cloud Speech Recognition (Streaming)' WHERE name = '阿里云语音识别(流式)'; -UPDATE ai_model_provider SET name = 'Baidu Speech Recognition' WHERE name = '百度语音识别'; -UPDATE ai_model_provider SET name = 'OpenAI Speech Recognition' WHERE name = 'OpenAI语音识别'; -UPDATE ai_model_provider SET name = 'Volcano Engine Speech Recognition (Streaming)' WHERE name = '火山引擎语音识别(流式)'; -UPDATE ai_model_provider SET name = 'Alibaba Bailian Interface' WHERE name = '阿里百炼接口'; -UPDATE ai_model_provider SET name = 'Volcano Engine LLM' WHERE name = '火山引擎LLM'; -UPDATE ai_model_provider SET name = 'Volcano Engine TTS' WHERE name = '火山引擎TTS'; -UPDATE ai_model_provider SET name = 'Alibaba Cloud TTS' WHERE name = '阿里云TTS'; -UPDATE ai_model_provider SET name = 'Volcano Dual-Stream Speech Synthesis' WHERE name = '火山双流式语音合成'; -UPDATE ai_model_provider SET name = 'Linkerai Speech Synthesis' WHERE name = 'Linkerai语音合成'; -UPDATE ai_model_provider SET name = 'Alibaba Cloud Speech Synthesis (Streaming)' WHERE name = '阿里云语音合成(流式)'; -UPDATE ai_model_provider SET name = 'Index-TTS-vLLM Streaming Speech Synthesis' WHERE name = 'Index-TTS-vLLM流式语音合成'; -UPDATE ai_model_provider SET name = 'Mem0AI Memory' WHERE name = 'Mem0AI记忆'; -UPDATE ai_model_provider SET name = 'No Memory' WHERE name = '无记忆'; -UPDATE ai_model_provider SET name = 'Local Short Memory' WHERE name = '本地短记忆'; -UPDATE ai_model_provider SET name = 'No Intent Recognition' WHERE name = '无意图识别'; -UPDATE ai_model_provider SET name = 'LLM Intent Recognition' WHERE name = 'LLM意图识别'; -UPDATE ai_model_provider SET name = 'Function Call Intent Recognition' WHERE name = '函数调用意图识别'; -UPDATE ai_model_provider SET name = 'FunASR Server Speech Recognition' WHERE name = 'FunASR服务语音识别'; -UPDATE ai_model_provider SET name = 'MiniMax Speech Synthesis' WHERE name = 'MiniMax语音合成'; -UPDATE ai_model_provider SET name = 'OpenAI Speech Synthesis' WHERE name = 'OpenAI语音合成'; - --- Update model config names -UPDATE ai_model_config SET model_name = 'Zhipu AI' WHERE model_name = '智谱AI'; -UPDATE ai_model_config SET model_name = 'Tongyi Qianwen' WHERE model_name = '通义千问'; -UPDATE ai_model_config SET model_name = 'Tongyi Bailian' WHERE model_name = '通义百炼'; -UPDATE ai_model_config SET model_name = 'Doubao Large Model' WHERE model_name = '豆包大模型'; -UPDATE ai_model_config SET model_name = 'Google Gemini' WHERE model_name = '谷歌Gemini'; -UPDATE ai_model_config SET model_name = 'Tencent Speech Recognition' WHERE model_name = '腾讯语音识别'; -UPDATE ai_model_config SET model_name = 'Alibaba Cloud Speech Recognition' WHERE model_name = '阿里云语音识别'; -UPDATE ai_model_config SET model_name = 'Baidu Speech Recognition' WHERE model_name = '百度语音识别'; -UPDATE ai_model_config SET model_name = 'MiniMax Speech Synthesis' WHERE model_name = 'MiniMax语音合成'; -UPDATE ai_model_config SET model_name = 'OpenAI Speech Synthesis' WHERE model_name = 'OpenAI语音合成'; -UPDATE ai_model_config SET model_name = 'Volcano Dual-Stream Speech Synthesis' WHERE model_name = '火山双流式语音合成'; -UPDATE ai_model_config SET model_name = 'Linkerai Speech Synthesis' WHERE model_name = 'Linkerai语音合成'; -UPDATE ai_model_config SET model_name = 'Mem0AI Memory' WHERE model_name = 'Mem0AI记忆'; -UPDATE ai_model_config SET model_name = 'Function Call Intent Recognition' WHERE model_name = '函数调用意图识别'; -UPDATE ai_model_config SET model_name = 'Zhipu Visual AI' WHERE model_name = '智谱视觉AI'; -UPDATE ai_model_config SET model_name = 'Qianwen Visual Model' WHERE model_name = '千问视觉模型'; -UPDATE ai_model_config SET model_name = 'Volcano Edge Large Model Gateway' WHERE model_name = '火山引擎边缘大模型网关'; - --- Update TTS voice names (correct column name) -UPDATE ai_tts_voice SET name = 'Alibaba Cloud Xiaoyun' WHERE name = '阿里云小云'; \ No newline at end of file diff --git a/fix_story_playback.py b/fix_story_playback.py deleted file mode 100644 index 50fb37638..000000000 --- a/fix_story_playback.py +++ /dev/null @@ -1,270 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to fix Story Playback function placement in agent templates -""" - -import mysql.connector -from mysql.connector import Error -import json -from tabulate import tabulate - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Successfully connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Error connecting to MySQL: {e}") - return None - -def examine_ai_agent_template(connection): - """Examine the ai_agent_template table""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("Structure of ai_agent_template table:") - print('='*60) - - cursor.execute("DESCRIBE ai_agent_template") - columns = cursor.fetchall() - - headers = ["Field", "Type", "Null", "Key", "Default", "Extra"] - print(tabulate(columns, headers=headers, tablefmt="grid")) - - # Get all records - cursor.execute("SELECT * FROM ai_agent_template") - templates = cursor.fetchall() - column_names = [desc[0] for desc in cursor.description] - - print(f"\nFound {len(templates)} agent templates:") - - for i, template in enumerate(templates): - template_dict = dict(zip(column_names, template)) - print(f"\n--- Template {i+1} ---") - print(f"ID: {template_dict.get('id')}") - print(f"Template Name: {template_dict.get('template_name', template_dict.get('name'))}") - - # Look for JSON fields that might contain function configurations - for col_name, cell_value in template_dict.items(): - if isinstance(cell_value, str) and cell_value.strip().startswith('{'): - try: - json_data = json.loads(cell_value) - print(f"\nJSON field '{col_name}':") - - # Check if it contains function configurations - if any(key in json_data for key in ['selected_functions', 'unselected_functions', 'functions', 'selectedFunctions', 'unselectedFunctions', 'plugins']): - print(f" Contains function/plugin configuration:") - print(json.dumps(json_data, indent=4)) - else: - # Just show the structure - print(f" Keys: {list(json_data.keys())}") - - except json.JSONDecodeError: - if len(str(cell_value)) > 100: - print(f" {col_name}: [Long text content, first 100 chars]: {str(cell_value)[:100]}...") - else: - print(f" {col_name}: {cell_value}") - elif cell_value is not None: - if len(str(cell_value)) > 100: - print(f" {col_name}: [Long content]: {str(cell_value)[:100]}...") - else: - print(f" {col_name}: {cell_value}") - - return templates, column_names - - except Error as e: - print(f"Error examining ai_agent_template: {e}") - return None, None - finally: - cursor.close() - -def check_ai_agent_plugin_mapping(connection): - """Check the ai_agent_plugin_mapping table""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("ai_agent_plugin_mapping table:") - print('='*60) - - cursor.execute("DESCRIBE ai_agent_plugin_mapping") - columns = cursor.fetchall() - - headers = ["Field", "Type", "Null", "Key", "Default", "Extra"] - print(tabulate(columns, headers=headers, tablefmt="grid")) - - # Get all records - cursor.execute("SELECT * FROM ai_agent_plugin_mapping") - mappings = cursor.fetchall() - column_names = [desc[0] for desc in cursor.description] - - if mappings: - print(f"\nPlugin mappings:") - print(tabulate(mappings, headers=column_names, tablefmt="grid")) - else: - print("\nNo plugin mappings found") - - return mappings, column_names - - except Error as e: - print(f"Error examining ai_agent_plugin_mapping: {e}") - return None, None - finally: - cursor.close() - -def fix_story_playback_in_templates(connection): - """Fix Story Playback function to be in selected functions for all agent templates""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("Fixing Story Playback function placement...") - print('='*60) - - # Get all agent templates - cursor.execute("SELECT * FROM ai_agent_template") - templates = cursor.fetchall() - column_names = [desc[0] for desc in cursor.description] - - story_playback_plugin_id = "SYSTEM_PLUGIN_STORY" - updates_made = 0 - - for template in templates: - template_dict = dict(zip(column_names, template)) - template_id = template_dict.get('id') - template_name = template_dict.get('template_name', template_dict.get('name', 'Unknown')) - - print(f"\nProcessing template: {template_name} (ID: {template_id})") - - # Check if this template already has the Story Playback plugin mapped - cursor.execute(""" - SELECT * FROM ai_agent_plugin_mapping - WHERE template_id = %s AND plugin_id = %s - """, (template_id, story_playback_plugin_id)) - existing_mapping = cursor.fetchone() - - if existing_mapping: - mapping_dict = dict(zip([desc[0] for desc in cursor.description], existing_mapping)) - current_status = mapping_dict.get('status', 0) - - print(f" Found existing mapping with status: {current_status}") - - if current_status != 1: # 1 = selected/enabled, 0 = unselected/disabled - # Update the mapping to enable the plugin - cursor.execute(""" - UPDATE ai_agent_plugin_mapping - SET status = 1, update_date = NOW(), updater = 0 - WHERE template_id = %s AND plugin_id = %s - """, (template_id, story_playback_plugin_id)) - - print(f" ✓ Updated Story Playback status from {current_status} to 1 (selected)") - updates_made += 1 - else: - print(f" ✓ Story Playback already selected for this template") - else: - # Create new mapping with status = 1 (selected) - cursor.execute(""" - INSERT INTO ai_agent_plugin_mapping - (template_id, plugin_id, status, sort, creator, create_date, updater, update_date) - VALUES (%s, %s, 1, 0, 0, NOW(), 0, NOW()) - """, (template_id, story_playback_plugin_id)) - - print(f" ✓ Created new mapping with Story Playback selected") - updates_made += 1 - - connection.commit() - print(f"\n{'='*60}") - print(f"Fix completed! Made {updates_made} updates to ensure Story Playback is selected for all agent templates.") - print('='*60) - - except Error as e: - print(f"Error fixing Story Playback function: {e}") - connection.rollback() - finally: - cursor.close() - -def verify_fix(connection): - """Verify that Story Playback is now selected for all templates""" - cursor = connection.cursor() - try: - print(f"\n{'='*60}") - print("Verifying fix...") - print('='*60) - - cursor.execute(""" - SELECT - at.id as template_id, - at.template_name, - apm.plugin_id, - apm.status, - amp.name as plugin_name - FROM ai_agent_template at - LEFT JOIN ai_agent_plugin_mapping apm ON at.id = apm.template_id AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - LEFT JOIN ai_model_provider amp ON apm.plugin_id = amp.id - ORDER BY at.template_name - """) - - results = cursor.fetchall() - column_names = [desc[0] for desc in cursor.description] - - print(f"\nStory Playback status for all templates:") - print(tabulate(results, headers=column_names, tablefmt="grid")) - - # Count how many are selected - selected_count = sum(1 for result in results if result[3] == 1) # status column - total_templates = len([r for r in results if r[0] is not None]) # templates with non-null id - - print(f"\nSummary:") - print(f"Total templates: {total_templates}") - print(f"Templates with Story Playback selected: {selected_count}") - - if selected_count == total_templates: - print("✅ SUCCESS: Story Playback is now selected for ALL agent templates!") - else: - print(f"⚠️ WARNING: {total_templates - selected_count} templates still don't have Story Playback selected") - - except Error as e: - print(f"Error verifying fix: {e}") - finally: - cursor.close() - -def main(): - print("Fixing Story Playback function placement in xiaozhi database") - print("=" * 70) - - # Connect to database - connection = connect_to_database() - if not connection: - return - - try: - # Examine agent template structure - examine_ai_agent_template(connection) - - # Check plugin mapping table - check_ai_agent_plugin_mapping(connection) - - # Fix Story Playback placement - fix_story_playback_in_templates(connection) - - # Verify the fix - verify_fix(connection) - - finally: - if connection.is_connected(): - connection.close() - print(f"\nMySQL connection closed") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/fix_trigger_and_verify.py b/fix_trigger_and_verify.py deleted file mode 100644 index 078b19ffd..000000000 --- a/fix_trigger_and_verify.py +++ /dev/null @@ -1,293 +0,0 @@ -#!/usr/bin/env python3 -""" -Fix the trigger and ensure Story Playback is added to ALL new agents -""" - -import mysql.connector -from mysql.connector import Error -import json - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Database connection error: {e}") - return None - -def check_latest_agent(connection): - """Check the latest agent that was just created""" - cursor = connection.cursor() - try: - print("\n1. Checking Latest Agent...") - print("=" * 60) - - # Get the most recent agent - cursor.execute(""" - SELECT - a.id, - a.agent_name, - a.agent_code, - a.created_at, - GROUP_CONCAT(apm.plugin_id) as plugins - FROM ai_agent a - LEFT JOIN ai_agent_plugin_mapping apm ON a.id = apm.agent_id - WHERE a.agent_name = 'test' OR a.agent_code LIKE 'AGT_1756545169%' - GROUP BY a.id, a.agent_name, a.agent_code, a.created_at - ORDER BY a.created_at DESC - LIMIT 1 - """) - - result = cursor.fetchone() - - if result: - agent_id, name, code, created, plugins = result - print(f"Latest agent: {name} (ID: {agent_id[:16]}...)") - print(f"Code: {code}") - print(f"Created: {created}") - print(f"Plugins: {plugins}") - - if plugins and 'SYSTEM_PLUGIN_STORY' not in plugins: - print("\n[!] Story Playback is MISSING! Adding it now...") - - # Add Story Playback - param_info = { - "story_dir": "./stories", - "story_ext": ".mp3;.wav;.m4a", - "refresh_time": "300" - } - - cursor.execute(""" - INSERT INTO ai_agent_plugin_mapping - (agent_id, plugin_id, param_info) - VALUES (%s, %s, %s) - """, (agent_id, "SYSTEM_PLUGIN_STORY", json.dumps(param_info))) - - connection.commit() - print("[FIXED] Added Story Playback to latest agent!") - - return agent_id - elif plugins and 'SYSTEM_PLUGIN_STORY' in plugins: - print("[OK] Story Playback already present!") - return agent_id - else: - print("No agent found with name 'test'") - - return None - - except Error as e: - print(f"Error checking latest agent: {e}") - return None - finally: - cursor.close() - -def drop_and_recreate_trigger(connection): - """Drop the old trigger and create a better one""" - cursor = connection.cursor() - try: - print("\n2. Recreating Database Trigger...") - print("=" * 60) - - # Drop existing trigger - cursor.execute("DROP TRIGGER IF EXISTS add_story_to_new_agent") - print("Dropped old trigger") - - # Create new trigger that works after INSERT - # Using simpler syntax that should work on more MySQL versions - trigger_sql = """ - CREATE TRIGGER add_story_to_new_agent - AFTER INSERT ON ai_agent - FOR EACH ROW - BEGIN - INSERT IGNORE INTO ai_agent_plugin_mapping (agent_id, plugin_id, param_info) - VALUES (NEW.id, 'SYSTEM_PLUGIN_STORY', '{"story_dir": "./stories", "story_ext": ".mp3;.wav;.m4a", "refresh_time": "300"}'); - END - """ - - cursor.execute(trigger_sql) - connection.commit() - print("Created new trigger successfully!") - - return True - - except Error as e: - print(f"Trigger creation failed: {e}") - - # Try alternative approach - stored procedure - try: - print("\nTrying stored procedure approach...") - - cursor.execute("DROP PROCEDURE IF EXISTS add_default_plugins") - - proc_sql = """ - CREATE PROCEDURE add_default_plugins(IN agent_id VARCHAR(32)) - BEGIN - INSERT IGNORE INTO ai_agent_plugin_mapping (agent_id, plugin_id, param_info) - VALUES (agent_id, 'SYSTEM_PLUGIN_STORY', '{"story_dir": "./stories", "story_ext": ".mp3;.wav;.m4a", "refresh_time": "300"}'); - END - """ - - cursor.execute(proc_sql) - connection.commit() - print("Created stored procedure as alternative!") - - return True - - except Error as e2: - print(f"Stored procedure also failed: {e2}") - return False - finally: - cursor.close() - -def ensure_all_agents_have_story(connection): - """Make sure ALL agents have Story Playback""" - cursor = connection.cursor() - try: - print("\n3. Ensuring ALL Agents Have Story Playback...") - print("=" * 60) - - # Find agents without Story Playback - cursor.execute(""" - SELECT a.id, a.agent_name - FROM ai_agent a - LEFT JOIN ai_agent_plugin_mapping apm - ON a.id = apm.agent_id AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - WHERE apm.plugin_id IS NULL - """) - - agents_without_story = cursor.fetchall() - - if agents_without_story: - print(f"Found {len(agents_without_story)} agents without Story Playback:") - - param_info = { - "story_dir": "./stories", - "story_ext": ".mp3;.wav;.m4a", - "refresh_time": "300" - } - - for agent_id, agent_name in agents_without_story: - print(f" Adding to: {agent_name}") - - cursor.execute(""" - INSERT IGNORE INTO ai_agent_plugin_mapping - (agent_id, plugin_id, param_info) - VALUES (%s, %s, %s) - """, (agent_id, "SYSTEM_PLUGIN_STORY", json.dumps(param_info))) - - connection.commit() - print(f"[FIXED] Added Story Playback to {len(agents_without_story)} agents!") - else: - print("All agents already have Story Playback!") - - return True - - except Error as e: - print(f"Error ensuring Story Playback: {e}") - return False - finally: - cursor.close() - -def update_manager_api_defaults(connection): - """Update manager-api default plugins to include Story Playback""" - cursor = connection.cursor() - try: - print("\n4. Updating Manager-API Default Plugins...") - print("=" * 60) - - # Check if there's a default plugins configuration - cursor.execute(""" - SELECT id, agent_code, agent_name - FROM ai_agent_template - WHERE is_visible = 0 - ORDER BY sort - LIMIT 1 - """) - - default_template = cursor.fetchone() - - if default_template: - template_id = default_template[0] - print(f"Default template: {default_template[2]} (ID: {template_id})") - - # The manager-api needs to be configured to include Story Playback - # when creating agents from templates - - print("\nRECOMMENDATION FOR MANAGER-API:") - print("The manager-api code should be updated to include") - print("SYSTEM_PLUGIN_STORY in the default plugins list when") - print("creating new agents. Currently it only adds:") - print(" - SYSTEM_PLUGIN_MUSIC") - print(" - SYSTEM_PLUGIN_WEATHER") - print(" - SYSTEM_PLUGIN_NEWS_NEWSNOW") - print("\nIt should also add:") - print(" - SYSTEM_PLUGIN_STORY") - - return True - - except Error as e: - print(f"Error updating defaults: {e}") - return False - finally: - cursor.close() - -def main(): - print("Fixing Story Playback Auto-Addition for New Agents") - print("=" * 70) - - connection = connect_to_database() - if not connection: - return - - try: - # 1. Check and fix the latest agent - latest_agent_id = check_latest_agent(connection) - - # 2. Try to recreate trigger - trigger_created = drop_and_recreate_trigger(connection) - - # 3. Ensure all agents have Story Playback - ensure_all_agents_have_story(connection) - - # 4. Update manager-api defaults - update_manager_api_defaults(connection) - - # Summary - print(f"\n{'='*70}") - print("SUMMARY") - print('='*70) - - if latest_agent_id: - print("[FIXED] Latest agent now has Story Playback") - - if trigger_created: - print("[OK] Database trigger/procedure created") - else: - print("[INFO] Trigger couldn't be created - manual fix needed") - - print("\nIMPORTANT:") - print("The manager-api Java code needs to be updated to") - print("automatically include SYSTEM_PLUGIN_STORY when") - print("creating new agents from templates.") - print("\nUntil then, Story Playback must be added manually") - print("or via this script after agent creation.") - - finally: - connection.close() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/simple_fix_story_playback.py b/simple_fix_story_playback.py deleted file mode 100644 index 8e6ef9d16..000000000 --- a/simple_fix_story_playback.py +++ /dev/null @@ -1,213 +0,0 @@ -#!/usr/bin/env python3 -""" -Simple script to fix Story Playback function placement in agent templates -""" - -import mysql.connector -from mysql.connector import Error -import json - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Successfully connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Error connecting to MySQL: {e}") - return None - -def check_current_mappings(connection): - """Check current plugin mappings""" - cursor = connection.cursor() - try: - print("\nChecking current plugin mappings...") - - # Check if ai_agent_plugin_mapping has the right structure - cursor.execute("DESCRIBE ai_agent_plugin_mapping") - columns = cursor.fetchall() - - column_names = [col[0] for col in columns] - print(f"ai_agent_plugin_mapping columns: {column_names}") - - # Check if we should use template_id or agent_id - if 'template_id' in column_names: - id_column = 'template_id' - elif 'agent_id' in column_names: - id_column = 'agent_id' - else: - print("ERROR: Neither template_id nor agent_id found in ai_agent_plugin_mapping table") - return None, None - - # Get all current mappings - cursor.execute(f"SELECT * FROM ai_agent_plugin_mapping") - mappings = cursor.fetchall() - - print(f"\nFound {len(mappings)} existing plugin mappings") - for mapping in mappings: - mapping_dict = dict(zip(column_names, mapping)) - print(f"ID: {mapping_dict.get('id')}, {id_column}: {mapping_dict.get(id_column)}, plugin_id: {mapping_dict.get('plugin_id')}") - - return mappings, id_column - - except Error as e: - print(f"Error checking current mappings: {e}") - return None, None - finally: - cursor.close() - -def get_all_agent_templates(connection): - """Get all agent template IDs""" - cursor = connection.cursor() - try: - cursor.execute("SELECT id, agent_name FROM ai_agent_template") - templates = cursor.fetchall() - - print(f"\nFound {len(templates)} agent templates:") - for template in templates: - print(f" ID: {template[0]}, Name: {template[1]}") - - return templates - - except Error as e: - print(f"Error getting agent templates: {e}") - return [] - finally: - cursor.close() - -def add_story_playback_to_all_templates(connection, templates, id_column): - """Add Story Playback plugin to all templates""" - cursor = connection.cursor() - try: - story_playback_plugin_id = "SYSTEM_PLUGIN_STORY" - updates_made = 0 - - print(f"\nAdding Story Playback plugin to all templates...") - - for template_id, template_name in templates: - print(f"\nProcessing template: {template_name} (ID: {template_id})") - - # Check if mapping already exists - cursor.execute(f""" - SELECT * FROM ai_agent_plugin_mapping - WHERE {id_column} = %s AND plugin_id = %s - """, (template_id, story_playback_plugin_id)) - - existing = cursor.fetchone() - - if existing: - print(f" Already has Story Playback mapping") - else: - # Insert new mapping - # Create a basic param_info for the story plugin - param_info = { - "story_dir": "./stories", - "story_ext": ".mp3;.wav;.m4a", - "refresh_time": "300" - } - - cursor.execute(f""" - INSERT INTO ai_agent_plugin_mapping - ({id_column}, plugin_id, param_info) - VALUES (%s, %s, %s) - """, (template_id, story_playback_plugin_id, json.dumps(param_info))) - - print(f" Added Story Playback mapping") - updates_made += 1 - - connection.commit() - print(f"\nCompleted! Added Story Playback to {updates_made} templates.") - - except Error as e: - print(f"Error adding Story Playback mappings: {e}") - connection.rollback() - finally: - cursor.close() - -def verify_mappings(connection, id_column): - """Verify all templates now have Story Playback""" - cursor = connection.cursor() - try: - print(f"\nVerifying Story Playback mappings...") - - cursor.execute(f""" - SELECT - at.id, - at.agent_name, - CASE WHEN apm.plugin_id IS NOT NULL THEN 'YES' ELSE 'NO' END as has_story_playback - FROM ai_agent_template at - LEFT JOIN ai_agent_plugin_mapping apm - ON at.id = apm.{id_column} AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - ORDER BY at.agent_name - """) - - results = cursor.fetchall() - - total_templates = len(results) - with_story_playback = sum(1 for result in results if result[2] == 'YES') - - print(f"\nStory Playback status:") - for result in results: - template_id, agent_name, has_playback = result - status = "✓" if has_playback == 'YES' else "✗" - print(f" {status} {agent_name} (ID: {template_id})") - - print(f"\nSummary:") - print(f"Total templates: {total_templates}") - print(f"With Story Playback: {with_story_playback}") - - if with_story_playback == total_templates: - print(" SUCCESS: All templates now have Story Playback!") - else: - print(f" {total_templates - with_story_playback} templates still missing Story Playback") - - except Error as e: - print(f"Error verifying mappings: {e}") - finally: - cursor.close() - -def main(): - print("Fixing Story Playback function for all agent templates") - print("=" * 60) - - connection = connect_to_database() - if not connection: - return - - try: - # Check current state - mappings, id_column = check_current_mappings(connection) - if not id_column: - return - - # Get all templates - templates = get_all_agent_templates(connection) - if not templates: - print("No agent templates found!") - return - - # Add Story Playback to all templates - add_story_playback_to_all_templates(connection, templates, id_column) - - # Verify the fix - verify_mappings(connection, id_column) - - finally: - if connection.is_connected(): - connection.close() - print(f"\nMySQL connection closed") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/simple_story_check.py b/simple_story_check.py deleted file mode 100644 index e1be2bb10..000000000 --- a/simple_story_check.py +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/env python3 -""" -Simple script to check and fix Story Playback function mapping -""" - -import mysql.connector -from mysql.connector import Error -import json - -def connect_to_database(): - """Connect to the Railway MySQL database""" - try: - connection = mysql.connector.connect( - host='nozomi.proxy.rlwy.net', - port=25037, - database='railway', - user='root', - password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm', - charset='utf8mb4', - use_unicode=True, - ssl_disabled=True - ) - - if connection.is_connected(): - print("Successfully connected to Railway MySQL database") - return connection - - except Error as e: - print(f"Error connecting to MySQL: {e}") - return None - -def check_story_plugin_exists(connection): - """Check if Story Playback plugin exists""" - cursor = connection.cursor() - try: - cursor.execute(""" - SELECT id, provider_code, name - FROM ai_model_provider - WHERE id = 'SYSTEM_PLUGIN_STORY' - """) - - result = cursor.fetchone() - if result: - plugin_id, provider_code, name = result - print(f"[OK] Story Playback plugin exists: {plugin_id}") - print(f" Provider code: {provider_code}") - return True - else: - print(f"[ERROR] Story Playback plugin not found!") - return False - - except Error as e: - print(f"Error checking story plugin: {e}") - return False - finally: - cursor.close() - -def check_intent_function_configuration(connection): - """Check Intent function call configuration""" - cursor = connection.cursor() - try: - cursor.execute(""" - SELECT id, fields - FROM ai_model_provider - WHERE model_type = 'Intent' AND provider_code = 'function_call' - LIMIT 1 - """) - - result = cursor.fetchone() - if result: - config_id, fields = result - print(f"[OK] Intent function call config found: {config_id}") - - try: - fields_json = json.loads(fields) - - # Find functions field - functions_value = None - for field in fields_json: - if field.get('key') == 'functions': - functions_value = field.get('default', '') - break - - if functions_value: - print(f"Current functions: {functions_value}") - - if 'play_story' in functions_value.lower(): - print("[OK] play_story found in Intent functions!") - return True, config_id, fields_json - else: - print("[MISSING] play_story NOT found in Intent functions!") - return False, config_id, fields_json - else: - print("[ERROR] No functions field found in Intent config!") - return False, config_id, None - - except json.JSONDecodeError: - print("[ERROR] Could not parse Intent configuration JSON") - return False, config_id, None - - else: - print("[ERROR] Intent function call configuration not found!") - return False, None, None - - except Error as e: - print(f"Error checking Intent config: {e}") - return False, None, None - finally: - cursor.close() - -def fix_intent_functions(connection, config_id, fields_json): - """Add play_story to Intent functions if missing""" - cursor = connection.cursor() - try: - # Find and update the functions field - for i, field in enumerate(fields_json): - if field.get('key') == 'functions': - current_functions = field.get('default', '') - - # Add play_story if not present - if current_functions and not current_functions.endswith(';'): - updated_functions = current_functions + ';play_story' - elif current_functions: - updated_functions = current_functions + 'play_story' - else: - updated_functions = 'play_story' - - fields_json[i]['default'] = updated_functions - break - - # Update database - cursor.execute(""" - UPDATE ai_model_provider - SET fields = %s - WHERE id = %s - """, (json.dumps(fields_json), config_id)) - - connection.commit() - - print(f"[FIXED] Added play_story to Intent functions!") - print(f"Updated functions: {updated_functions}") - return True - - except Error as e: - print(f"Error fixing Intent functions: {e}") - connection.rollback() - return False - finally: - cursor.close() - -def check_agent_story_mappings(connection): - """Check which agents have Story Playback""" - cursor = connection.cursor() - try: - cursor.execute(""" - SELECT - a.id, - a.agent_name, - CASE WHEN apm.plugin_id IS NOT NULL THEN 'YES' ELSE 'NO' END as has_story - FROM ai_agent a - LEFT JOIN ai_agent_plugin_mapping apm - ON a.id = apm.agent_id AND apm.plugin_id = 'SYSTEM_PLUGIN_STORY' - ORDER BY a.agent_name - """) - - results = cursor.fetchall() - - total = len(results) - with_story = len([r for r in results if r[2] == 'YES']) - - print(f"\nAgent Story Playback Status:") - print(f"Total agents: {total}") - print(f"With Story Playback: {with_story}") - - if with_story < total: - print(f"Missing Story Playback:") - for agent_id, agent_name, has_story in results: - if has_story == 'NO': - print(f" - {agent_name} (ID: {agent_id})") - else: - print("[OK] All agents have Story Playback!") - - return with_story == total - - except Error as e: - print(f"Error checking agent mappings: {e}") - return False - finally: - cursor.close() - -def main(): - print("Story Playback Function Check") - print("=" * 50) - - connection = connect_to_database() - if not connection: - return - - try: - # 1. Check if Story plugin exists - print("\n1. Checking Story Playback Plugin...") - story_exists = check_story_plugin_exists(connection) - - # 2. Check Intent function configuration - print("\n2. Checking Intent Function Configuration...") - has_play_story, config_id, fields_json = check_intent_function_configuration(connection) - - # 3. Fix Intent functions if needed - if not has_play_story and config_id and fields_json: - print("\n3. Fixing Intent Function Configuration...") - fix_intent_functions(connection, config_id, fields_json) - elif has_play_story: - print("\n3. Intent Configuration - OK, no fix needed") - - # 4. Check agent mappings - print("\n4. Checking Agent Story Playback Mappings...") - all_agents_have_story = check_agent_story_mappings(connection) - - # Summary - print(f"\n{'='*50}") - print("SUMMARY") - print('='*50) - - if story_exists: - print("[✓] Story Playback plugin exists in database") - else: - print("[✗] Story Playback plugin missing") - - if has_play_story: - print("[✓] play_story configured in Intent functions") - else: - print("[✗] play_story missing from Intent functions") - - if all_agents_have_story: - print("[✓] All agents have Story Playback mapped") - else: - print("[✗] Some agents missing Story Playback") - - finally: - connection.close() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/ten-vad-1.0-ONNX/.github/workflows/test-platforms.yml b/ten-vad-1.0-ONNX/.github/workflows/test-platforms.yml deleted file mode 100644 index adb533c7c..000000000 --- a/ten-vad-1.0-ONNX/.github/workflows/test-platforms.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Test Platform Detection - -on: [push, pull_request] - -jobs: - test-platforms: - strategy: - matrix: - include: - - os: ubuntu-latest - platform: Linux - python-version: '3.9' - - os: ubuntu-latest - platform: Linux - python-version: '3.10' - - os: ubuntu-latest - platform: Linux - python-version: '3.11' - - os: ubuntu-latest - platform: Linux - python-version: '3.12' - - os: macos-latest - platform: macOS - python-version: '3.9' - - os: macos-latest - platform: macOS - python-version: '3.10' - - os: macos-latest - platform: macOS - python-version: '3.11' - - os: macos-latest - platform: macOS - python-version: '3.12' - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install system dependencies (Ubuntu) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libc++1 libc++abi1 - - - name: Install dependencies for git clone scenario - run: | - pip install -r requirements.txt - pip install -r examples/requirements.txt - - - name: Test git clone scenario - run: | - cd examples - python test.py s0724-s0730.wav output_git_clone.txt - echo "✅ ${{ matrix.platform }} Python ${{ matrix.python-version }} git clone scenario successful" - - - name: Install package - run: pip install . - - - name: Test pip install scenario - run: | - python -c "from ten_vad import TenVad; print('✅ ${{ matrix.platform }} Python ${{ matrix.python-version }} pip install import successful')" - cd examples - python test.py s0724-s0730.wav output_pip_install.txt - echo "✅ ${{ matrix.platform }} Python ${{ matrix.python-version }} pip install scenario successful" \ No newline at end of file diff --git a/ten-vad-1.0-ONNX/.gitignore b/ten-vad-1.0-ONNX/.gitignore deleted file mode 100644 index cb4c9eb3d..000000000 --- a/ten-vad-1.0-ONNX/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -examples/build-mac/ -examples/build-ios/ -examples/build-android/ -examples/build-linux/ -examples/build-windows/ -examples/build-web/ -examples_onnx/build-linux -include/.DS_Store -lib/.DS_Store -examples/.DS_Store -.vscode/ -include/__pycache__/ -__pycache__/ -examples/out.txt -.DS_Store - - - diff --git a/ten-vad-1.0-ONNX/LICENSE b/ten-vad-1.0-ONNX/LICENSE deleted file mode 100644 index 215b5271a..000000000 --- a/ten-vad-1.0-ONNX/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Open Source License - -The ten-vad is licensed pursuant to the Apache License v2.0, with the -following additional conditions. You may reproduce, prepare Derivative Works -of, publicly display, publicly perform, sublicense, distribute, or otherwise -make available (together, "Deploy") the ten-vad, for commercial or -non-commercial purposes, provided that you agree to abide by the terms below: - - 1. You may not Deploy the ten-vad in a way that competes with Agora's - offerings and/or that allows others to compete with Agora's offerings, - including without limitation enabling any third party to develop or - deploy Applications. - - 2. You may Deploy the ten-vad solely to create and enable deployment - of your Application(s) solely for your benefit and the benefit of your - direct End Users. If you prefer, you may include the following notice in - the documentation of your Application(s): "Powered by ten-vad". - - 3. Derivative Works of the ten-vad remain subject to this Open Source - License. - - 4. "End Users" shall mean the end-users of your Application(s) who access - the ten-vad solely to the extent necessary to access and use the - Application(s) you create or deploy using ten-vad. - - 5. "Application(s)" shall mean your software programs designed or developed - by using the ten-vad or where deployment is enabled by the ten-vad. - - Copyright © 2025 Agora - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -======================================================================================= - - Note that the project contains derived code from other open source project - with BSD-3-Clause and BSD-2-Clause license, refer to the "NOTICES" - file in the root directory for detailed information. diff --git a/ten-vad-1.0-ONNX/NOTICES b/ten-vad-1.0-ONNX/NOTICES deleted file mode 100644 index ab0f1dd84..000000000 --- a/ten-vad-1.0-ONNX/NOTICES +++ /dev/null @@ -1,68 +0,0 @@ -This project includes modified code from the following third-party component: - -1. File: lpcnet_enc.c - - Source: LPCNet (https:github.com/xiph/LPCNet) - - License: BSD-2-Clause - - Copyright: 2017-2019, Mozilla - - Original License Text: - Copyright (c) 2017-2019 Mozilla - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -2. Project: LPCNet - - Source: LPCNet (https:github.com/xiph/LPCNet) - - License: BSD-3-Clause - - Copyright: 2017-2018, Mozilla, 2007-2017, Jean-Marc Valin, 2005-2017, Xiph.Org Foundation, 2003-2004, Mark Borgerding - - Original License Text of LPCNet open source project: - Copyright (c) 2017-2018, Mozilla - Copyright (c) 2007-2017, Jean-Marc Valin - Copyright (c) 2005-2017, Xiph.Org Foundation - Copyright (c) 2003-2004, Mark Borgerding - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - - Neither the name of the Xiph.Org Foundation nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION - OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ten-vad-1.0-ONNX/README.md b/ten-vad-1.0-ONNX/README.md deleted file mode 100644 index c31d6614b..000000000 --- a/ten-vad-1.0-ONNX/README.md +++ /dev/null @@ -1,637 +0,0 @@ -![TEN VAD banner][ten-vad-banner] - -[![Discussion posts](https://img.shields.io/github/discussions/TEN-framework/ten-vad?labelColor=gray&color=%20%23f79009)](https://github.com/TEN-framework/ten-vad/discussions/) -[![Commits](https://img.shields.io/github/commit-activity/m/TEN-framework/ten-vad?labelColor=gray&color=pink)](https://github.com/TEN-framework/ten-vad/graphs/commit-activity) -[![Issues closed](https://img.shields.io/github/issues-search?query=repo%3ATEN-framework%2Ften-vad%20is%3Aclosed&label=issues%20closed&labelColor=gray&color=green)](https://github.com/TEN-framework/ten-vad/issues) -![](https://img.shields.io/github/contributors/ten-framework/ten-vad?color=c4f042&labelColor=gray&style=flat-square) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome!-brightgreen.svg?style=flat-square)](https://github.com/TEN-framework/ten-vad/pulls) -[![GitHub license](https://img.shields.io/badge/License-Apache_2.0_with_certain_conditions-blue.svg?labelColor=%20%23155EEF&color=%20%23528bff)](https://github.com/TEN-framework/ten-vad/blob/main/LICENSE) -[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/TEN-framework/TEN-vad) - -[![GitHub watchers](https://img.shields.io/github/watchers/TEN-framework/ten-vad?style=social&label=Watch)](https://GitHub.com/TEN-framework/ten-vad/watchers/?WT.mc_id=academic-105485-koreyst) -[![GitHub forks](https://img.shields.io/github/forks/TEN-framework/ten-vad?style=social&label=Fork)](https://GitHub.com/TEN-framework/ten-vad/network/?WT.mc_id=academic-105485-koreyst) -[![GitHub stars](https://img.shields.io/github/stars/TEN-framework/ten-vad?style=social&label=Star)](https://GitHub.com/TEN-framework/ten-vad/stargazers/?WT.mc_id=academic-105485-koreyst) - -
- -## Latest News 🔥 - -- [2025/07] We support **Python inference** on **macOS** and **Windows** with usage of the prebuilt-lib! -- [2025/06] We **finally** released and **open-sourced** the **ONNX** model and the corresponding **preprocessing code**! Now you can deploy **TEN VAD** on **any platform** and **any hardware architecture**! -- [2025/06] We are excited to announce the release of **WASM+JS** for Web WASM Support. - -
- -## Table of Contents - -- [Welcome to TEN](#welcome-to-ten) -- [TEN Hugging Face Space](#ten-hugging-face-space) -- [Introduction](#introduction) -- [Key Features](#key-features) - - [High-Performance](#1-high-performance) - - [Agent-Friendly](#2-agent-friendly) - - [Lightweight](#3-lightweight) - - [Multiple Programming Languages and Platforms](#4-multiple-programming-languages-and-platforms) - - [Supported Sampling Rate and Hop Size](#5-supproted-sampling-rate-and-hop-size) -- [Installation](#installation) -- [Quick Start](#quick-start) - - [Python Usage](#python-usage) - - [Linux](#1-linux) - - [JS Usage](#js-usage) - - [Web](#1-web) - - [C Usage](#c-usage) - - [Linux](#1-linux-1) - - [Windows](#2-windows) - - [macOS](#3-macos) - - [Android](#4-android) - - [iOS](#5-ios) -- [TEN Ecosystem](#ten-ecosystem) -- [Ask Questions](#ask-questions) -- [Citations](#citations) -- [License](#license) - -
- -## Welcome to TEN - -TEN is a comprehensive open-source ecosystem for creating, customizing, and deploying real-time conversational AI agents with multimodal capabilities including voice, vision, and avatar interactions. - -TEN includes [TEN Framework](https://github.com/ten-framework/ten-framework), [TEN Turn Detection](https://github.com/ten-framework/ten-turn-detection), [TEN VAD](https://github.com/ten-framework/ten-vad), [TEN Agent](https://github.com/TEN-framework/ten-framework/tree/main/ai_agents/demo), [TMAN Designer](https://github.com/TEN-framework/ten-framework/tree/main/core/src/ten_manager/designer_frontend), and [TEN Portal](https://github.com/ten-framework/portal). Check out [TEN Ecosystem](#ten-ecosystem) for more details. - -
- -| Community Channel | Purpose | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | -| [![Follow on X](https://img.shields.io/twitter/follow/TenFramework?logo=X&color=%20%23f5f5f5)](https://twitter.com/intent/follow?screen_name=TenFramework) | Follow TEN Framework on X for updates and announcements | -| [![Follow on LinkedIn](https://custom-icon-badges.demolab.com/badge/LinkedIn-TEN_Framework-0A66C2?logo=linkedin-white&logoColor=fff)](https://www.linkedin.com/company/ten-framework) | Follow TEN Framework on LinkedIn for updates and announcements | -| [![Discord TEN Community](https://dcbadge.vercel.app/api/server/VnPftUzAMJ?&style=flat&theme=light&color=lightgray)](https://discord.gg/VnPftUzAMJ) | Join our Discord community to connect with developers | -| [![Hugging Face Space](https://img.shields.io/badge/Hugging%20Face-TEN%20Framework-yellow?style=flat&logo=huggingface)](https://huggingface.co/TEN-framework) | Join our Hugging Face community to explore our spaces and models | -| [![WeChat](https://img.shields.io/badge/TEN_Framework-WeChat_Group-%2307C160?logo=wechat&labelColor=darkgreen&color=gray)](https://github.com/TEN-framework/ten-agent/discussions/170) | Join our WeChat group for Chinese community discussions | - -
- -> \[!IMPORTANT] -> -> **Star TEN Repositories** ⭐️ -> -> Get instant notifications for new releases and updates. Your support helps us grow and improve TEN! - -
- -![TEN star us gif](https://github.com/user-attachments/assets/eeebe996-8c14-4bf7-82ae-f1a1f7e30705) - -
- -## TEN Hugging Face Space - - - -You are more than welcome to [Visit TEN Hugging Face Space](https://huggingface.co/spaces/TEN-framework/ten-agent-demo) to try VAD and Turn Detection together. - -
- -## **Introduction** - -**TEN VAD** is a real-time voice activity detection system designed for enterprise use, providing accurate frame-level speech activity detection. It shows superior precision compared to both WebRTC VAD and Silero VAD, which are commonly used in the industry. Additionally, TEN VAD offers lower computational complexity and reduced memory usage compared to Silero VAD. Meanwhile, the architecture's temporal efficiency enables rapid voice activity detection, significantly reducing end-to-end response and turn detection latency in conversational AI systems. - -
- -## **Key Features** - -### **1. High-Performance:** - -The precision-recall curves comparing the performance of WebRTC VAD (pitch-based), Silero VAD, and TEN VAD are shown below. The evaluation is conducted on the precisely manually annotated testset. The audio files are from librispeech, gigaspeech, DNS Challenge etc. As demonstrated, TEN VAD achieves the best performance. Additionally, cross-validation experiments conducted on large internal real-world datasets demonstrate the reproducibility of these findings. The **testset with annotated labels** is released in directory "testset" of this repository. - -
- -
- -
- -Note that the default threshold of 0.5 is used to generate binary speech indicators (0 for non-speech signal, 1 for speech signal). This threshold needs to be tuned according to your domain-specific task. The precision-recall curve can be obtained by executing the following script on Linux x64. The output figure will be saved in the same directory as the script. - -``` -cd ./examples -python plot_pr_curves.py -``` - -
- -### **2. Agent-Friendly:** - -As illustrated in the figure below, TEN VAD rapidly detects speech-to-non-speech transitions, whereas Silero VAD suffers from a delay of several hundred milliseconds, resulting in increased end-to-end latency in human-agent interaction systems. In addition, as demonstrated in the 6.5s-7.0s audio segment, Silero VAD fails to identify short silent durations between adjacent speech segments. - -
- -
-
- -### **3. Lightweight:** - -We evaluated the RTF (Real-Time Factor) across five distinct platforms, each equipped with varying CPUs. TEN VAD demonstrates much lower computational complexity and smaller library size than Silero VAD. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Platform CPU RTF Lib Size
TEN VAD Silero VAD TEN VAD Silero VAD
Linux AMD Ryzen 9 5900X 12-Core 0.0150 / 306KB 2.16MB(JIT) / 2.22MB(ONNX)
Intel(R) Xeon(R) Platinum 8253 0.0136
Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz 0.0086 0.0127
Windows Intel i7-10710U 0.0150 / 464KB(x86) / 508KB(x64)
macOS M1 0.0160 731KB
Web macOS(M1) 0.010 277KB
Android Galaxy J6+ (32bit, 425) 0.0570 373KB(v7a) / 532KB(v8a)
Oppo A3s (450) 0.0490
iOS iPhone6 (A8) 0.0210 320KB
iPhone8 (A11) 0.0050
-
- -### **4. Multiple programming languages and platforms:** - -TEN VAD provides cross-platform C compatibility across five operating systems (Linux x64, Windows, macOS, Android, iOS), with Python bindings optimized for Linux x64, with wasm for Web. -
-
- -### **5. Supproted sampling rate and hop size:** - -TEN VAD operates on 16kHz audio input with configurable hop sizes (optimized frame configurations: 160/256 samples=10/16ms). Other sampling rates must be resampled to 16kHz. -
-
- -## **Installation** - -``` -git clone https://github.com/TEN-framework/ten-vad.git -``` - -
- -## **Quick Start** - -The project supports five major platforms with dynamic library linking. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Platform Dynamic Lib Supported Arch Interface Language Header Comment -
Linux libten_vad.so x64 Python, C ten_vad.h
ten_vad.py
ten_vad.js
Windows ten_vad.dll x64, x86 C
macOS ten_vad.framework arm64, x86_64 C
Web ten_vad.wasm / JS
Android libten_vad.so arm64-v8a, armeabi-v7a C
iOS ten_vad.framework arm64 C 1. not simulator
2. not iPad
-
- -### **Python Usage** - -#### **1. Linux / macOS / Windows** - -#### **Requirements** - -- numpy (Version 1.17.4/1.26.4 verified) -- scipy (Version >= 1.5.0) -- scikit-learn (Version 1.2.2/1.5.0 verified, for plotting PR curves) -- matplotlib (Version 3.1.3/3.10.0 verified, for plotting PR curves) -- torchaudio (Version 2.2.2 verified, for plotting PR curves) - -- Python version 3.8.19/3.10.14 verified - -Note: You could use other versions of above packages, but we didn't test other versions. - -
- -The **lib** only depend on numpy, you have to install the dependency via requirements.txt: - -`pip install -r requirements.txt` - -For **running demo or plotting PR curves**, you have to install the dependencies: - -`pip install -r ./examples/requirements.txt` - -Note that if you did not install **libc++1** (Linux), you have to run the code below to install it: - -``` -sudo apt update -sudo apt install libc++1 -``` - -
- -#### **Usage** - -Note: For usage in python, you can either use it by **git clone** or **pip**. - -##### **By using git clone:** - -1. Clone the repository - -``` -git clone https://github.com/TEN-framework/ten-vad.git -``` - -2. Enter examples directory - -``` -cd ./examples -``` - -3. Test - -``` -python test.py s0724-s0730.wav out.txt -``` - -
- -##### **By using pip:** - -1. Install via pip - -``` -pip install -U --force-reinstall -v git+https://github.com/TEN-framework/ten-vad.git -``` - -2. Write your own use cases and import the class, the attributes of class TenVAD you can refer to ten_vad.py - -``` -from ten_vad import TenVad -``` - -
- -### **JS Usage** - -#### **1. Web** - -##### **Requirements** - -- Node.js (macOS v14.18.2, Linux v16.20.2 verified) -- Terminal - -##### **Usage** - -``` -1) cd ./examples -2) node test_node.js s0724-s0730.wav out.txt -``` - -
- -### **C Usage** - -#### **Build Scripts** - -Located in examples/ directory or examples_onnx/ (for **ONNX** usage on Linux): - -- Linux: build-and-deploy-linux.sh -- Windows: build-and-deploy-windows.bat -- macOS: build-and-deploy-mac.sh -- Android: build-and-deploy-android.sh -- iOS: build-and-deploy-ios.sh - -#### **Dynamic Library Configuration** - -Runtime library path configuration: - -- Linux/Android: LD_LIBRARY_PATH -- macOS: DYLD_FRAMEWORK_PATH -- Windows: DLL in executable directory or system PATH - -#### **Customization** - -- Modify platform-specific build scripts -- Adjust CMakeLists.txt -- Configure toolchain and architecture settings - -#### **Overview of Usage** - -- Navigate to examples/ or examples_onnx/ (for **ONNX** usage on Linux) -- Execute platform-specific build script -- Configure dynamic library path -- Run demo with sample audio s0724-s0730.wav -- Processed results saved to out.txt - -
- -The detailed usage methods of each platform are as follows
- -#### **1. Linux** - -##### **Requirements** - -- Clang (e.g. 6.0.0-1ubuntu2 verified) -- CMake -- Terminal - -Note that if you did not install **libc++1**, you have to run the code below to install it: - -``` -sudo apt update -sudo apt install libc++1 -``` - -##### **Usage (prebuilt-lib)** - -``` -1) cd ./examples -2) ./build-and-deploy-linux.sh -``` - -##### **Usage (ONNX)** - -You have to download the **onnxruntime** packages from the [microsoft official onnxruntime github website](https://github.com/microsoft/onnxruntime). Note that the version of onnxruntime must be higher than or equal to 1.17.1 (e.g. onnxruntime-linux-x64-1.17.1.tgz). -
-
-You can check the official **ONNX Runtime releases** from [this website](https://github.com/microsoft/onnxruntime/tags). And for example, to download version 1.17.1 (Linux x64), use [this link](https://github.com/microsoft/onnxruntime/releases/download/v1.17.1/onnxruntime-linux-x64-1.17.1.tgz). After extracting the compressed file, you'll find two important directories:`include/` - header files, `lib/` - library files - -``` -1) cd examples_onnx/ -2) ./build-and-deploy-linux.sh --ort-path /absolute/path/to/your/onnxruntime/root/dir -``` - -**Note 1**: If executing the onnx demo from a different directory than the one used when running build-and-deploy-linux.sh, ensure to create a symbolic link to src/onnx_model/ to prevent ONNX model file loading failures. -
-**Note 2**: The **ONNX model** locates in `src/onnx_model` directory. - -
- -#### **2. Windows** - -##### **Requirements** - -- Visual Studio (2017, 2019, 2022 verified) -- CMake (3.26.0-rc6 verified) -- Terminal (MINGW64 or powershell) - -##### **Usage** - -``` -1) cd ./examples -2) Configure "build-and-deploy-windows.bat" with your preferred: - - Architecture (default: x64) - - Visual Studio version (default: 2019) -3) ./build-and-deploy-windows.bat -``` - -
- -#### **3. macOS** - -##### **Requirements** - -- Xcode (15.2 verified) -- CMake (3.19.2 verified) - -##### **Usage** - -``` -1) cd ./examples -2) Configure "build-and-deploy-mac.sh" with your target architecture: - - Default: arm64 (Apple Silicon) - - Alternative: x86_64 (Intel) -3) ./build-and-deploy-mac.sh -``` - -
- -#### **4. Android** - -##### **Requirements** - -- NDK (r25b, macOS verified) -- CMake (3.19.2, macOS verified) -- adb (1.0.41, macOS verified) - -##### **Usage** - -``` -1) cd ./examples -2) export ANDROID_NDK=/path/to/android-ndk # Replace it with your NDK installation path -3) Configure "build-and-deploy-android.sh" with your build settings: - - Architecture: arm64-v8a (default) or armeabi-v7a - - Toolchain: aarch64-linux-android-clang (default) or custom NDK toolchain -4) ./build-and-deploy-android.sh -``` - -
- -#### **5. iOS** - -##### **Requirements** - -Xcode (15.2, macOS verified) -CMake (3.19.2, macOS verified) - -##### **Usage** - -1. Enter examples directory - -``` -cd ./examples -``` - -2. Creates Xcode project files for iOS build - -``` -./build-and-deploy-ios.sh -``` - -3. Follow the steps below to build and test on iOS device: - - 3.1. Use Xcode to open .xcodeproj files: a) cd ./build-ios, b) open ./ten_vad_demo.xcodeproj - - 3.2. In Xcode IDE, select ten_vad_demo target (should check: Edit Scheme → Run → Release), then select your iOS Device (not simulator). - -
- -
- - 3.3. Drag ten_vad/lib/iOS/ten_vad.framework to "Frameworks, Libraries, and Embedded Content" - - - (in TARGETS → ten_vad_demo → ten_vad_demo → General, should set Embed to "Embed & Sign"). - - - or add it directly in this way: "Frameworks, Libraries, and Embedded Content" → "+" → Add Other... → Add Files →... - - - Note: If this step is not completed, you may encounter the following runtime error: "dyld: Library not loaded: @rpath/ten_vad.framework/ten_vad". - -
- -
- - 3.4. Configure iOS device Signature - - - in TARGETS → ten_vad_demo → Signing & Capabilities → Signing - - - Modify Bundle Identifier: modify "com.yourcompany" to yours; - - - Specify Provisioning Profile - - - In TARGETS → ten_vad_demo → Build Settings → Signing → Code Signing Identity: - - - Specify your Certification - - 3.5. Build in Xcode and run demo on your device. - -
- -## TEN Ecosystem - -| Project | Preview | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | -| [**🏚️ TEN Framework**][ten-framework-link]
TEN is an open-source framework for real-time, multimodal conversational AI.

![][ten-framework-shield] | ![][ten-framework-banner] | -| [**️🔂 TEN Turn Detection**][ten-turn-detection-link]
TEN is for full-duplex dialogue communication.

![][ten-turn-detection-shield] | ![][ten-turn-detection-banner] | -| [**🔉 TEN VAD**][ten-vad-link]
TEN VAD is a low-latency, lightweight and high-performance streaming voice activity detector (VAD).

![][ten-vad-shield] | ![][ten-vad-banner] | -| [**🎙️ TEN Agent**][ten-agent-link]
TEN Agent is a showcase of TEN Framewrok.

| ![][ten-agent-banner] | -| [**🎨 TMAN Designer**][tman-designer-link]
TMAN Designer is low/no code option to make a voice agent with easy to use workflow UI.

| ![][tman-designer-banner] | -| [**📒 TEN Portal**][ten-portal-link]
The official site of TEN framework, it has documentation and blog.

![][ten-portal-shield] | ![][ten-portal-banner] | - -
- -## Ask Questions - -[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/TEN-framework/TEN-vad) - -Most questions can be answered by using DeepWiki, it is fast, intutive to use and supports multiple languages. - -
- -## **Citations** - -``` -@misc{TEN VAD, - author = {TEN Team}, - title = {TEN VAD: A Low-Latency, Lightweight and High-Performance Streaming Voice Activity Detector (VAD)}, - year = {2025}, - publisher = {GitHub}, - journal = {GitHub repository}, - howpublished = {https://github.com/TEN-framework/ten-vad.git}, - email = {developer@ten.ai} -} -``` - -
- -## License - -This project is licensed under Apache 2.0 with certain conditions. Refer to the "LICENSE" file in the root directory for detailed information. Note that `pitch_est.cc` contains modified code derived from [LPCNet](https://github.com/xiph/LPCNet), which is [BSD-2-Clause](https://spdx.org/licenses/BSD-2-Clause.html) and [BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html) licensed, refer to the NOTICES file in the root directory for detailed information. - -
- -[back-to-top]: https://img.shields.io/badge/-Back_to_top-gray?style=flat-square -[ten-framework-shield]: https://img.shields.io/github/stars/ten-framework/ten_framework?color=ffcb47&labelColor=gray&style=flat-square&logo=github -[ten-framework-banner]: https://github.com/user-attachments/assets/7c8f72d7-3993-4d01-8504-b71578a22944 -[ten-framework-link]: https://github.com/ten-framework/ten_framework -[ten-vad-link]: https://github.com/ten-framework/ten-vad -[ten-vad-shield]: https://img.shields.io/github/stars/ten-framework/ten-vad?color=ffcb47&labelColor=gray&style=flat-square&logo=github -[ten-vad-banner]: https://github.com/user-attachments/assets/d45870e4-9453-4047-8163-08737f82863f -[ten-turn-detection-link]: https://github.com/ten-framework/ten-turn-detection -[ten-turn-detection-shield]: https://img.shields.io/github/stars/ten-framework/ten-turn-detection?color=ffcb47&labelColor=gray&style=flat-square&logo=github -[ten-turn-detection-banner]: https://github.com/user-attachments/assets/8d0ec716-5d0e-43e4-ad9a-d97b17305658 -[ten-agent-link]: https://github.com/TEN-framework/ten-framework/tree/main/ai_agents -[ten-agent-banner]: https://github.com/user-attachments/assets/38de2207-939b-4702-a0aa-04491f5b5275 -[tman-designer-banner]: https://github.com/user-attachments/assets/804c3543-0a47-42b7-b40b-ef32b742fb8f -[tman-designer-link]: https://github.com/TEN-framework/ten-framework/tree/main/core/src/ten_manager/designer_frontend -[ten-portal-link]: https://github.com/ten-framework/portal -[ten-portal-shield]: https://img.shields.io/github/stars/ten-framework/portal?color=ffcb47&labelColor=gray&style=flat-square&logo=github -[ten-portal-banner]: https://github.com/user-attachments/assets/e17d8aaa-5928-45dd-ac71-814928e26a89 diff --git a/ten-vad-1.0-ONNX/examples/CMakeLists.txt b/ten-vad-1.0-ONNX/examples/CMakeLists.txt deleted file mode 100644 index 709373c8d..000000000 --- a/ten-vad-1.0-ONNX/examples/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright © 2025 Agora -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0, with certain conditions. -# Refer to the "LICENSE" file in the root directory for more information. -# -cmake_minimum_required(VERSION 3.10) -get_filename_component(ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../ ABSOLUTE) - -project(ten_vad_demo) - -add_executable(ten_vad_demo ${ROOT}/examples/main.c) -target_include_directories(ten_vad_demo PRIVATE "${ROOT}/include") - -if(WIN32) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - target_link_libraries(ten_vad_demo "${ROOT}/lib/Windows/x64/ten_vad.lib") - else() - target_link_libraries(ten_vad_demo "${ROOT}/lib/Windows/x86/ten_vad.lib") - endif() -elseif(ANDROID) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") - target_link_libraries(ten_vad_demo "${ROOT}/lib/Android/arm64-v8a/libten_vad.so") - else() - target_link_libraries(ten_vad_demo "${ROOT}/lib/Android/armeabi-v7a/libten_vad.so") - endif() -elseif(IOS) - target_link_libraries(ten_vad_demo "${ROOT}/lib/iOS/ten_vad.framework") - set_target_properties(ten_vad_demo PROPERTIES - XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${ROOT}/lib/iOS" - XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" - XCODE_ATTRIBUTE_CODE_SIGN_STYLE "Manual" - XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.yourcompany.ten_vad_demo" - XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "iphoneos" - XCODE_ATTRIBUTE_ARCHS "arm64" - ) -elseif(APPLE) - target_link_libraries(ten_vad_demo "${ROOT}/lib/macOS/ten_vad.framework") - set_target_properties(ten_vad_demo PROPERTIES - INSTALL_RPATH "@loader_path" - BUILD_WITH_INSTALL_RPATH TRUE - ) -elseif(UNIX) - target_link_libraries(ten_vad_demo "${ROOT}/lib/Linux/x64/libten_vad.so") -endif() diff --git a/ten-vad-1.0-ONNX/examples/build-and-deploy-android.sh b/ten-vad-1.0-ONNX/examples/build-and-deploy-android.sh deleted file mode 100644 index d367f8d28..000000000 --- a/ten-vad-1.0-ONNX/examples/build-and-deploy-android.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# Copyright © 2025 Agora -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0, with certain conditions. -# Refer to the "LICENSE" file in the root directory for more information. -# -set -eo pipefail - -# Customize the arch and toolchain -arch=arm64-v8a -toolchain=aarch64-linux-android-clang - -# arch=armeabi-v7a -# toolchain=arm-linux-android-clang - -build_dir=build-android/$arch -rm -rf $build_dir -mkdir -p $build_dir -cd $build_dir - -# Step 1: Build the demo -cmake ../../ \ - -DANDROID_TOOLCHAIN_NAME=$toolchain \ - -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ - -G "Unix Makefiles" - -cmake --build . --config Release - - -# Step 2: Run the demo -adb push ../../s0724-s0730.wav /data/local/tmp/ -adb push ../../../lib/Android/${arch}/libten_vad.so /data/local/tmp/libten_vad.so && - adb push ten_vad_demo /data/local/tmp/ && - adb shell "cd /data/local/tmp && chmod +x ten_vad_demo && \ -LD_LIBRARY_PATH=/data/local/tmp ./ten_vad_demo ./s0724-s0730.wav ./out.txt && \ -exit 0" - -adb pull /data/local/tmp/out.txt ./ -cd ../../ diff --git a/ten-vad-1.0-ONNX/examples/build-and-deploy-ios.sh b/ten-vad-1.0-ONNX/examples/build-and-deploy-ios.sh deleted file mode 100644 index ee9503681..000000000 --- a/ten-vad-1.0-ONNX/examples/build-and-deploy-ios.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright © 2025 Agora -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0, with certain conditions. -# Refer to the "LICENSE" file in the root directory for more information. -# -set -euo pipefail - -work_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -build_dir="${work_dir}/build-ios" - -mkdir -p "${build_dir}" -cd "${build_dir}" - -# Step 1: Generate Xcode project for iOS device -echo "[Info] Generating Xcode project" -cmake "${work_dir}" \ - -DCMAKE_SYSTEM_NAME=iOS \ - -DCMAKE_OSX_SYSROOT="iphoneos" \ - -DCMAKE_OSX_ARCHITECTURES="arm64" \ - -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="Apple Development" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=12.1 \ - -DCMAKE_INSTALL_RPATH="@executable_path/Frameworks" \ - -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ - -G Xcode - - -# Step 2: Use Xcode to open the project in build-ios directory -# Step 3: Build and run the project in Xcode IDE \ No newline at end of file diff --git a/ten-vad-1.0-ONNX/examples/build-and-deploy-linux.sh b/ten-vad-1.0-ONNX/examples/build-and-deploy-linux.sh deleted file mode 100644 index 3a66db45e..000000000 --- a/ten-vad-1.0-ONNX/examples/build-and-deploy-linux.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# Copyright © 2025 Agora -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0, with certain conditions. -# Refer to the "LICENSE" file in the root directory for more information. -# -set -euo pipefail - -arch=x64 -build_dir=build-linux/$arch -rm -rf $build_dir -mkdir -p $build_dir -cd $build_dir - -# Step 1: Build the demo -cmake ../../ -cmake --build . --config Release - - -# Step 2: Run the demo -export LD_LIBRARY_PATH=../../../lib/Linux/$arch -./ten_vad_demo ../../s0724-s0730.wav out.txt - -cd ../../ diff --git a/ten-vad-1.0-ONNX/examples/build-and-deploy-mac.sh b/ten-vad-1.0-ONNX/examples/build-and-deploy-mac.sh deleted file mode 100644 index 2888712eb..000000000 --- a/ten-vad-1.0-ONNX/examples/build-and-deploy-mac.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# Copyright © 2025 Agora -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0, with certain conditions. -# Refer to the "LICENSE" file in the root directory for more information. -# -set -euo pipefail - -# Customize the arch -arch=arm64 -# arch=x86_64 - -build_dir=build-mac/$arch -rm -rf $build_dir -mkdir -p $build_dir -cd $build_dir - -# Step 1: Build the demo -cmake ../../ \ - -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \ - -DCMAKE_C_COMPILER=/usr/bin/clang \ - -DCMAKE_OSX_ARCHITECTURES=${arch} \ - -G Xcode - -cmake --build . --config Release -- -UseModernBuildSystem=NO - - -# Step 2: Run the demo -export DYLD_FRAMEWORK_PATH="../../../lib/macOS/" -Release/ten_vad_demo ../../s0724-s0730.wav out.txt -cd ../../ \ No newline at end of file diff --git a/ten-vad-1.0-ONNX/examples/build-and-deploy-windows.bat b/ten-vad-1.0-ONNX/examples/build-and-deploy-windows.bat deleted file mode 100644 index d954ea022..000000000 --- a/ten-vad-1.0-ONNX/examples/build-and-deploy-windows.bat +++ /dev/null @@ -1,74 +0,0 @@ -@echo off -setlocal - -@REM -@REM Copyright © 2025 Agora -@REM This file is part of TEN Framework, an open source project. -@REM Licensed under the Apache License, Version 2.0, with certain conditions. -@REM Refer to the "LICENSE" file in the root directory for more information. -@REM - -@REM Customize the arch -set arch=x64 -@REM set arch=x86 - -@REM step 1: Build the demo -set "build_dir=%~dp0\build-windows" -if exist "%build_dir%" rmdir /s /q "%build_dir%" -mkdir "%build_dir%" -cd /d "%build_dir%" - -@REM Customize the Visual Studio version -@REM REM VS 2017 -@REM if %arch% == x64 ( -@REM cmake .. -G "Visual Studio 15 2017" -A x64 -@REM ) else if %arch% == x86 ( -@REM cmake .. -G "Visual Studio 15 2017" -A Win32 -@REM ) - -REM VS 2019 -if %arch% == x64 ( - cmake .. -G "Visual Studio 16 2019" -A x64 -) else if %arch% == x86 ( - cmake .. -G "Visual Studio 16 2019" -A Win32 -) - -@REM REM VS 2022 -@REM if %arch% == x64 ( -@REM cmake .. -G "Visual Studio 17 2022" -A x64 -@REM ) else if %arch% == x86 ( -@REM cmake .. -G "Visual Studio 17 2022" -A Win32 -@REM ) - -cmake --build . --config Release -cd .. - - -@REM step 2: Run the demo -pushd "%~dp0" -copy /Y "s0724-s0730.wav" "%build_dir%\Release" -copy /Y "..\lib\Windows\%arch%\ten_vad.dll" "%build_dir%\Release" -if errorlevel 1 ( - echo [Error] copy file failed - popd - exit /b 1 -) -cd /d "%build_dir%\Release" -if not exist "ten_vad_demo.exe" ( - echo Error: ten_vad_demo.exe not found - exit /b 1 -) -if not exist "s0724-s0730.wav" ( - echo Error: s0724-s0730.wav not found - exit /b 1 -) - -ten_vad_demo.exe "s0724-s0730.wav" out.txt -if errorlevel 1 ( - echo Error: ten_vad_demo.exe failed - exit /b 1 -) - -cd /d "%~dp0" -popd -exit /b 0 diff --git a/ten-vad-1.0-ONNX/examples/images/Agent-Friendly-image.png b/ten-vad-1.0-ONNX/examples/images/Agent-Friendly-image.png deleted file mode 100644 index 671cc81f8f4ef716402d1dae39523e3306b6f4ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 196642 zcmd42gya>J|MSQ92VdYNu z%*Dyc%Gnd5ZQ*WZb}L6qg5>iA^-Ui57-)=d$ zyptt+FN2Jlz{(gJzwjlT|2J$&da68$Axt1%Tqp7Lc0og{!5Lnx?LA#CwpUg+&1@a6 zrNUN_jCf$qNc&Cw;=gyqpXr1-hD`s%l^MZ zC2N^HedhV!>k@X`h>Cxw01sYhIAbaQci`fR|L;j2{r~PHL?6=9$YoNkj`qVOoqa{s zCL(=DhkF7~`A?TnFzMHQmwaQuoz#iuJrEc9H*f*J2{nCR{h$$3)85Lgds8k+e%Lcq z%@J#H2$OJdC_i5!dnUK>9{(+Gx)9>;1wJB%MU9RjF`_nle4yp3@%1L7GNTk8{qvc% z+(52&LsdD4EV_7hBuj%rQ4}zq|2M=$Y+*0DbGymd_OnBD>LtRGlcDbqh>{v(bCuK| zD$OnUn<;E+ZP3Vm)p;T(knrdNoJ+@hT-F;L!G1O1(0|!~x40;p*CqIRUPEk$(ORgR z=h#Pa$1a^&St}@G%a>TbT(4BCIC^jGjovr^L+fA&9|eF*G#qIJ2c!KWTDfkpW^dKwHmLi zV13xcQ-K%tMm|uJ*o_Lsby#%kNWw*cVrs4^+pom1yxy?9yngOsJ1X%FBI5twgt*kcqV#0$bY^Z9Ng!X7E|4`OK`BqDMFuM83# zIo_Ely5DQN+uJG1xdZ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