Skip to content

An intelligent voice chat assistant with fully localized offline deployment, featuring voice recognition, streaming output of large language models, real-time text-to-speech, wake-on-sleep functionality, and synchronized display of voice playback and text.

License

Notifications You must be signed in to change notification settings

cnbison/louchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗣️ LouChat —— 本地离线语音智能体

一个中文离线语音聊天助手,基于 Ollama (Qwen3)Vosk (ASR)Coqui TTS (语音合成)Porcupine (语音唤醒)MCP 插件系统Gradio Web UI 构建。
系统采用 主进程 + 多工作线程 架构,模块间通过 queue 队列通信。
支持语音唤醒、实时语音识别、流式大模型应答、自然语音朗读、图形界面交互与插件扩展。


🚀 功能特点

  • 🧠 本地大语言模型(LLM):基于 Ollama + Qwen3:8B,可离线运行,响应自然。
  • 🎙️ 语音识别(ASR):使用 Vosk 流式识别中文及方言。
  • 🔊 语音合成(TTS):基于 Coqui TTS,实现自然人声朗读。
  • 💤 语音唤醒(WakeWord):通过 Porcupine 模块检测唤醒词。
  • 🌐 可视化交互界面:集成 Gradio Web UI,支持文字与语音同步展示。
  • 🧩 MCP 插件扩展:支持天气、提醒、闲聊命令等外部工具调用。

🗂️ 项目结构

louchat/
├── core/
│   ├── main.py       # 核心逻辑(LouChatCore类、启动Gradio服务器、唤醒模块)
├── asr/              # 语音识别模块、Porcupine模块加载
├── tts/              # 语音合成模块
├── llm/              # 大语言模型模块
├── mcp/              # MCP 服务器模块
├── logs/             # 日志模块
├── configs/
│   ├── config.py         # 配置文件(模型路径、参数等)
├── models/
│   ├── tts_models--zh-CN--baker--tacotron2-DDC-GST/
│   │   ├── model.pth     # TTS 模型文件(需缓存后拷贝)
│   ├── vosk-model-small-cn-0.22  # ASR 模型
├── requirements.txt       # Python 依赖列表
├── README.md              # 项目说明
└── .gitignore             # Git 忽略文件

⚙️ 安装与配置

1️⃣ 环境要求

  • macOS / Linux(推荐使用 Mac mini M4
  • Python ≥ 3.11
  • 已安装 Ollama 并加载 Qwen3 模型

2️⃣ 克隆项目

git clone https://github.com/cnbison/louchat.git
cd louchat

3️⃣ 创建虚拟环境并安装依赖

使用 Conda

conda create -n louchat python=3.11
conda activate louchat
pip install -r requirements.txt

或使用 venv

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

4️⃣ 下载 TTS 模型

由于模型文件过大(约 400MB),未上传至 GitHub。
可通过以下方式自动下载并缓存模型文件:

from TTS.api import TTS
TTS(model_name="tts_models/zh-CN/baker/tacotron2-DDC-GST")

下载完成后,将模型目录复制到:

models/tts_models--zh-CN--baker--tacotron2-DDC-GST/

▶️ 启动项目

python start.py

系统将自动启动:


💬 界面功能

Gradio 界面提供:

  • 🎧 语音输入(实时识别,唤醒词:“小贝”)
  • 💬 对话展示(语音 + 文字同步显示)
  • 🔊 模型语音朗读
  • ⚙️ 参数调节(温度、系统提示词 — 已实现20251014)
  • 📊 MCP 插件调用结果展示(功能框架已实现,待扩展)

About

An intelligent voice chat assistant with fully localized offline deployment, featuring voice recognition, streaming output of large language models, real-time text-to-speech, wake-on-sleep functionality, and synchronized display of voice playback and text.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages