语音对话AI

PersonaPlex是一款实时全双工语音对话AI,支持通过文本角色提示和音频语音条件控制角色,提供自然、低延迟的语音交互体验。

  • by neosun100
  • Python
  • 本地部署
  • 11 星标
  • 更新于
在 GitHub 查看 neosun100/personaplex

使用说明

英语 | 简体中文 | 繁体中文 | 日本语

🎙️ PersonaPlex

具有语音和角色控制的实时全双工对话AI

PersonaPlex是一种语音对语音对话模型,通过基于文本的角色提示和基于音频的语音调节来实现角色控制。它与一致的人物角色产生自然、低延迟的口语互动。


✨ 特性

特性 描述
🎯 全双工 实时双向对话
🎭 人物控制 文本提示定义AI个性
🗣️ 语音选择 18种预训练语音选项
🌐 多语言用户界面 English,中文,繁体,日本语
🐳 多功能Docker 单容器部署
📡 REST API OpenAPI/Swagger记录在案
🔌 MCP支持 模型上下文协议集成
🖥️ GPU管理 自动选择和内存卸载

🚀 快速开始

Docker(推荐)

# Pull and run
docker run -d --gpus all \
  -p 8998:8998 \
  -e HF_TOKEN=your_token \
  --name personaplex \
  neosun/personaplex:latest

# Access Web UI
open http://localhost:8998

Docker Compose

version: '3.8'
services:
  personaplex:
    image: neosun/personaplex:latest
    container_name: personaplex
    ports:
      - "8998:8998"
    environment:
      - HF_TOKEN=${HF_TOKEN}
    volumes:
      - ~/.cache/huggingface:/root/.cache/huggingface
      - /tmp/personaplex:/tmp/personaplex
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    restart: unless-stopped
# Set token and start
export HF_TOKEN=your_huggingface_token
docker-compose up -d

一键开始

# Clone repository
git clone https://github.com/neosun100/personaplex.git
cd personaplex

# Set HF token
export HF_TOKEN=your_huggingface_token

# Start (auto-selects GPU with lowest memory usage)
./start.sh

⚙️ 配置

变量 默认值 描述
HF_TOKEN - 必需:拥抱脸令牌
PORT 8998 Web UI端口
DEVICE cuda 设备:cuda,cpu
CPU_OFFLOAD false 如果GPU OOM,则卸载到CPU
GPU_IDLE_TIMEOUT 300 怠速后自动卸载(秒)
NVIDIA_VISIBLE_DEVICES 0 要使用的GPU ID

GPU选择

# Use specific GPU
export NVIDIA_VISIBLE_DEVICES=2
docker-compose up -d

# Or in docker-compose.yml
deploy:
  resources:
    reservations:
      devices:
        - driver: nvidia
          device_ids: ['2']
          capabilities: [gpu]

🗣️ 语音选项

类别 IDs 描述
自然女性 NATF0-3 自然、健谈
自然男 NATM0-3 自然,健谈
品种女 VARF0-4 款式多样
品种男 VARM0-4 款式多样

📝 提示示例

助理(默认)

You are a wise and friendly teacher. Answer questions or provide advice in a clear and engaging way.

客户服务

You work for First Neuron Bank which is a bank and your name is Alexis Kim. Information: The customer's transaction for $1,200 at Home Depot was declined. Verify customer identity.

闲聊

You enjoy having a good conversation.

📡 API 参考

端点

端点 方法 描述
/ GET Web用户界面
/health GET 健康检查
/docs 获取 Swagger API文档
/api/gpu/status GET GPU状态
/api/gpu/offload POST 释放GPU内存
/api/voices GET 列出声音
/api/offline POST 离线推理
/api/chat WebSocket 实时对话

离线推理

curl -X POST http://localhost:8998/api/offline \
  -F "file=@input.wav" \
  -F "voice_prompt=NATF2.pt" \
  -F "text_prompt=You are a helpful assistant." \
  -o output.wav

🔌 MCP集成

看 MCP_GUIDE.md 用于模型上下文协议集成。

{
  "mcpServers": {
    "personaplex": {
      "command": "docker",
      "args": ["exec", "-i", "personaplex", "python", "-m", "app.mcp_server"]
    }
  }
}

🏗️ 项目结构

personaplex/
├── app/
│   ├── server.py          # FastAPI server
│   ├── mcp_server.py      # MCP server
│   └── templates/         # Web UI
├── moshi/                  # Core model package
├── client/                 # Original React client
├── assets/                 # Test files
├── Dockerfile             # All-in-One image
├── docker-compose.yml     # Compose config
├── start.sh               # One-click start
└── MCP_GUIDE.md           # MCP documentation

🛠️ 技术栈

  • 模型: PersonaPlex 基于Moshi
  • 后端:FastAPI+Uvicorn
  • 前端:金佳2+香草JS
  • 容器:NVIDIA CUDA 12.4+cuDNN
  • 协议:WebSocket+REST+MCP

📋 更新日志

v1.3.0(2026-02-17)

  • 🗑️ 修复GPU卸载问题:通过以下方式真正释放VRAM gc.collect() + torch.cuda.ipc_collect() (18GB)→ 0.6GB)
  • ⏱️ 空闲超时后自动卸载GPU(GPU_IDLE_TIMEOUT,默认300秒)
  • 📊 GPU状态现在显示活动连接和空闲计时器
  • 🔄 卸载后,模型在下次连接时自动重新加载

v1.2.0版本(2026-02-16)

  • 🔧 修复CUDA OOM:添加 torch.no_grad() 到推理循环(允许无限制的对话)
  • 🔒 修复GPU锁:超时为“服务器繁忙”而不是无限挂起
  • 🎤 基于浏览器的全语音聊天(通过WebSocket进行Opus编码/解码)
  • 💬 基于时间的消息气泡流式AI文本显示
  • 🏓 模型加载期间WebSocket保持活动(修复Cloudflare 502)
  • 🐛 修复 tensor.detach().numpy() 运行时错误

v1.0.0(2026-02-16)

  • 🐳 多功能Docker部署
  • 🌐 Multi-language Web UI(EN/中文/繁体/日本语)
  • 📡 带有Swagger文档的REST API
  • 🔌 MCP服务器集成
  • 🖥️ 自动GPU选择
  • 🗑️ GPU内存卸载

🤝 贡献

欢迎投稿!请随时提交拉取请求。

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing)
  3. 提交您的更改(git commit -m 'Add amazing feature')
  4. 推到分支(git push origin feature/amazing)
  5. 打开拉取请求

📄 许可证

🙏 致谢


⭐ 星迹

📱 关注我们