+Dieses Projekt basiert auf der Theorie und Technologie der Mensch-Maschine-symbiotischen Intelligenz zur Entwicklung intelligenter Terminal-Hardware- und Software-Systeme und bietet Backend-Dienste für das Open-Source-Hardware-Projekt
+xiaozhi-esp32
+Implementiert mit Python, Java und Vue gemäß dem Xiaozhi-Kommunikationsprotokoll
+Unterstützt MQTT+UDP-Protokoll, Websocket-Protokoll, MCP-Endpunkte und Stimmabdruckerkennung
+
+Geleitet vom Team von Professor Siyuan Liu (South China University of Technology)
+
+刘思源教授团队主导研发(华南理工大学)
+
+
+
+
+---
+
+## Zielgruppe 👥
+
+Dieses Projekt erfordert ESP32-Hardware-Geräte zum Betrieb. Wenn Sie ESP32-bezogene Hardware erworben haben, erfolgreich eine Verbindung zu Brother Xias bereitgestelltem Backend-Service hergestellt haben und Ihren eigenen `xiaozhi-esp32`-Backend-Service unabhängig aufbauen möchten, dann ist dieses Projekt perfekt für Sie.
+
+Möchten Sie die Nutzungseffekte sehen? Klicken Sie auf die Videos unten 🎥
+
+
+
+---
+
+## Warnungen ⚠️
+
+1. Dieses Projekt ist Open-Source-Software. Diese Software hat keine kommerzielle Partnerschaft mit Drittanbieter-API-Dienstleistern (einschließlich, aber nicht beschränkt auf Spracherkennung, große Modelle, Sprachsynthese und andere Plattformen), mit denen sie sich verbindet, und bietet keine Garantie für deren Servicequalität oder finanzielle Sicherheit. Es wird empfohlen, dass Benutzer Dienstleister mit entsprechenden Geschäftslizenzen bevorzugen und deren Servicevereinbarungen und Datenschutzrichtlinien sorgfältig lesen. Diese Software hostet keine Kontoschlüssel, nimmt nicht an Geldströmen teil und trägt nicht das Risiko von Verlusten bei Guthaben-Aufladungen.
+
+2. Die Funktionalität dieses Projekts ist nicht vollständig und hat keine Netzwerksicherheitsbewertung bestanden. Bitte verwenden Sie es nicht in Produktionsumgebungen. Wenn Sie dieses Projekt zu Lernzwecken in einer öffentlichen Netzwerkumgebung bereitstellen, stellen Sie bitte sicher, dass notwendige Schutzmaßnahmen vorhanden sind.
+
+---
+
+## Deployment-Dokumentation
+
+
+
+Dieses Projekt bietet zwei Bereitstellungsmethoden. Bitte wählen Sie basierend auf Ihren spezifischen Anforderungen:
+
+#### 🚀 Auswahl der Bereitstellungsmethode
+| Bereitstellungsmethode | Funktionen | Anwendungsszenarien | Deployment-Dokumente | Konfigurationsanforderungen | Video-Tutorials |
+|---------|------|---------|---------|---------|---------|
+| **Vereinfachte Installation** | Intelligenter Dialog, IOT, MCP, visuelle Wahrnehmung | Umgebungen mit geringer Konfiguration, Daten in Konfigurationsdateien gespeichert, keine Datenbank erforderlich | [①Docker-Version](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Quellcode-Deployment](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 Kerne 4GB bei Verwendung von `FunASR`, 2 Kerne 2GB bei allen APIs | - |
+| **Vollständige Modulinstallation** | Intelligenter Dialog, IOT, MCP-Endpunkte, Stimmabdruckerkennung, visuelle Wahrnehmung, OTA, intelligente Steuerkonsole | Vollständige Funktionserfahrung, Daten in Datenbank gespeichert |[①Docker-Version](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Quellcode-Deployment](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Quellcode-Deployment Auto-Update-Tutorial](./docs/dev-ops-integration.md) | 4 Kerne 8GB bei Verwendung von `FunASR`, 2 Kerne 4GB bei allen APIs| [Video-Tutorial für lokalen Quellcode-Start](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
+
+Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](./docs/FAQ.md)
+
+> 💡 Hinweis: Unten ist eine Testplattform, die mit dem neuesten Code bereitgestellt wurde. Sie können bei Bedarf brennen und testen. Gleichzeitige Benutzer: 6, Daten werden täglich gelöscht.
+
+```
+Adresse der intelligenten Steuerkonsole: https://2662r3426b.vicp.fun
+Adresse der intelligenten Steuerkonsole (H5): https://2662r3426b.vicp.fun/h5/index.html
+
+Service-Testtool: https://2662r3426b.vicp.fun/test/
+OTA-Schnittstellenadresse: https://2662r3426b.vicp.fun/xiaozhi/ota/
+Websocket-Schnittstellenadresse: wss://2662r3426b.vicp.fun/xiaozhi/v1/
+```
+
+#### 🚩 Konfigurationsbeschreibung und Empfehlungen
+> [!Note]
+> Dieses Projekt bietet zwei Konfigurationsschemata:
+>
+> 1. `Einstiegslevel Kostenlose Einstellungen`: Geeignet für den persönlichen und privaten Gebrauch, alle Komponenten verwenden kostenlose Lösungen, keine zusätzliche Zahlung erforderlich.
+>
+> 2. `Streaming-Konfiguration`: Geeignet für Demonstrationen, Schulungen, Szenarien mit mehr als 2 gleichzeitigen Benutzern usw. Verwendet Streaming-Verarbeitungstechnologie für schnellere Reaktionsgeschwindigkeit und bessere Erfahrung.
+>
+> Ab Version `0.5.2` unterstützt das Projekt Streaming-Konfiguration. Im Vergleich zu früheren Versionen ist die Reaktionsgeschwindigkeit um ca. `2,5 Sekunden` verbessert, was die Benutzererfahrung erheblich verbessert.
+
+| Modulname | Einstiegslevel Kostenlose Einstellungen | Streaming-Konfiguration |
+|:---:|:---:|:---:|
+| ASR (Spracherkennung) | FunASR (Lokal) | 👍FunASR (Lokaler GPU-Modus) |
+| LLM (Großes Modell) | ChatGLMLLM (Zhipu glm-4-flash) | 👍AliLLM (qwen3-235b-a22b-instruct-2507) oder 👍DoubaoLLM (doubao-1-5-pro-32k-250115) |
+| VLLM (Vision Large Model) | ChatGLMVLLM (Zhipu glm-4v-flash) | 👍QwenVLVLLM (Qwen qwen2.5-vl-3b-instructh) |
+| TTS (Sprachsynthese) | ✅LinkeraiTTS (Lingxi-Streaming) | 👍HuoshanDoubleStreamTTS (Volcano Dual-Stream-Sprachsynthese) oder 👍AliyunStreamTTS (Alibaba Cloud Streaming-Sprachsynthese) |
+| Intent (Absichtserkennung) | function_call (Funktionsaufruf) | function_call (Funktionsaufruf) |
+| Memory (Gedächtnisfunktion) | mem_local_short (Lokales Kurzzeitgedächtnis) | mem_local_short (Lokales Kurzzeitgedächtnis) |
+
+Wenn Sie sich um die Latenz jeder Komponente kümmern, lesen Sie bitte den [Xiaozhi-Komponenten-Leistungstestbericht](https://github.com/xinnan-tech/xiaozhi-performance-research). Sie können gemäß den Testmethoden im Bericht in Ihrer Umgebung tatsächlich testen.
+
+#### 🔧 Testwerkzeuge
+Dieses Projekt bietet die folgenden Testwerkzeuge, um Ihnen bei der Überprüfung des Systems und der Auswahl geeigneter Modelle zu helfen:
+
+| Werkzeugname | Standort | Verwendungsmethode | Funktionsbeschreibung |
+|:---:|:---|:---:|:---:|
+| Audio-Interaktionstesttool | main》xiaozhi-server》test》test_page.html | Direkt mit Google Chrome öffnen | Testet Audio-Wiedergabe- und Empfangsfunktionen, überprüft, ob die Python-seitige Audioverarbeitung normal ist |
+| Modell-Reaktionstesttool | main》xiaozhi-server》performance_tester.py | Ausführen `python performance_tester.py` | Testet die Reaktionsgeschwindigkeit von ASR (Spracherkennung), LLM (großes Modell), VLLM (Vision-Modell), TTS (Sprachsynthese) drei Kernmodulen |
+
+> 💡 Hinweis: Beim Testen der Modellgeschwindigkeit werden nur Modelle mit konfigurierten Schlüsseln getestet.
+
+---
+## Funktionsliste ✨
+### Implementiert ✅
+
+| Funktionsmodul | Beschreibung |
+|:---:|:---|
+| Kernarchitektur | Basierend auf [MQTT+UDP-Gateway](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket und HTTP-Servern, bietet vollständiges Konsolenverwaltungs- und Authentifizierungssystem |
+| Sprachinteraktion | Unterstützt Streaming-ASR (Spracherkennung), Streaming-TTS (Sprachsynthese), VAD (Sprachaktivitätserkennung), unterstützt mehrsprachige Erkennung und Sprachverarbeitung |
+| Stimmabdruckerkennung | Unterstützt Mehrbenutzer-Stimmabdruckregistrierung, -verwaltung und -erkennung, verarbeitet parallel mit ASR, Echtzeit-Sprecheridentitätserkennung und Weitergabe an LLM für personalisierte Antworten |
+| Intelligenter Dialog | Unterstützt mehrere LLM (große Sprachmodelle), implementiert intelligenten Dialog |
+| Visuelle Wahrnehmung | Unterstützt mehrere VLLM (Vision Large Models), implementiert multimodale Interaktion |
+| Absichtserkennung | Unterstützt LLM-Absichtserkennung, Function Call-Funktionsaufruf, bietet plugin-basierten Absichtsverarbeitungsmechanismus |
+| Gedächtnissystem | Unterstützt lokales Kurzzeitgedächtnis, mem0ai-Schnittstellengedächtnis, mit Gedächtniszusammenfassungsfunktion |
+| Wissensdatenbank | Unterstützt RAGFlow-Wissensdatenbank, ermöglicht großem Modell die Bewertung, ob Wissensdatenbank benötigt wird, bevor geantwortet wird |
+| Werkzeugaufruf | Unterstützt Client-IOT-Protokoll, Client-MCP-Protokoll, Server-MCP-Protokoll, MCP-Endpunktprotokoll, benutzerdefinierte Werkzeugfunktionen |
+| Befehlsübermittlung | Basierend auf MQTT-Protokoll, unterstützt die Übermittlung von MCP-Befehlen von der intelligenten Steuerkonsole an ESP32-Geräte |
+| Verwaltungs-Backend | Bietet Web-Verwaltungsoberfläche, unterstützt Benutzerverwaltung, Systemkonfiguration und Geräteverwaltung; Oberfläche unterstützt vereinfachtes Chinesisch, traditionelles Chinesisch und englische Anzeige |
+| Testwerkzeuge | Bietet Leistungstestwerkzeuge, Vision-Modell-Testwerkzeuge und Audio-Interaktionstestwerkzeuge |
+| Deployment-Unterstützung | Unterstützt Docker-Deployment und lokales Deployment, bietet vollständige Konfigurationsdateiverwaltung |
+| Plugin-System | Unterstützt funktionale Plugin-Erweiterungen, benutzerdefinierte Plugin-Entwicklung und Plugin-Hot-Loading |
+
+### In Entwicklung 🚧
+
+Um über spezifische Entwicklungsplanfortschritte zu erfahren, [klicken Sie hier](https://github.com/users/xinnan-tech/projects/3). Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](./docs/FAQ.md)
+
+Wenn Sie ein Softwareentwickler sind, finden Sie hier einen [Offenen Brief an Entwickler](docs/contributor_open_letter.md). Willkommen beim Beitritt!
+
+---
+
+## Produktökosystem 👬
+Xiaozhi ist ein Ökosystem. Wenn Sie dieses Produkt verwenden, können Sie sich auch andere [hervorragende Projekte](https://github.com/78/xiaozhi-esp32?tab=readme-ov-file#%E7%9B%B8%E5%85%B3%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE) in diesem Ökosystem ansehen
+
+---
+
+## Liste der von diesem Projekt unterstützten Plattformen/Komponenten 📋
+### LLM-Sprachmodelle
+
+| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
+|:---:|:---:|:---:|
+| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Volcano Engine Doubao, DeepSeek, Zhipu ChatGLM, Gemini | Zhipu ChatGLM, Gemini |
+| Ollama-Schnittstellenaufrufe | Ollama | - |
+| Dify-Schnittstellenaufrufe | Dify | - |
+| FastGPT-Schnittstellenaufrufe | FastGPT | - |
+| Coze-Schnittstellenaufrufe | Coze | - |
+| Xinference-Schnittstellenaufrufe | Xinference | - |
+| HomeAssistant-Schnittstellenaufrufe | HomeAssistant | - |
+
+Tatsächlich kann jedes LLM, das OpenAI-Schnittstellenaufrufe unterstützt, integriert und verwendet werden.
+
+---
+
+### VLLM-Vision-Modelle
+
+| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
+|:---:|:---:|:---:|
+| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
+
+Tatsächlich kann jedes VLLM, das OpenAI-Schnittstellenaufrufe unterstützt, integriert und verwendet werden.
+
+---
+
+### TTS-Sprachsynthese
+
+| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
+|:---:|:---:|:---:|
+| Schnittstellenaufrufe | EdgeTTS, Volcano Engine Doubao TTS, Tencent Cloud, Alibaba Cloud TTS, AliYun Stream TTS, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS, Volcano Dual-Stream TTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow (teilweise) |
+| Lokale Dienste | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
+
+---
+
+### VAD-Sprachaktivitätserkennung
+
+| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
+|:---:|:---------:|:----:|:----:|:--:|
+| VAD | SileroVAD | Lokale Verwendung | Kostenlos | |
+
+---
+
+### ASR-Spracherkennung
+
+| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
+|:---:|:---:|:---:|
+| Lokale Verwendung | FunASR, SherpaASR | FunASR, SherpaASR |
+| Schnittstellenaufrufe | DoubaoASR, Doubao Streaming ASR, FunASRServer, TencentASR, AliyunASR, Aliyun Streaming ASR, Baidu ASR, OpenAI ASR | FunASRServer |
+
+---
+
+### Voiceprint-Stimmabdruckerkennung
+
+| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
+|:---:|:---:|:---:|
+| Lokale Verwendung | 3D-Speaker | 3D-Speaker |
+
+---
+
+### Memory-Gedächtnisspeicher
+
+| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
+|:------:|:---------------:|:----:|:---------:|:--:|
+| Memory | mem0ai | Schnittstellenaufrufe | 1000 Mal/Monat Kontingent | |
+| Memory | mem_local_short | Lokale Zusammenfassung | Kostenlos | |
+| Memory | nomem | Kein Gedächtnismodus | Kostenlos | |
+
+---
+
+### Intent-Absichtserkennung
+
+| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
+|:------:|:-------------:|:----:|:-------:|:---------------------:|
+| Intent | intent_llm | Schnittstellenaufrufe | Basierend auf LLM-Preisen | Erkennt Absicht durch große Modelle, starke Allgemeingültigkeit |
+| Intent | function_call | Schnittstellenaufrufe | Basierend auf LLM-Preisen | Vervollständigt Absicht durch Funktionsaufruf großer Modelle, schnelle Geschwindigkeit, guter Effekt |
+| Intent | nointent | Kein Absichtsmodus | Kostenlos | Führt keine Absichtserkennung durch, gibt direkt Dialogergebnis zurück |
+
+---
+
+### Rag Retrieval Augmented Generation
+
+| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
+|:------:|:-------------:|:----:|:-------:|:---------------------:|
+| Rag | ragflow | Schnittstellenaufrufe | Gebühren basierend auf Token-Verbrauch für Segmentierung und Tokenisierung | Nutzt RAGFlow's Retrieval-Augmented-Generation-Funktion für präzisere Dialogantworten |
+
+---
+
+## Danksagungen 🙏
+
+| Logo | Projekt/Unternehmen | Beschreibung |
+|:---:|:---:|:---|
+| | [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) | Dieses Projekt wurde von [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) inspiriert und auf dessen Basis implementiert |
+| | [Tenclass](https://www.tenclass.com/) | Dank an [Tenclass](https://www.tenclass.com/) für die Formulierung von Standardkommunikationsprotokollen, Multi-Geräte-Kompatibilitätslösungen und High-Concurrency-Szenario-Praxisdemonstrationen für das Xiaozhi-Ökosystem; für die Bereitstellung vollständiger technischer Dokumentationsunterstützung für dieses Projekt |
+| | [Xuanfeng Technology](https://github.com/Eric0308) | Dank an [Xuanfeng Technology](https://github.com/Eric0308) für den Beitrag des Funktionsaufruf-Frameworks, des MCP-Kommunikationsprotokolls und der plugin-basierten Aufrufmechanismus-Implementierungscode. Durch standardisiertes Befehlsplanungssystem und dynamische Erweiterungsfähigkeiten wird die Interaktionseffizienz und funktionale Erweiterbarkeit von Frontend-Geräten (IoT) erheblich verbessert |
+| | [huangjunsen](https://github.com/huangjunsen0406) | Dank an [huangjunsen](https://github.com/huangjunsen0406) für den Beitrag des `Smart Control Console Mobile`-Moduls, das eine effiziente Steuerung und Echtzeit-Interaktion über mobile Geräte ermöglicht und die Betriebsbequemlichkeit und Verwaltungseffizienz des Systems in mobilen Szenarien erheblich verbessert |
+| | [Huiyuan Design](http://ui.kwd988.net/) | Dank an [Huiyuan Design](http://ui.kwd988.net/) für die Bereitstellung professioneller visueller Lösungen für dieses Projekt, unter Verwendung ihrer Design-Praxiserfahrung im Dienst von über tausend Unternehmen, um die Produktbenutzererfahrung dieses Projekts zu stärken |
+| | [Xi'an Qinren Information Technology](https://www.029app.com/) | Dank an [Xi'an Qinren Information Technology](https://www.029app.com/) für die Vertiefung des visuellen Systems dieses Projekts und die Sicherstellung der Konsistenz und Erweiterbarkeit des Gesamtdesignstils in Multi-Szenario-Anwendungen |
+| | [Code-Mitwirkende](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Dank an [alle Code-Mitwirkenden](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), Ihre Bemühungen haben das Projekt robuster und leistungsfähiger gemacht. |
+
+
+
+
+
+
+
+
+
+
diff --git a/README_en.md b/README_en.md
index a50006f8b..e84378327 100644
--- a/README_en.md
+++ b/README_en.md
@@ -6,29 +6,24 @@
This project is based on human-machine symbiotic intelligence theory and technology to develop intelligent terminal hardware and software systems providing backend services for the open-source intelligent hardware project
xiaozhi-esp32
Implemented using Python, Java, and Vue according to the Xiaozhi Communication Protocol
-Supports MCP endpoints and voiceprint recognition
+Support for MQTT+UDP protocol, Websocket protocol, MCP access point, voiceprint recognition, and knowledge base
@@ -244,6 +239,7 @@ This project provides the following testing tools to help you verify the system
| Visual Perception | Supports multiple VLLM(vision large models), implements multimodal interaction |
| Intent Recognition | Supports LLM intent recognition, Function Call function calling, provides plugin-based intent processing mechanism |
| Memory System | Supports local short-term memory, mem0ai interface memory, with memory summarization functionality |
+| Knowledge Base | Supports RAGFlow knowledge base, enabling LLM to judge whether to schedule the knowledge base after receiving the user's question, and then answer the question |
| Command Delivery | Supports MCP command delivery to ESP32 devices via MQTT protocol from Smart Console |
| Tool Calling | Supports client IOT protocol, client MCP protocol, server MCP protocol, MCP endpoint protocol, custom tool functions |
| Management Backend | Provides Web management interface, supports user management, system configuration and device management; Supports Simplified Chinese, Traditional Chinese and English display |
@@ -275,7 +271,7 @@ Xiaozhi is an ecosystem. When using this product, you can also check out other [
| Usage Method | Supported Platforms | Free Platforms |
|:---:|:---:|:---:|
-| OpenAI interface calls | Alibaba Bailian, Volcano Engine Doubao, DeepSeek, Zhipu ChatGLM, Gemini | Zhipu ChatGLM, Gemini |
+| OpenAI interface calls | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK | Zhipu, Gemini |
| Ollama interface calls | Ollama | - |
| Dify interface calls | Dify | - |
| FastGPT interface calls | FastGPT | - |
@@ -299,7 +295,7 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
| Usage Method | Supported Platforms | Free Platforms |
|:---:|:---:|:---:|
-| Interface calls | EdgeTTS, Volcano Engine Doubao TTS, Tencent Cloud, Alibaba Cloud TTS, AliYun Stream TTS, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow(partial) |
+| Interface calls | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud and Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow(partial) |
| Local services | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, MinimaxTTS | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, MinimaxTTS |
---
@@ -317,7 +313,7 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
| Usage Method | Supported Platforms | Free Platforms |
|:---:|:---:|:---:|
| Local use | FunASR, SherpaASR | FunASR, SherpaASR |
-| Interface calls | DoubaoASR, FunASRServer, TencentASR, AliyunASR | FunASRServer |
+| Interface calls | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud, Baidu Cloud, OpenAI ASR | FunASRServer |
---
@@ -347,6 +343,14 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
---
+### Rag Retrieval-Augmented Generation
+
+| Type | Platform Name | Usage Method | Pricing Model | Notes |
+|:------:|:-------------:|:----:|:-------:|:---------------------:|
+| Rag | ragflow | Interface calls | Charged based on tokens consumed for slicing and word segmentation | Utilizes RagFlow's retrieval-augmented generation feature to provide more accurate dialog responses |
+
+---
+
## Acknowledgments 🙏
| Logo | Project/Company | Description |
diff --git a/README_vi.md b/README_vi.md
new file mode 100644
index 000000000..926975518
--- /dev/null
+++ b/README_vi.md
@@ -0,0 +1,375 @@
+[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
+
+
Dịch vụ Backend Xiaozhi xiaozhi-esp32-server
+
+
+Dự án này dựa trên lý thuyết và công nghệ trí tuệ cộng sinh người-máy để phát triển hệ thống phần mềm và phần cứng thiết bị đầu cuối thông minh Cung cấp dịch vụ backend cho dự án phần cứng thông minh mã nguồn mở
+xiaozhi-esp32
+Được triển khai bằng Python, Java, Vue theo giao thức truyền thông Xiaozhi
+Hỗ trợ giao thức MQTT+UDP, giao thức Websocket, điểm truy cập MCP, nhận dạng giọng nói và kho tri thức
+
+Spearheaded by Professor Siyuan Liu's Team (South China University of Technology)
+
+Được dẫn dắt bởi nhóm Giáo sư Lưu Tư Nguyên (Đại học Bách khoa Nam Trung Quốc)
+
+
+
+
+---
+
+## Người dùng phù hợp 👥
+
+Dự án này cần được sử dụng cùng với thiết bị phần cứng ESP32. Nếu bạn đã mua phần cứng liên quan đến ESP32, đã thành công kết nối với dịch vụ backend do anh Xia triển khai, và muốn xây dựng dịch vụ backend `xiaozhi-esp32` riêng của mình, thì dự án này rất phù hợp với bạn.
+
+Muốn xem hiệu quả sử dụng? Hãy xem video 🎥
+
+
+
+---
+
+## Cảnh báo ⚠️
+
+1. Dự án này là phần mềm mã nguồn mở, phần mềm này không có quan hệ hợp tác thương mại với bất kỳ nhà cung cấp dịch vụ API bên thứ ba nào (bao gồm nhưng không giới hạn ở các nền tảng nhận dạng giọng nói, mô hình lớn, tổng hợp giọng nói, v.v.), và không đảm bảo chất lượng dịch vụ cũng như an toàn tài chính của họ.
+Khuyến nghị người dùng ưu tiên lựa chọn nhà cung cấp dịch vụ có giấy phép kinh doanh liên quan và đọc kỹ thỏa thuận dịch vụ và chính sách bảo mật của họ. Phần mềm này không lưu trữ bất kỳ khóa tài khoản nào, không tham gia vào luồng tiền và không chịu rủi ro mất tiền nạp.
+
+2. Chức năng của dự án này chưa hoàn thiện và chưa qua đánh giá bảo mật mạng, vui lòng không sử dụng trong môi trường sản xuất. Nếu bạn triển khai dự án này trong môi trường mạng công cộng để học tập, vui lòng thực hiện các biện pháp bảo vệ cần thiết.
+
+---
+
+## Tài liệu triển khai
+
+
+
+Dự án này cung cấp hai phương pháp triển khai, vui lòng chọn theo nhu cầu cụ thể của bạn:
+
+#### 🚀 Lựa chọn phương pháp triển khai
+| Phương pháp triển khai | Đặc điểm | Tình huống áp dụng | Tài liệu triển khai | Yêu cầu cấu hình | Video hướng dẫn |
+|---------|------|---------|---------|---------|---------|
+| **Cài đặt tối giản** | Đối thoại thông minh, IOT, MCP, cảm nhận thị giác | Môi trường cấu hình thấp, dữ liệu lưu trong tệp cấu hình, không cần cơ sở dữ liệu | [①Phiên bản Docker](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Triển khai mã nguồn](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 nhân 4GB nếu dùng `FunASR`, 2 nhân 2GB nếu toàn API | - |
+| **Cài đặt toàn bộ module** | Đối thoại thông minh, IOT, điểm truy cập MCP, nhận dạng giọng nói, cảm nhận thị giác, OTA, bảng điều khiển thông minh | Trải nghiệm đầy đủ tính năng, dữ liệu lưu trong cơ sở dữ liệu |[①Phiên bản Docker](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Triển khai mã nguồn](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Hướng dẫn tự động cập nhật triển khai mã nguồn](./docs/dev-ops-integration.md) | 4 nhân 8GB nếu dùng `FunASR`, 2 nhân 4GB nếu toàn API| [Video hướng dẫn khởi động mã nguồn cục bộ](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
+
+Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](./docs/FAQ.md)
+
+> 💡 Gợi ý: Dưới đây là nền tảng thử nghiệm được triển khai theo mã mới nhất, có thể flash để thử nghiệm nếu cần, đồng thời là 6, dữ liệu sẽ được xóa mỗi ngày,
+
+```
+Địa chỉ bảng điều khiển thông minh: https://2662r3426b.vicp.fun
+Bảng điều khiển thông minh (phiên bản h5): https://2662r3426b.vicp.fun/h5/index.html
+
+Công cụ kiểm tra dịch vụ: https://2662r3426b.vicp.fun/test/
+Địa chỉ giao diện OTA: https://2662r3426b.vicp.fun/xiaozhi/ota/
+Địa chỉ giao diện Websocket: wss://2662r3426b.vicp.fun/xiaozhi/v1/
+```
+
+#### 🚩 Mô tả và khuyến nghị cấu hình
+> [!Note]
+> Dự án này cung cấp hai phương án cấu hình:
+>
+> 1. Cấu hình `Miễn phí hoàn toàn cho người mới`: Phù hợp với sử dụng gia đình cá nhân, tất cả các thành phần đều sử dụng phương án miễn phí, không cần thanh toán thêm.
+>
+> 2. `Cấu hình streaming`: Phù hợp với demo, đào tạo, hơn 2 đồng thời, v.v., sử dụng công nghệ xử lý streaming, tốc độ phản hồi nhanh hơn, trải nghiệm tốt hơn.
+>
+> Từ phiên bản `0.5.2`, dự án hỗ trợ cấu hình streaming, so với phiên bản đầu, tốc độ phản hồi cải thiện khoảng `2.5 giây`, cải thiện đáng kể trải nghiệm người dùng.
+
+| Tên module | Cài đặt miễn phí cho người mới | Cấu hình streaming |
+|:---:|:---:|:---:|
+| ASR(Nhận dạng giọng nói) | FunASR(Local) | 👍FunASR(Chế độ GPU cục bộ) |
+| LLM(Mô hình lớn) | ChatGLMLLM(Zhipu glm-4-flash) | 👍AliLLM(qwen3-235b-a22b-instruct-2507) hoặc 👍DoubaoLLM(doubao-1-5-pro-32k-250115) |
+| VLLM(Mô hình lớn thị giác) | ChatGLMVLLM(Zhipu glm-4v-flash) | 👍QwenVLVLLM(Qwen qwen2.5-vl-3b-instructh) |
+| TTS(Tổng hợp giọng nói) | ✅LinkeraiTTS(Lingxi streaming) | 👍HuoshanDoubleStreamTTS(Tổng hợp giọng nói streaming kép Volcano) hoặc 👍AliyunStreamTTS(Tổng hợp giọng nói streaming Alibaba Cloud) |
+| Intent(Nhận dạng ý định) | function_call(Gọi hàm) | function_call(Gọi hàm) |
+| Memory(Chức năng bộ nhớ) | mem_local_short(Bộ nhớ ngắn hạn cục bộ) | mem_local_short(Bộ nhớ ngắn hạn cục bộ) |
+
+Nếu bạn quan tâm đến thời gian của từng thành phần, vui lòng xem [Báo cáo kiểm tra hiệu suất các thành phần Xiaozhi](https://github.com/xinnan-tech/xiaozhi-performance-research), có thể kiểm tra thực tế trong môi trường của bạn theo phương pháp kiểm tra trong báo cáo.
+
+#### 🔧 Công cụ kiểm tra
+Dự án này cung cấp các công cụ kiểm tra sau để giúp bạn xác minh hệ thống và chọn mô hình phù hợp:
+
+| Tên công cụ | Vị trí | Phương pháp sử dụng | Mô tả chức năng |
+|:---:|:---|:---:|:---:|
+| Công cụ kiểm tra tương tác âm thanh | main》xiaozhi-server》test》test_page.html | Mở trực tiếp bằng trình duyệt Google Chrome | Kiểm tra chức năng phát và nhận âm thanh, xác minh xử lý âm thanh phía Python có bình thường không |
+| Công cụ kiểm tra phản hồi mô hình | main》xiaozhi-server》performance_tester.py | Thực hiện `python performance_tester.py` | Kiểm tra tốc độ phản hồi của ba module cốt lõi ASR(Nhận dạng giọng nói), LLM(Mô hình lớn), VLLM(Mô hình thị giác), TTS(Tổng hợp giọng nói) |
+
+> 💡 Gợi ý: Khi kiểm tra tốc độ mô hình, chỉ kiểm tra các mô hình đã cấu hình khóa.
+
+---
+## Danh sách tính năng ✨
+### Đã thực hiện ✅
+
+| Module chức năng | Mô tả |
+|:---:|:---|
+| Kiến trúc cốt lõi | Dựa trên [cổng MQTT+UDP](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket, máy chủ HTTP, cung cấp hệ thống quản lý bảng điều khiển và xác thực hoàn chỉnh |
+| Tương tác giọng nói | Hỗ trợ ASR streaming(Nhận dạng giọng nói), TTS streaming(Tổng hợp giọng nói), VAD(Phát hiện hoạt động giọng nói), hỗ trợ nhận dạng đa ngôn ngữ và xử lý giọng nói |
+| Nhận dạng vân giọng | Hỗ trợ đăng ký, quản lý và nhận dạng vân giọng đa người dùng, xử lý song song với ASR, nhận dạng danh tính người nói theo thời gian thực và truyền cho LLM để phản hồi cá nhân hóa |
+| Đối thoại thông minh | Hỗ trợ nhiều LLM(Mô hình ngôn ngữ lớn), thực hiện đối thoại thông minh |
+| Cảm nhận thị giác | Hỗ trợ nhiều VLLM(Mô hình lớn thị giác), thực hiện tương tác đa phương thức |
+| Nhận dạng ý định | Hỗ trợ nhận dạng ý định mô hình lớn gắn ngoài, gọi hàm tự chủ mô hình lớn, cung cấp cơ chế xử lý ý định dạng plugin |
+| Hệ thống bộ nhớ | Hỗ trợ bộ nhớ ngắn hạn cục bộ, bộ nhớ giao diện mem0ai, có chức năng tóm tắt bộ nhớ |
+| Kho tri thức | Hỗ trợ kho tri thức RAGFlow, cho phép mô hình lớn đánh giá cần gọi kho tri thức trước khi trả lời |
+| Gọi công cụ | Hỗ trợ giao thức IOT phía client, giao thức MCP phía client, giao thức MCP phía server, giao thức điểm truy cập MCP, hàm công cụ tùy chỉnh |
+| Gửi lệnh | Dựa vào giao thức MQTT, hỗ trợ gửi lệnh MCP từ bảng điều khiển thông minh xuống thiết bị ESP32 |
+| Backend quản lý | Cung cấp giao diện quản lý Web, hỗ trợ quản lý người dùng, cấu hình hệ thống và quản lý thiết bị; giao diện hỗ trợ hiển thị tiếng Trung giản thể, tiếng Trung phồn thể, tiếng Anh |
+| Công cụ kiểm tra | Cung cấp công cụ kiểm tra hiệu suất, công cụ kiểm tra mô hình thị giác và công cụ kiểm tra tương tác âm thanh |
+| Hỗ trợ triển khai | Hỗ trợ triển khai Docker và triển khai cục bộ, cung cấp quản lý tệp cấu hình hoàn chỉnh |
+| Hệ thống plugin | Hỗ trợ mở rộng plugin chức năng, phát triển plugin tùy chỉnh và hot loading plugin |
+
+### Đang phát triển 🚧
+
+Muốn hiểu tiến độ kế hoạch phát triển cụ thể, [vui lòng nhấp vào đây](https://github.com/users/xinnan-tech/projects/3). Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](./docs/FAQ.md)
+
+Nếu bạn là một nhà phát triển phần mềm, đây có một [Lá thư mở gửi các nhà phát triển](docs/contributor_open_letter.md), chào mừng tham gia!
+
+---
+
+## Hệ sinh thái sản phẩm 👬
+Xiaozhi là một hệ sinh thái, khi bạn sử dụng sản phẩm này, bạn cũng có thể xem các [dự án xuất sắc](https://github.com/78/xiaozhi-esp32?tab=readme-ov-file#%E7%9B%B8%E5%85%B3%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE) khác trong hệ sinh thái này
+
+---
+
+## Danh sách nền tảng/thành phần được dự án này hỗ trợ 📋
+### LLM Mô hình ngôn ngữ
+
+| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
+|:---:|:---:|:---:|
+| Gọi giao diện openai | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFlytek | Zhipu, Gemini |
+| Gọi giao diện ollama | Ollama | - |
+| Gọi giao diện dify | Dify | - |
+| Gọi giao diện fastgpt | Fastgpt | - |
+| Gọi giao diện coze | Coze | - |
+| Gọi giao diện xinference | Xinference | - |
+| Gọi giao diện homeassistant | HomeAssistant | - |
+
+Trên thực tế, bất kỳ LLM nào hỗ trợ gọi giao diện openai đều có thể truy cập sử dụng.
+
+---
+
+### VLLM Mô hình thị giác
+
+| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
+|:---:|:---:|:---:|
+| Gọi giao diện openai | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
+
+Trên thực tế, bất kỳ VLLM nào hỗ trợ gọi giao diện openai đều có thể truy cập sử dụng.
+
+---
+
+### TTS Tổng hợp giọng nói
+
+| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
+|:---:|:---:|:---:|
+| Gọi giao diện | EdgeTTS, iFlytek, Volcano Engine, Tencent Cloud, Alibaba Cloud và Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi streaming TTS, MinimaxTTS | Lingxi streaming TTS, EdgeTTS, CosyVoiceSiliconflow(một phần) |
+| Dịch vụ cục bộ | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
+
+---
+
+### VAD Phát hiện hoạt động giọng nói
+
+| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
+|:---:|:---------:|:----:|:----:|:--:|
+| VAD | SileroVAD | Sử dụng cục bộ | Miễn phí | |
+
+---
+
+### ASR Nhận dạng giọng nói
+
+| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
+|:---:|:---:|:---:|
+| Sử dụng cục bộ | FunASR, SherpaASR | FunASR, SherpaASR |
+| Gọi giao diện | FunASRServer, Volcano Engine, iFlytek, Tencent Cloud, Alibaba Cloud, Baidu Cloud, OpenAI ASR | FunASRServer |
+
+---
+
+### Voiceprint Nhận dạng vân giọng
+
+| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
+|:---:|:---:|:---:|
+| Sử dụng cục bộ | 3D-Speaker | 3D-Speaker |
+
+---
+
+### Memory Lưu trữ bộ nhớ
+
+| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
+|:------:|:---------------:|:----:|:---------:|:--:|
+| Memory | mem0ai | Gọi giao diện | Hạn mức 1000 lần/tháng | |
+| Memory | mem_local_short | Tóm tắt cục bộ | Miễn phí | |
+| Memory | nomem | Chế độ không có bộ nhớ | Miễn phí | |
+
+---
+
+### Intent Nhận dạng ý định
+
+| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
+|:------:|:-------------:|:----:|:-------:|:---------------------:|
+| Intent | intent_llm | Gọi giao diện | Thu phí theo LLM | Nhận dạng ý định qua mô hình lớn, tính tổng quát mạnh |
+| Intent | function_call | Gọi giao diện | Thu phí theo LLM | Hoàn thành ý định qua gọi hàm mô hình lớn, tốc độ nhanh, hiệu quả tốt |
+| Intent | nointent | Chế độ không có ý định | Miễn phí | Không thực hiện nhận dạng ý định, trả về trực tiếp kết quả đối thoại |
+
+---
+
+### Rag Tăng cường truy xuất thông tin
+
+| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
+|:------:|:-------------:|:----:|:-------:|:---------------------:|
+| Rag | ragflow | Gọi giao diện | Thu phí theo token tiêu tốn của phân đoạn, phân từ | Sử dụng chức năng tăng cường truy xuất của RagFlow, cung cấp phản hồi đối thoại chính xác hơn |
+
+---
+
+## Lời cảm ơn 🙏
+
+| Logo | Dự án/Công ty | Mô tả |
+|:---:|:---:|:---|
+| | [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) | Dự án này được lấy cảm hứng từ [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) và được triển khai trên cơ sở đó |
+| | [Shifang Ronghai](https://www.tenclass.com/) | Cảm ơn [Shifang Ronghai](https://www.tenclass.com/) đã xây dựng giao thức truyền thông tiêu chuẩn, phương án tương thích đa thiết bị và mô phạm thực hành tình huống đồng thời cao cho hệ sinh thái Xiaozhi; cung cấp tài liệu hỗ trợ kỹ thuật toàn diện cho dự án này |
+| | [Xuanfeng Technology](https://github.com/Eric0308) | Cảm ơn [Xuanfeng Technology](https://github.com/Eric0308) đã đóng góp khung gọi hàm, giao thức truyền thông MCP và mã triển khai cơ chế gọi dạng plugin, thông qua hệ thống điều phối lệnh tiêu chuẩn hóa và khả năng mở rộng động, đã cải thiện đáng kể hiệu suất tương tác và khả năng mở rộng chức năng của thiết bị front-end(IoT) |
+| | [huangjunsen](https://github.com/huangjunsen0406) | Cảm ơn [huangjunsen](https://github.com/huangjunsen0406) đã đóng góp module `Bảng điều khiển thông minh di động`, thực hiện điều khiển hiệu quả và tương tác thời gian thực trên thiết bị di động đa nền tảng, cải thiện đáng kể sự tiện lợi vận hành và hiệu quả quản lý của hệ thống trong tình huống di động |
+| | [Huiyuan Design](http://ui.kwd988.net/) | Cảm ơn [Huiyuan Design](http://ui.kwd988.net/) đã cung cấp giải pháp thị giác chuyên nghiệp cho dự án này, sử dụng kinh nghiệm thực tế thiết kế phục vụ hơn nghìn doanh nghiệp, trao quyền cho trải nghiệm người dùng sản phẩm của dự án này |
+| | [Xi'an Qinren Information Technology](https://www.029app.com/) | Cảm ơn [Xi'an Qinren Information Technology](https://www.029app.com/) đã làm sâu sắc hệ thống thị giác của dự án này, đảm bảo tính nhất quán và khả năng mở rộng của phong cách thiết kế tổng thể trong ứng dụng đa tình huống |
+| | [Người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Cảm ơn [tất cả người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), sự cống hiến của bạn khiến dự án mạnh mẽ và vững chắc hơn. |
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Deployment.md b/docs/Deployment.md
index 7d9bcd042..25518a0fb 100644
--- a/docs/Deployment.md
+++ b/docs/Deployment.md
@@ -80,7 +80,7 @@ After configuring the project files, return to this tutorial to continue.
Open the command line tool, use the `terminal` or `command line` tool to enter your `xiaozhi-server`, and execute the following command
```
-docker-compose up -d
+docker compose up -d
```
After the execution is complete, execute the following command to view the log information.
@@ -139,6 +139,9 @@ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
conda install libopus -y
conda install ffmpeg -y
+
+# 在 Linux 环境下进行部署时,如出现类似缺失 libiconv.so.2 动态库的报错 请通过以下命令进行安装
+conda install libiconv -y
```
Please note that the above commands are not executed successfully all at once. You need to execute them step by step. After each step, check the output log to see if it is successful.
@@ -242,44 +245,47 @@ If you can see logs similar to the following, it means that the project service
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-==========================================================
```
-Normally, if you run this project through source code, the log will have your interface address information.
-However, if you deploy with Docker, the interface address information given in your log is not the real interface address.
+正常来说,如果您是通过源码运行本项目,日志会有你的接口地址信息。
+但是如果你用docker部署,那么你的日志里给出的接口地址信息就不是真实的接口地址。
-The most correct way is to determine your interface address based on the computer's LAN IP.
-If your computer's LAN IP is, for example, `192.168.1.25`, then your interface address is: `ws://192.168.1.25:8000/xiaozhi/v1/`, and the corresponding OTA address is: `http://192.168.1.25:8003/xiaozhi/ota/`.
+最正确的方法,是根据电脑的局域网IP来确定你的接口地址。
+如果你的电脑的局域网IP比如是`192.168.1.25`,那么你的接口地址就是:`ws://192.168.1.25:8000/xiaozhi/v1/`,对应的OTA地址就是:`http://192.168.1.25:8003/xiaozhi/ota/`。
-This information is very useful and will be needed later when `compiling the ESP32 firmware`.
+这个信息很有用的,后面`编译esp32固件`需要用到。
-Next, you can start operating your ESP32 device. You can either compile the ESP32 firmware yourself or use the firmware compiled by Xiage (version 1.6.1 or above).
+接下来,你就可以开始操作你的esp32设备了,你可以`自行编译esp32固件`也可以配置使用`虾哥编译好的1.6.1以上版本的固件`。两个任选一个
-1. [Compile your own ESP32 firmware](firmware-build.md).
+1、 [编译自己的esp32固件](firmware-build.md)了。
-2. [Configure a custom server based on the firmware compiled by Xia Ge](firmware-setting.md).
+2、 [基于虾哥编译好的固件配置自定义服务器](firmware-setting.md)了。
-# FAQ
-Here are some frequently asked questions for your reference:
+# 常见问题
+以下是一些常见问题,供参考:
-1. [Why does Xiaozhi recognize a lot of Korean, Japanese, and English when I say something?](./FAQ.md)
-2. [Why does the error "TTS task error file does not exist" appear?](./FAQ.md)
-3. [TTS often fails and times out](./FAQ.md)
-4. [I can connect to my own server using Wi-Fi, but not using 4G](./FAQ.md)
-5. [How to improve Xiaozhi's dialogue response speed? ](./FAQ.md)
-6. [I speak very slowly, and Xiaozhi always interrupts me when I pause](./FAQ.md)
-## Deployment related tutorials
-1. [How to automatically pull the latest code of this project, compile and start it](./dev-ops-integration.md)
-2. [How to integrate with Nginx](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
-## Expand related tutorials
-1. [How to enable mobile phone number registration smart console](./ali-sms-integration.md)
-2. [How to integrate HomeAssistant to achieve smart home control](./homeassistant-integration.md)
-3. [How to enable the vision model to realize photo recognition](./mcp-vision-integration.md)
-4. [How to deploy MCP access points](./mcp-endpoint-enable.md)
-5. [How to access the MCP access point](./mcp-endpoint-integration.md)
-6. [How to enable voiceprint recognition](./voiceprint-integration.md)
-10. [News plugin source configuration guide](./newsnow_plugin_config.md)
-## Tutorials on voice cloning and local voice deployment
-1. [How to deploy and integrate index-tts local voice](./index-stream-integration.md)
-2. [How to deploy integrated fish-speech local voice](./fish-speech-integration.md)
-3. [How to deploy and integrate PaddleSpeech local voice](./paddlespeech-deploy.md)
-## Performance Testing Tutorial
-1. [Component Speed Test Guide](./performance_tester.md)
-2. [Publish test results regularly](https://github.com/xinnan-tech/xiaozhi-performance-research)
+1、[为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md)
+2、[为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md)
+3、[TTS 经常失败,经常超时](./FAQ.md)
+4、[使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md)
+5、[如何提高小智对话响应速度?](./FAQ.md)
+6、[我说话很慢,停顿时小智老是抢话](./FAQ.md)
+## 部署相关教程
+1、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)
+2、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)
+3、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
+## 拓展相关教程
+1、[如何开启手机号码注册智控台](./ali-sms-integration.md)
+2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)
+3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)
+4、[如何部署MCP接入点](./mcp-endpoint-enable.md)
+5、[如何接入MCP接入点](./mcp-endpoint-integration.md)
+6、[如何开启声纹识别](./voiceprint-integration.md)
+7、[新闻插件源配置指南](./newsnow_plugin_config.md)
+8、[天气插件使用指南](./weather-integration.md)
+## 语音克隆、本地语音部署相关教程
+1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)
+2、[如何部署集成index-tts本地语音](./index-stream-integration.md)
+3、[如何部署集成fish-speech本地语音](./fish-speech-integration.md)
+4、[如何部署集成PaddleSpeech本地语音](./paddlespeech-deploy.md)
+## 性能测试教程
+1、[各组件速度测试指南](./performance_tester.md)
+2、[定期公开测试结果](https://github.com/xinnan-tech/xiaozhi-performance-research)
diff --git a/docs/Deployment_all.md b/docs/Deployment_all.md
index bc627fac5..fa67d8482 100644
--- a/docs/Deployment_all.md
+++ b/docs/Deployment_all.md
@@ -355,6 +355,9 @@ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
conda install libopus -y
conda install ffmpeg -y
+
+# 在 Linux 环境下进行部署时,如出现类似缺失 libiconv.so.2 动态库的报错 请通过以下命令进行安装
+conda install libiconv -y
```
Please note that the above commands are not executed successfully all at once. You need to execute them step by step. After each step, check the output log to see if it is successful.
@@ -460,28 +463,30 @@ Next, you can start operating your ESP32 device. You can either compile the ESP3
# FAQ
Here are some frequently asked questions for your reference:
-1. [Why does Xiaozhi recognize a lot of Korean, Japanese, and English when I say something?](./FAQ.md)
-2. [Why does the error "TTS task error file does not exist" appear?](./FAQ.md)
-3. [TTS often fails and times out](./FAQ.md)
-4. [I can connect to my own server using Wi-Fi, but not using 4G](./FAQ.md)
-5. [How to improve Xiaozhi's dialogue response speed? ](./FAQ.md)
-6. [I speak very slowly, and Xiaozhi always interrupts me when I pause](./FAQ.md)
-## Deployment related tutorials
-1. [How to automatically pull the latest code of this project, compile and start it](./dev-ops-integration.md)
-2. [How to integrate with Nginx](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
-## Expand related tutorials
-1. [How to enable mobile phone number registration smart console](./ali-sms-integration.md)
-2. [How to integrate HomeAssistant to achieve smart home control](./homeassistant-integration.md)
-3. [How to enable the vision model to realize photo recognition](./mcp-vision-integration.md)
-4. [How to deploy MCP access points](./mcp-endpoint-enable.md)
-5. [How to access the MCP access point](./mcp-endpoint-integration.md)
-6. [How to enable voiceprint recognition](./voiceprint-integration.md)
-7. [News plugin source configuration guide](./newsnow_plugin_config.md)
-8. [Weather Plugin Usage Guide](./weather-integration.md)
-## Tutorials on voice cloning and local voice deployment
-1. [How to deploy and integrate index-tts local voice](./index-stream-integration.md)
-2. [How to deploy integrated fish-speech local voice](./fish-speech-integration.md)
-3. [How to deploy and integrate PaddleSpeech local voice](./paddlespeech-deploy.md)
-## Performance Testing Tutorial
-1. [Component Speed Test Guide](./performance_tester.md)
-2. [Publish test results regularly](https://github.com/xinnan-tech/xiaozhi-performance-research)
+1、[为什么我说的话,小智识别出来很多韩文、日文、英文](./FAQ.md)
+2、[为什么会出现“TTS 任务出错 文件不存在”?](./FAQ.md)
+3、[TTS 经常失败,经常超时](./FAQ.md)
+4、[使用Wifi能连接自建服务器,但是4G模式却接不上](./FAQ.md)
+5、[如何提高小智对话响应速度?](./FAQ.md)
+6、[我说话很慢,停顿时小智老是抢话](./FAQ.md)
+## 部署相关教程
+1、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)
+2、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)
+3、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
+## 拓展相关教程
+1、[如何开启手机号码注册智控台](./ali-sms-integration.md)
+2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)
+3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)
+4、[如何部署MCP接入点](./mcp-endpoint-enable.md)
+5、[如何接入MCP接入点](./mcp-endpoint-integration.md)
+6、[如何开启声纹识别](./voiceprint-integration.md)
+7、[新闻插件源配置指南](./newsnow_plugin_config.md)
+8、[天气插件使用指南](./weather-integration.md)
+## 语音克隆、本地语音部署相关教程
+1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)
+2、[如何部署集成index-tts本地语音](./index-stream-integration.md)
+3、[如何部署集成fish-speech本地语音](./fish-speech-integration.md)
+4、[如何部署集成PaddleSpeech本地语音](./paddlespeech-deploy.md)
+## 性能测试教程
+1、[各组件速度测试指南](./performance_tester.md)
+2、[定期公开测试结果](https://github.com/xinnan-tech/xiaozhi-performance-research)
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 4a8d481d1..5baa09436 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -59,35 +59,38 @@ VAD:
min_silence_duration_ms: 700 # If the pauses in speaking are long, you can increase this value
```
-### 7. Deployment related tutorials
-1. [How to perform the simplest deployment](./Deployment.md)
-2. [How to deploy all modules](./Deployment_all.md)
-2. [How to deploy an MQTT gateway and enable the MQTT+UDP protocol](./mqtt-gateway-integration.md)
-3. [How to automatically pull the latest code of this project, compile and start it](./dev-ops-integration.md)
-4. [How to integrate with Nginx](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
+### 7、部署相关教程
+1、[如何进行最简化部署](./Deployment.md)
+2、[如何进行全模块部署](./Deployment_all.md)
+3、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)
+4、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)
+5、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)
-### 8. Compile firmware related tutorials
-1. [How to compile Xiaozhi firmware yourself](./firmware-build.md)
-2. [How to modify the OTA address based on the firmware compiled by Xia Ge](./firmware-setting.md)
+### 9、编译固件相关教程
+1、[如何自己编译小智固件](./firmware-build.md)
+2、[如何基于虾哥编译好的固件修改OTA地址](./firmware-setting.md)
-### 8. Expand related tutorials
-1. [How to enable mobile phone number registration smart console](./ali-sms-integration.md)
-2. [How to integrate HomeAssistant to achieve smart home control](./homeassistant-integration.md)
-3. [How to enable the vision model to realize photo recognition](./mcp-vision-integration.md)
-4. [How to deploy MCP access points](./mcp-endpoint-enable.md)
-5. [How to access the MCP access point](./mcp-endpoint-integration.md)
-6. [How to enable voiceprint recognition](./voiceprint-integration.md)
-10. [News plugin source configuration guide](./newsnow_plugin_config.md)
+### 10、拓展相关教程
+1、[如何开启手机号码注册智控台](./ali-sms-integration.md)
+2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)
+3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)
+4、[如何部署MCP接入点](./mcp-endpoint-enable.md)
+5、[如何接入MCP接入点](./mcp-endpoint-integration.md)
+6、[MCP方法如何获取设备信息](./mcp-get-device-info.md)
+7、[如何开启声纹识别](./voiceprint-integration.md)
+8、[新闻插件源配置指南](./newsnow_plugin_config.md)
+9、[知识库ragflow集成指南](./ragflow-integration.md)
-### 9. Tutorials on voice cloning and local voice deployment
-1. [How to deploy and integrate index-tts local voice](./index-stream-integration.md)
-2. [How to deploy integrated fish-speech local voice](./fish-speech-integration.md)
-3. [How to deploy and integrate PaddleSpeech local voice](./paddlespeech-deploy.md)
+### 11、语音克隆、本地语音部署相关教程
+1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)
+2、[如何部署集成index-tts本地语音](./index-stream-integration.md)
+3、[如何部署集成fish-speech本地语音](./fish-speech-integration.md)
+4、[如何部署集成PaddleSpeech本地语音](./paddlespeech-deploy.md)
-### 10. Performance Testing Tutorial
-1. [Component Speed Test Guide](./performance_tester.md)
-2. [Publish test results regularly](https://github.com/xinnan-tech/xiaozhi-performance-research)
+### 12、性能测试教程
+1、[各组件速度测试指南](./performance_tester.md)
+2、[定期公开测试结果](https://github.com/xinnan-tech/xiaozhi-performance-research)
-### 13. For more questions, please contact us for feedback💬
+### 13、更多问题,可联系我们反馈 💬
-Please submit your issues at [issues](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues).
+可以在[issues](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues)提交您的问题。
diff --git a/docs/docker-build.md b/docs/docker-build.md
index 043746cee..a98ca0a73 100644
--- a/docs/docker-build.md
+++ b/docs/docker-build.md
@@ -17,5 +17,5 @@ docker build -t xiaozhi-esp32-server:web_latest -f ./Dockerfile-web .
# After compilation is complete, you can use docker-compose to start the project
# You need to modify docker-compose.yml to the image version you compiled yourself
cd main/xiaozhi-server
-docker-compose up -d
+docker compose up -d
```
diff --git a/docs/homeassistant-integration.md b/docs/homeassistant-integration.md
index fe0e5baca..7874e3eeb 100644
--- a/docs/homeassistant-integration.md
+++ b/docs/homeassistant-integration.md
@@ -97,7 +97,7 @@ This string, which we call "device list string", needs to be saved as it will be
Log in to the Smart Console using an administrator account. In Agent Management, find your agent and click Configure Role.
-Set intent recognition to `Function Call` or `LLM Intent Recognition`. You will see an `Edit Function` button on the right. Click the `Edit Function` button and the `Function Management` dialog box will pop up.
+将意图识别设置成`外挂的大模型意图识别`或`大模型自主函数调用`。这时你会看到右侧有一个`编辑功能`。点击`编辑功能`按钮,会弹出`功能管理`的框。
In the `Feature Management` box, you need to check `HomeAssistant device status query` and `HomeAssistant device status modification`.
diff --git a/docs/huoshan-streamTTS-voice-cloning.md b/docs/huoshan-streamTTS-voice-cloning.md
index beb4d1f19..c2d261d96 100644
--- a/docs/huoshan-streamTTS-voice-cloning.md
+++ b/docs/huoshan-streamTTS-voice-cloning.md
@@ -1,29 +1,56 @@
-# Volcano Bidirectional Streaming TTS + Voice Cloning Configuration Tutorial
-In a single-module deployment, voice cloning is performed while using the Volcano Engine bidirectional streaming speech synthesis service, supporting WebSocket protocol streaming calls.
-### 1. Open the Volcano Engine service
-Visit https://console.volcengine.com/speech/app and create an app in the App Manager. Select the speech synthesis model and the sound replication model. Click the sound replication model in the list on the left and scroll down to obtain the App ID, Access Token, Cluster ID, and Sound ID (S_xxxxx).
-### 2. Clone the sound
-To clone the voice, please refer to the tutorial https://github.com/104gogo/huoshan-voice-copy
+# 智控台 火山双流式语音合成+音色克隆配置教程
-Prepare a 10-30 second audio file (.wav format) and add it to the cloned project. Fill the key obtained from the platform into ```uploadAndStatus.py``` and ```tts_http_demo.py```
+本教程分为4个阶段:准备阶段、配置阶段、克隆阶段、使用阶段。主要是介绍通过智控台配置火山双流式语音合成+音色克隆的过程。
-In uploadAndStatus.py, change audio_path= to your own .wav file name
-```Python
-train(appid=appid, token=token, audio_path=r".\audios\xiaohe.wav", spk_id=spk_id)
-```
+## 第一阶段:准备阶段
+超级管理员先预先把火山引擎服务开通好,获取到App Id,Access Token。默认火上引擎会赠送一个音色资源。这个音色资源需要把它复制到本项目里。
-Run the following command to generate test_submit.mp3 and click Play to listen to the cloned effect.
+如果你想克隆多个音色,需要购买开通多个音色资源。只要把每个音色资源的声音ID(S_xxxxx)复制到本项目。然后分配给系统的账号使用即可。以下是详细步骤:
-```Python
-python uploadAndStatus.py
-python tts_http_demo.py
-```
-Go back to the Volcano Engine console page and refresh it to see that the status of the sound replication details is successful.
-### 3. Fill in the configuration file
-Fill in the key applied for by the Volcano Engine service into the HuoshanDoubleStreamTTS configuration file in .config.yaml
+### 1.开通火山引擎服务
+访问 https://console.volcengine.com/speech/app 在应用管理创建应用,勾选语音合成大模型和声音复刻大模型。
-Modify the resource_id parameter to ``` volc.megatts.default```
-(See the official documentation at https://www.volcengine.com/docs/6561/1329505)
-Fill in the sound ID (S_xxxxx) of the speaker parameter
+### 2.获取音色资源ID
+访问 https://console.volcengine.com/speech/service/9999 复制三项内容,分别是App Id,Access Token以及声音ID(S_xxxxx)。如图
-Start the service. If the sound produced by Xiaozhi when waking him up is the cloned one, it means success.
+
+
+## 第二阶段:配置火山引擎服务
+
+### 1.填写火山引擎配置
+
+使用超级管理员账号登录智控台,点击顶部【模型配置】,再点击模型配置页面左侧的【语音合成】,搜索找到“火山双流式语音合成”,点击修改,将你火山引擎的`App Id`填入到【应用ID】字段里,将`Access Token`填入到【访问令牌】字段里。然后保存。
+
+### 2.将音色资源ID分配给系统账号
+
+使用超级管理员账号登录智控台,点击顶部【音色克隆】、【音色资源】。
+
+点击新增按钮,在【平台名称】选择“火山双流式语音合成”;
+
+在【音色资源ID】填入你火山引擎的声音资源ID(S_xxxxx),填入后按回车;
+
+在【归属账号】选择你要分配给的系统账号,你可以分配给你自己。然后点击保存
+
+## 第三阶段:克隆阶段
+
+如果登录后,点击顶部【音色克隆】》【音色克隆】,显示【您的账号暂无音色资源请联系管理员分配音色资源】,说明你在第二阶段还没有把音色资源ID分配给这个账号。那就是回到第二阶段,分配音色资源给对应的账号。
+
+如果登录后,点击顶部【音色克隆】》【音色克隆】,能看到对应的音色列表。请继续。
+
+在列表里会看到对应的音色列表。选择其中一个音色资源,点击【上传音频】按钮。上传后,可以试听一下声音或者截取某段声音。确认后点击【上传音频】按钮。
+
+
+上传音频后,在列表里会看到对应的音色会变成“待复刻”状态。点击【立即复刻】按钮。等1~2秒会返回结果。
+
+如果复刻失败,请将鼠标放到“错误信息”图标上,会显示失败的原因。
+
+如果复刻成功,在列表里会看到对应的音色会变成“训练成功”状态。此时你可以点击【声音名称】栏的修改按钮,修改音色资源的名称,方便后期选择使用。
+
+## 第四阶段:使用阶段
+
+点击顶部【智能体管理】,选择任意一个智能体,点击【配置角色】按钮。
+
+语音合成(TTS)选择“火山双流式语音合成”。在列表里,找到名字带有“克隆音色”的音色资源(如图),选择它,点击保存。
+
+
+接下来,可以唤醒小智和它对话。
diff --git a/docs/images/demo1.png b/docs/images/demo1.png
index 6459a06fd..1ab7c2247 100644
Binary files a/docs/images/demo1.png and b/docs/images/demo1.png differ
diff --git a/docs/images/demo6.png b/docs/images/demo6.png
index dc4edbebe..51f1f5e65 100644
Binary files a/docs/images/demo6.png and b/docs/images/demo6.png differ
diff --git a/docs/images/demo9.png b/docs/images/demo9.png
index ce74a02df..ff422fe9c 100644
Binary files a/docs/images/demo9.png and b/docs/images/demo9.png differ
diff --git a/docs/images/image-clone-integration-01.png b/docs/images/image-clone-integration-01.png
new file mode 100644
index 000000000..7132ee7a5
Binary files /dev/null and b/docs/images/image-clone-integration-01.png differ
diff --git a/docs/images/image-clone-integration-02.png b/docs/images/image-clone-integration-02.png
new file mode 100644
index 000000000..80972df9b
Binary files /dev/null and b/docs/images/image-clone-integration-02.png differ
diff --git a/docs/images/image-clone-integration-03.png b/docs/images/image-clone-integration-03.png
new file mode 100644
index 000000000..7f35e3933
Binary files /dev/null and b/docs/images/image-clone-integration-03.png differ
diff --git a/docs/index-stream-integration.md b/docs/index-stream-integration.md
index 08f5afd67..446685218 100644
--- a/docs/index-stream-integration.md
+++ b/docs/index-stream-integration.md
@@ -1,14 +1,18 @@
# IndexStreamTTS Usage Guide
-## Environment Preparation
-### 1. Clone the project (note that the release version of VLLM1.0 is used here)
+## 环境准备
+### 1. 克隆项目
```bash
-https://github.com/Ksuriuri/index-tts-vllm/releases/tag/IndexTTS-vLLM-1.0
+git clone https://github.com/Ksuriuri/index-tts-vllm.git
```
Enter the unzipped directory
```bash
cd index-tts-vllm
```
+切换到指定版本 (使用VLLM-0.10.2的历史版本)
+```bash
+git checkout 224e8d5e5c8f66801845c66b30fa765328fd0be3
+```
### 2. Create and activate a conda environment
```bash
@@ -34,22 +38,23 @@ Cuda compilation tools, release 12.8, V12.8.89
```bash
pip install torch torchvision
```
-You need PyTorch version 2.8.0 (corresponding to VLLM 0.10.2). For specific installation instructions, please refer to the [PyTorch official website](https://pytorch.org/get-started/locally/)
+需要 pytorch 版本 2.8.0(对应 vllm 0.10.2),具体安装指令请参考:[pytorch 官网](https://pytorch.org/get-started/locally/)
### 4. Install dependencies
```bash
pip install -r requirements.txt
```
-### 5. Download model weights
-This is the official weight file, which can be downloaded to any local path. It supports the weight of IndexTTS-1.5.
+### 5. 下载模型权重
+### 方案一:下载官方权重文件后转换
+此为官方权重文件,下载到本地任意路径即可,支持 IndexTTS-1.5 的权重
| HuggingFace | ModelScope |
|---------------------------------------------------------------|---------------------------------------------------------------------|
| [IndexTTS](https://huggingface.co/IndexTeam/Index-TTS) | [IndexTTS](https://modelscope.cn/models/IndexTeam/Index-TTS) |
| [IndexTTS-1.5](https://huggingface.co/IndexTeam/IndexTTS-1.5) | [IndexTTS-1.5](https://modelscope.cn/models/IndexTeam/IndexTTS-1.5) |
-The following is an example of how to install ModelScope
-### Please note: Git needs to be installed and initialized to enable LFS (if already installed, you can skip this step)
+下面以ModelScope的安装方法为例
+#### 请注意:git需要安装并初始化启用lfs(如已安装可以跳过)
```bash
sudo apt-get install git-lfs
git lfs install
@@ -61,8 +66,8 @@ cd model_dir
git clone https://www.modelscope.cn/IndexTeam/IndexTTS-1.5.git
```
-### 5. Model weight conversion
-```bash
+#### 模型权重转换
+```bash
bash convert_hf_format.sh /path/to/your/model_dir
```
For example, if the IndexTTS-1.5 model you downloaded is stored in the model_dir directory, execute the following command:
@@ -169,10 +174,12 @@ The log will be output in tmp/server.log. You can view the log status by the fol
```bash
tail -f tmp/server.log
```
-## Tone Configuration
-index-tts-vllm supports registering custom timbres through configuration files, and supports single-timbre and mixed-timbre configurations.
-Configure custom timbre in the assets/speaker.json file in the project root directory
-### Configuration format description
+如果显卡内存足够,可在脚本中添加启动参数 ----gpu_memory_utilization 来调整显存占用比例,默认值为 0.25
+
+## 音色配置
+index-tts-vllm支持通过配置文件注册自定义音色,支持单音色和混合音色配置。
+在项目根目录下的assets/speaker.json文件中配置自定义音色
+### 配置格式说明
```bash
{
"Speaker Name 1": [
@@ -184,5 +191,5 @@ Configure custom timbre in the assets/speaker.json file in the project root dire
]
}
```
-### Note (need to restart the service to register)
-After adding, you need to add the corresponding speaker in the smart console (for single module, change the corresponding voice)
+### 注意 (配置角色后需重启服务进行音色注册)
+添加后需在智控台中添加相应的说话人(单模块则更换相应的voice)
diff --git a/docs/mcp-get-device-info.md b/docs/mcp-get-device-info.md
new file mode 100644
index 000000000..bf4799587
--- /dev/null
+++ b/docs/mcp-get-device-info.md
@@ -0,0 +1,40 @@
+# MCP 方法如何获取设备信息
+
+本教程将指导你如何使用MCP方法获取设备信息。
+
+第一步:自定义你的`agent-base-prompt.txt`文件
+
+把xiaozhi-server目录的`agent-base-prompt.txt`文件内容复制到你的`data`目录下,并重命名为`.agent-base-prompt.txt`。
+
+第二步:修改`data/.agent-base-prompt.txt`文件,找到``标签,在标签内容中添加以下代码内容:
+```
+- **设备ID:** {{device_id}}
+```
+
+添加完成后,你的`data/.agent-base-prompt.txt`文件的``标签内容大致如下:
+```
+
+【重要!以下信息已实时提供,无需调用工具查询,请直接使用:】
+- **设备ID:** {{device_id}}
+- **当前时间:** {{current_time}}
+- **今天日期:** {{today_date}} ({{today_weekday}})
+- **今天农历:** {{lunar_date}}
+- **用户所在城市:** {{local_address}}
+- **当地未来7天天气:** {{weather_info}}
+
+```
+
+第三步:修改`data/.config.yaml`文件,找到`agent-base-prompt`配置,修改前内容如下:
+```
+prompt_template: agent-base-prompt.txt
+```
+修改成
+```
+prompt_template: data/.agent-base-prompt.txt
+```
+
+第四步:重启你的xiaozhi-server服务。
+
+第五步:在你的mcp方法增加名称为`device_id`,类型为`string`,描述为`设备ID`的参数。
+
+第六步:重新唤醒小智,让他调用mcp方法,查看你的mcp方法是否可以获取`设备ID`。
diff --git a/docs/mqtt-gateway-integration.md b/docs/mqtt-gateway-integration.md
index 8d8bd34d8..1d386c8b0 100644
--- a/docs/mqtt-gateway-integration.md
+++ b/docs/mqtt-gateway-integration.md
@@ -11,12 +11,12 @@ Prepare the `mqtt-websocket` connection address of your `xiaozhi-server`. Based
1. If you are deploying from source code, your `mqtt-websocket` address is:
```
-ws://127.0.0.1:8000/xiaozhi/v1?from=mqtt_gateway
+ws://127.0.0.1:8000/xiaozhi/v1/?from=mqtt_gateway
```
2. If you are deploying with docker, your `mqtt-websocket` address is
```
-ws://your host LAN IP:8000/xiaozhi/v1?from=mqtt_gateway
+ws://你宿主机局域网IP:8000/xiaozhi/v1/?from=mqtt_gateway
```
## Important Note
@@ -53,7 +53,7 @@ cp config/mqtt.json.example config/mqtt.json
{
"production": {
"chat_servers": [
- "ws://127.0.0.1:8000/xiaozhi/v1?from=mqtt_gateway"
+ "ws://127.0.0.1:8000/xiaozhi/v1/?from=mqtt_gateway"
]
},
"debug": false,
diff --git a/docs/ragflow-integration.md b/docs/ragflow-integration.md
new file mode 100644
index 000000000..c2cd20f5f
--- /dev/null
+++ b/docs/ragflow-integration.md
@@ -0,0 +1,259 @@
+# ragflow 集成指南
+
+本教程主要是是两部分
+
+- 一、如何部署ragflow
+- 二、如何在智控台配置ragflow接口
+
+如果您对ragflow很熟悉,且已经部署了ragflow,可直接跳过第一部分,直接进入第二部分。但是如果你希望有人指导你部署ragflow,让它能够和`xiaozhi-esp32-server`共同使用`mysql`、`redis`基础服务,以减少资源成本,你需要从第一部分开始。
+
+# 第一部分 如何部署ragflow
+## 第一步, 确认mysql、redis是否可用
+
+ragflow需要依赖`mysql`数据库。如果你之前已经部署`智控台`,说明你已经安装了`mysql`。你可以共用它。
+
+你可以你试一下在宿主机使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
+``` shell
+telnet 127.0.0.1 3306
+
+telnet 127.0.0.1 6379
+```
+如果能访问到`3306`端口和`6379`端口,请忽略以下的内容,直接进入第二步。
+
+如果不能访问,你需要回忆一下,你的`mysql`是怎么安装的。
+
+如果你的mysql是通过自己使用安装包安装的,说明你的`mysql`做了网络隔离。你可能先解决访问`mysql`的`3306`端口这个问题。
+
+如果你`mysql`是通过本项目的`docker-compose_all.yml`安装的。你需要找一下你当时创建数据库的`docker-compose_all.yml`文件,修改以下的内容
+
+修改前
+``` yaml
+ xiaozhi-esp32-server-db:
+ ...
+ networks:
+ - default
+ expose:
+ - "3306:3306"
+ xiaozhi-esp32-server-redis:
+ ...
+ expose:
+ - 6379
+```
+
+修改后
+``` yaml
+ xiaozhi-esp32-server-db:
+ ...
+ networks:
+ - default
+ ports:
+ - "3306:3306"
+ xiaozhi-esp32-server-redis:
+ ...
+ ports:
+ - "6379:6379"
+```
+
+注意是将`xiaozhi-esp32-server-db`和`xiaozhi-esp32-server-redis`下面的`expose`改成`ports`。改完后,需要重新启动。以下是重启mysql的命令:
+
+``` shell
+# 进入你docker-compose_all.yml所在的文件夹,例如我的是xiaozhi-server
+cd xiaozhi-server
+docker compose -f docker-compose_all.yml down
+docker compose -f docker-compose.yml up -d
+```
+
+启动完后,在宿主机再使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
+``` shell
+telnet 127.0.0.1 3306
+
+telnet 127.0.0.1 6379
+```
+正常来说这样就可以访问的了。
+
+## 第二步, 创建数据库和表
+如果你的宿主机,能正常访问mysql数据库,那就在mysql上创建一个名字为`rag_flow`的数据库和`rag_flow`用户,密码为`infini_rag_flow`。
+
+``` sql
+-- 创建数据库
+CREATE DATABASE IF NOT EXISTS rag_flow CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+
+-- 创建用户并授权
+CREATE USER IF NOT EXISTS 'rag_flow'@'%' IDENTIFIED BY 'infini_rag_flow';
+GRANT ALL PRIVILEGES ON rag_flow.* TO 'rag_flow'@'%';
+
+-- 刷新权限
+FLUSH PRIVILEGES;
+```
+
+## 第三步, 下载ragflow项目
+
+你需要在你电脑找一个文件夹,用来存放ragflow项目。例如我在`/home/system/xiaozhi`文件夹。
+
+你可以使用`git`命令,将ragflow项目下载到这个文件夹,本教程使用的是`v0.22.0`版本进行安装部署。
+```
+git clone https://ghfast.top/https://github.com/infiniflow/ragflow.git
+cd ragflow
+git checkout v0.22.0
+```
+下载完后,进入`docker`文件夹。
+``` shell
+cd docker
+```
+修改`ragflow/docker`文件夹下的`docker-compose.yml`文件,将`ragflow-cpu`和`ragflow-gpu`服务的`depends_on`配置去掉,用于解除`ragflow-cpu`服务对`mysql`的依赖。
+
+这是修改前:
+``` yaml
+ ragflow-cpu:
+ depends_on:
+ mysql:
+ condition: service_healthy
+ profiles:
+ - cpu
+ ...
+ ragflow-gpu:
+ depends_on:
+ mysql:
+ condition: service_healthy
+ profiles:
+ - gpu
+```
+这是修改后:
+``` yaml
+ ragflow-cpu:
+ profiles:
+ - cpu
+ ...
+ ragflow-gpu:
+ profiles:
+ - gpu
+```
+
+接着,修改`ragflow/docker`文件夹下的`docker-compose-base.yml`文件,去掉`mysql`和`redis`的配置。
+
+例如,删除前:
+``` yaml
+services:
+ minio:
+ image: quay.io/minio/minio:RELEASE.2025-06-13T11-33-47Z
+ ...
+ mysql:
+ image: mysql:8.0
+ ...
+ redis:
+ image: redis:6.2-alpine
+ ...
+```
+
+删除后
+``` yaml
+services:
+ minio:
+ image: quay.io/minio/minio:RELEASE.2025-06-13T11-33-47Z
+ ...
+```
+## 第四步,修改环境变量配置
+
+编辑`ragflow/docker`文件夹下的`.env`文件,找到以下配置,逐个搜索,逐个修改!逐个搜索,逐个修改!
+
+``` env
+# 端口设置
+SVR_WEB_HTTP_PORT=8008 # HTTP端口
+SVR_WEB_HTTPS_PORT=8009 # HTTPS端口
+# MySQL配置 - 修改为您本地MySQL的信息
+MYSQL_HOST=host.docker.internal # 使用host.docker.internal让容器访问主机服务
+MYSQL_PORT=3306 # 本地MySQL端口
+MYSQL_USER=rag_flow # 上面创建的用户名,如果没有这项就增加这一项
+MYSQL_PASSWORD=infini_rag_flow # 上面设置的密码
+MYSQL_DBNAME=rag_flow # 数据库名称
+
+# Redis配置 - 修改为您本地Redis的信息
+REDIS_HOST=host.docker.internal # 使用host.docker.internal让容器访问主机服务
+REDIS_PORT=6379 # 本地Redis端口
+REDIS_PASSWORD= # 如果你的Redis没有设置密码,就按这样子填写,否则填写密码
+```
+
+注意,如果你的Redis没有设置密码,还要修改`ragflow/docker`文件夹下`service_conf.yaml.template`,将`infini_rag_flow`替换成空字符串。
+
+修改前
+``` shell
+redis:
+ db: 1
+ password: '${REDIS_PASSWORD:-infini_rag_flow}'
+ host: '${REDIS_HOST:-redis}:6379'
+```
+修改后
+``` shell
+redis:
+ db: 1
+ password: '${REDIS_PASSWORD:-}'
+ host: '${REDIS_HOST:-redis}:6379'
+```
+
+## 第五步,启动ragflow服务
+执行命令:
+``` shell
+docker-compose -f docker-compose.yml up -d
+```
+执行成功后,你可以使用`docker logs -n 20 -f docker-ragflow-cpu-1`命令,查看`docker-ragflow-cpu-1`服务的日志。
+
+如果日志中没有报错,说明ragflow服务启动成功。
+
+# 第五步,注册账号
+你可以在浏览器中访问`http://127.0.0.1:8008`,点击`Sign Up`,注册一个账号。
+
+注册成功后,你可以点击`Sign In`,登录到ragflow服务。如果你想关闭ragflow服务的注册服务,不想让其他人注册账号,你可以在`ragflow/docker`文件夹下的`.env`文件中,将`REGISTER_ENABLED`配置项设置为`0`。
+
+``` dotenv
+REGISTER_ENABLED=0
+```
+修改后,重启启动ragflow服务。
+``` shell
+docker-compose -f docker-compose.yml down
+docker-compose -f docker-compose.yml up -d
+```
+
+# 第六步,配置ragflow服务的模型
+你可以在浏览器中访问`http://127.0.0.1:8008`,点击`Sign In`,登录到ragflow服务。点击页面右上角的`头像`,进入设置页面。
+首先,在左侧导航栏中,点击`模型供应商`,进入到模型配置页面。在右侧的`可选模型`搜索框下,选择`LLM`,在列表选择你使用的模型供应商,点击`添加`,输入你的密钥;
+然后,选择`TEXT EMBEDDING`,在列表选择你使用的模型供应商,点击`添加`,输入你的密钥。
+最后,刷新一下页面,分别点击`设置默认模型`列表的LLM和Embedding,选择你使用的模型即可。请确认你的密钥开通了相应的服务,比如我是用的Embedding模型是xxx供应商的,需要去这个供应商官网查看这个模型是否需要购买资源包才能使用。
+
+
+# 第二部分 配置ragflow服务
+
+# 第一步 登录ragflow服务
+你可以在浏览器中访问`http://127.0.0.1:8008`,点击`Sign In`,登录到ragflow服务。
+
+然后点击右上角的`头像`,进入设置页面。在左侧导航栏中,点击`API`功能,然后点击"API Key"按钮。出现一个弹框,
+
+在弹框中,点击"Create new Key"按钮,生成一个API Key。复制这个`API Key`,你稍后会用到。
+
+# 第二步 配置到智控台
+确保你的智控台版本是`0.8.7`或以上。使用超级管理员账号登录到智控台。在顶部导航栏中,点击`模型配置`,在左侧导航栏中,点击`知识库`。
+
+在列表中找到`RAG_RAGFlow`,点击`编辑`按钮。
+
+在`服务地址`中,填写`http://你的ragflow服务的局域网IP:8008`,例如我的ragflow服务的局域网IP是`192.168.1.100`,那么我就填写`http://192.168.1.100:8008`。
+
+在`API密钥`中,填写之前复制的`API Key`。
+
+最后点击保存按钮。
+
+# 第二步 创建一个知识库
+使用超级管理员账号登录到智控台。在顶部导航栏中,点击`知识库`,在列表左下脚,点击`新增`按钮。填写一个知识库的名字和描述。点击保存。
+
+为了提高大模型对知识库的理解和召回能力,建议在创建知识库时,填写一个有意义的名字和描述。例如,如果你要创建一个关于`公司介绍`的知识库,那么知识库的名字可以是`公司介绍`,描述可以是`关于公司的相关信息例如公司基本信息、服务项目、联系电话、地址等。`。
+
+保存后,你可以在知识库列表中看到这个知识库。点击刚才创建的知识库的`查看`按钮,进入知识库详情页面。
+
+在知识库详情页面中,左下角点击`新增`按钮,可以上传文档到知识库。
+
+上传后,你可以在知识库详情页面中,看到上传的文档。此时可以点击文档的`解析`按钮,解析文档。
+
+解析完成后,你可以查看解析后的切片信息。你可以在知识库详情页面中,点击`召回测试`按钮,可以测试知识库的召回/检索功能。
+
+# 第三步 让小智使用ragflow知识库
+登录到智控台。在顶部导航栏中,点击`智能体`,找到你要配置的智能体,点击`配置角色`按钮。
+
+在意图识别左侧,点击`编辑功能`按钮,弹出一个弹框。在弹框中选择你要添加的知识库。保存即可。
diff --git a/docs/voiceprint-integration.md b/docs/voiceprint-integration.md
index 19bcb0b10..e559d51b4 100644
--- a/docs/voiceprint-integration.md
+++ b/docs/voiceprint-integration.md
@@ -28,7 +28,7 @@ If you can access port 3306, please ignore the following content and go directly
If you can't access it, you need to recall how you installed `mysql`.
-If you installed MySQL using a package yourself, it means your MySQL server is isolated from the network. You may need to first resolve the issue of accessing port 3306 of MySQL server.
+如果你的mysql是通过自己使用安装包安装的,说明你的`mysql`做了网络隔离。你可能先解决访问`mysql`的`3306`端口这个问题。
If you installed `mysql` through `docker-compose_all.yml` of this project, you need to find the `docker-compose_all.yml` file where you created the database and modify the following content
diff --git a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java
index febe12ffe..a7deaba19 100644
--- a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java
+++ b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java
@@ -146,6 +146,16 @@ public interface Constant {
*/
String MEMORY_NO_MEM = "Memory_nomem";
+ /**
+ * 火山引擎双声道语音克隆
+ */
+ String VOICE_CLONE_HUOSHAN_DOUBLE_STREAM = "huoshan_double_stream";
+
+ /**
+ * RAG配置类型
+ */
+ String RAG_CONFIG_TYPE = "RAG";
+
enum SysBaseParam {
/**
* ICP备案号
@@ -171,6 +181,38 @@ public interface Constant {
}
}
+ /**
+ * 训练状态
+ */
+ enum TrainStatus {
+ /**
+ * 未训练
+ */
+ NOT_TRAINED(0),
+ /**
+ * 训练中
+ */
+ TRAINING(1),
+ /**
+ * 已训练
+ */
+ TRAINED(2),
+ /**
+ * 训练失败
+ */
+ TRAIN_FAILED(3);
+
+ private final int code;
+
+ TrainStatus(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
+ }
+
/**
* 系统短信
*/
@@ -257,7 +299,7 @@ public interface Constant {
/**
* 版本号
*/
- public static final String VERSION = "0.8.4";
+ public static final String VERSION = "0.8.8";
/**
* 无效固件URL
diff --git a/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java b/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java
index 573269b87..659e135ac 100644
--- a/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java
+++ b/main/manager-api/src/main/java/xiaozhi/common/exception/ErrorCode.java
@@ -55,7 +55,7 @@ public interface ErrorCode {
int OTA_DEVICE_NOT_FOUND = 10041;
int OTA_DEVICE_NEED_BIND = 10042;
-
+
// 新增错误编码
int DELETE_DATA_FAILED = 10043;
int USER_NOT_LOGIN = 10044;
@@ -66,7 +66,7 @@ public interface ErrorCode {
int INVALID_LLM_TYPE = 10049;
int TOKEN_GENERATE_ERROR = 10050;
int RESOURCE_NOT_FOUND = 10051;
-
+
// 新增错误编码
int DEFAULT_AGENT_NOT_FOUND = 10052;
int AGENT_NOT_FOUND = 10053;
@@ -82,14 +82,6 @@ public interface ErrorCode {
int DEVICE_ALREADY_ACTIVATED = 10063;
// 默认模型删除错误
int DEFAULT_MODEL_DELETE_ERROR = 10064;
- // 设备相关错误码
- int MAC_ADDRESS_ALREADY_EXISTS = 10090; // Mac地址已存在
- // 模型相关错误码
- int MODEL_PROVIDER_NOT_EXIST = 10091; // 供应器不存在
- int LLM_NOT_EXIST = 10092; // 设置的LLM不存在
- int MODEL_REFERENCED_BY_AGENT = 10093; // 该模型配置已被智能体引用,无法删除
- int LLM_REFERENCED_BY_INTENT = 10094; // 该LLM模型已被意图识别配置引用,无法删除
-
// 登录相关错误码
int ADD_DATA_FAILED = 10065; // 新增数据失败
int UPDATE_DATA_FAILED = 10066; // 修改数据失败
@@ -102,17 +94,17 @@ public interface ErrorCode {
int RETRIEVE_PASSWORD_DISABLED = 10073; // 未开启找回密码功能
int PHONE_FORMAT_ERROR = 10074; // 手机号码格式不正确
int SMS_CODE_ERROR = 10075; // 手机验证码错误
-
+
// 字典类型相关错误码
int DICT_TYPE_NOT_EXIST = 10076; // 字典类型不存在
int DICT_TYPE_DUPLICATE = 10077; // 字典类型编码重复
-
+
// 资源处理相关错误码
int RESOURCE_READ_ERROR = 10078; // 读取资源失败
-
+
// 智能体相关错误码
int LLM_INTENT_PARAMS_MISMATCH = 10079; // LLM大模型和Intent意图识别,选择参数不匹配
-
+
// 声纹相关错误码
int VOICEPRINT_ALREADY_REGISTERED = 10080; // 此声音声纹已经注册
int VOICEPRINT_DELETE_ERROR = 10081; // 删除声纹出现错误
@@ -126,12 +118,16 @@ public interface ErrorCode {
int VOICEPRINT_UNREGISTER_REQUEST_ERROR = 10089; // 声纹注销请求失败
int VOICEPRINT_UNREGISTER_PROCESS_ERROR = 10090; // 声纹注销处理失败
int VOICEPRINT_IDENTIFY_REQUEST_ERROR = 10091; // 声纹识别请求失败
-
+
+ int LLM_NOT_EXIST = 10092; // 设置的LLM不存在
+ int MODEL_REFERENCED_BY_AGENT = 10093; // 该模型配置已被智能体引用,无法删除
+ int LLM_REFERENCED_BY_INTENT = 10094; // 该LLM模型已被意图识别配置引用,无法删除
+
// 服务端管理相关错误码
int INVALID_SERVER_ACTION = 10095; // 无效服务端操作
int SERVER_WEBSOCKET_NOT_CONFIGURED = 10096; // 未配置服务端WebSocket地址
int TARGET_WEBSOCKET_NOT_EXIST = 10097; // 目标WebSocket地址不存在
-
+
// 参数验证相关错误码
int WEBSOCKET_URLS_EMPTY = 10098; // WebSocket地址列表不能为空
int WEBSOCKET_URL_LOCALHOST = 10099; // WebSocket地址不能使用localhost或127.0.0.1
@@ -175,7 +171,7 @@ public interface ErrorCode {
int DOWNLOAD_LINK_INVALID = 10137; // 下载链接无效
int CHAT_ROLE_USER = 10138; // 用户角色
int CHAT_ROLE_AGENT = 10139; // 智能体角色
-
+
// 声音克隆相关错误码
int VOICE_CLONE_AUDIO_EMPTY = 10140; // 音频文件不能为空
int VOICE_CLONE_NOT_AUDIO_FILE = 10141; // 只支持音频文件
@@ -188,4 +184,33 @@ public interface ErrorCode {
int VOICE_RESOURCE_ACCOUNT_EMPTY = 10148; // 归属账号不能为空
int VOICE_RESOURCE_DELETE_ID_EMPTY = 10149; // 删除的音色资源ID不能为空
int VOICE_RESOURCE_NO_PERMISSION = 10150; // 您没有权限操作该记录
+ int VOICE_CLONE_AUDIO_NOT_UPLOADED = 10151; // 请先上传音频文件
+ int VOICE_CLONE_MODEL_CONFIG_NOT_FOUND = 10152; // 模型配置未找到
+ int VOICE_CLONE_MODEL_TYPE_NOT_FOUND = 10153; // 模型类型未找到
+ int VOICE_CLONE_TRAINING_FAILED = 10154; // 训练失败
+ int VOICE_CLONE_HUOSHAN_CONFIG_MISSING = 10155; // 火山引擎缺少配置
+ int VOICE_CLONE_RESPONSE_FORMAT_ERROR = 10156; // 响应格式错误
+ int VOICE_CLONE_REQUEST_FAILED = 10157; // 请求失败
+ int VOICE_CLONE_PREFIX = 10158; // 复刻音色前缀
+ int VOICE_ID_ALREADY_EXISTS = 10159; // 音色ID已存在
+ int VOICE_CLONE_HUOSHAN_VOICE_ID_ERROR = 10160; // 火山引擎音色ID格式错误
+
+ // 设备相关错误码
+ int MAC_ADDRESS_ALREADY_EXISTS = 10161; // Mac地址已存在
+ // 模型相关错误码
+ int MODEL_PROVIDER_NOT_EXIST = 10162; // 供应器不存在
+
+ // 知识库相关错误码
+ int Knowledge_Base_RECORD_NOT_EXISTS = 10163; // 知识库记录不存在
+ int RAG_CONFIG_NOT_FOUND = 10164; // RAG配置未找到
+ int RAG_CONFIG_TYPE_ERROR = 10165; // RAG配置类型错误
+ int RAG_DEFAULT_CONFIG_NOT_FOUND = 10166; // 默认RAG配置未找到
+ int RAG_API_ERROR = 10167; // RAG调用失败
+ int UPLOAD_FILE_ERROR = 10168; // 上传文件失败
+ int NO_PERMISSION = 10169; // 没有权限
+ int KNOWLEDGE_BASE_NAME_EXISTS = 10170; // 同名知识库已存在
+ int RAG_API_ERROR_URL_NULL = 10171; // RAG配置中base_url为空,请完善配置
+ int RAG_API_ERROR_API_KEY_NULL = 10172; // RAG配置中api_key为空,请完善配置
+ int RAG_API_ERROR_API_KEY_INVALID = 10173; // RAG配置中api_key包含占位符,请替换为实际的API密钥
+ int RAG_API_ERROR_URL_INVALID = 10174; // RAG配置中base_url格式不正确,请检查协议是否正确
}
diff --git a/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java b/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java
index a6b33b620..95add2f06 100644
--- a/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java
+++ b/main/manager-api/src/main/java/xiaozhi/common/handler/FieldMetaObjectHandler.java
@@ -32,13 +32,23 @@ public class FieldMetaObjectHandler implements MetaObjectHandler {
// 创建者
strictInsertFill(metaObject, CREATOR, Long.class, user.getId());
- // 创建时间
- strictInsertFill(metaObject, CREATE_DATE, Date.class, date);
+ // 创建时间 - 支持createDate和createdAt两种字段名
+ if (metaObject.hasSetter(CREATE_DATE)) {
+ strictInsertFill(metaObject, CREATE_DATE, Date.class, date);
+ }
+ if (metaObject.hasSetter("createdAt")) {
+ strictInsertFill(metaObject, "createdAt", Date.class, date);
+ }
// 更新者
strictInsertFill(metaObject, UPDATER, Long.class, user.getId());
- // 更新时间
- strictInsertFill(metaObject, UPDATE_DATE, Date.class, date);
+ // 更新时间 - 支持updateDate和updatedAt两种字段名
+ if (metaObject.hasSetter(UPDATE_DATE)) {
+ strictInsertFill(metaObject, UPDATE_DATE, Date.class, date);
+ }
+ if (metaObject.hasSetter("updatedAt")) {
+ strictInsertFill(metaObject, "updatedAt", Date.class, date);
+ }
// 数据标识
strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.INSERT.getValue());
@@ -46,10 +56,17 @@ public class FieldMetaObjectHandler implements MetaObjectHandler {
@Override
public void updateFill(MetaObject metaObject) {
+ Date date = new Date();
+
// 更新者
strictUpdateFill(metaObject, UPDATER, Long.class, SecurityUser.getUserId());
- // 更新时间
- strictUpdateFill(metaObject, UPDATE_DATE, Date.class, new Date());
+ // 更新时间 - 支持updateDate和updatedAt两种字段名
+ if (metaObject.hasSetter(UPDATE_DATE)) {
+ strictUpdateFill(metaObject, UPDATE_DATE, Date.class, date);
+ }
+ if (metaObject.hasSetter("updatedAt")) {
+ strictUpdateFill(metaObject, "updatedAt", Date.class, date);
+ }
// 数据标识
strictInsertFill(metaObject, DATA_OPERATION, String.class, Constant.DataOperation.UPDATE.getValue());
diff --git a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java
index d25c72b6f..3a9697131 100644
--- a/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java
+++ b/main/manager-api/src/main/java/xiaozhi/common/redis/RedisKeys.java
@@ -152,4 +152,11 @@ public class RedisKeys {
public static String getVoiceCloneAudioIdKey(String uuid) {
return "voiceClone:audio:id:" + uuid;
}
+
+ /**
+ * 获取知识库缓存key
+ */
+ public static String getKnowledgeBaseCacheKey(String datasetId) {
+ return "knowledge:base:" + datasetId;
+ }
}
diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/MessageUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/MessageUtils.java
index c346bf3da..abcc2cb3d 100644
--- a/main/manager-api/src/main/java/xiaozhi/common/utils/MessageUtils.java
+++ b/main/manager-api/src/main/java/xiaozhi/common/utils/MessageUtils.java
@@ -11,15 +11,15 @@ import org.springframework.context.i18n.LocaleContextHolder;
public class MessageUtils {
private static MessageSource messageSource;
- static {
- messageSource = (MessageSource) SpringContextUtils.getBean("messageSource");
- }
-
public static String getMessage(int code) {
return getMessage(code, new String[0]);
}
public static String getMessage(int code, String... params) {
+ if (messageSource == null) {
+ // 延迟初始化,确保Spring上下文已完全初始化
+ messageSource = (MessageSource) SpringContextUtils.getBean("messageSource");
+ }
return messageSource.getMessage(code + "", params, LocaleContextHolder.getLocale());
}
}
diff --git a/main/manager-api/src/main/java/xiaozhi/common/utils/SensitiveDataUtils.java b/main/manager-api/src/main/java/xiaozhi/common/utils/SensitiveDataUtils.java
index 05f4853a0..4d5715cc1 100644
--- a/main/manager-api/src/main/java/xiaozhi/common/utils/SensitiveDataUtils.java
+++ b/main/manager-api/src/main/java/xiaozhi/common/utils/SensitiveDataUtils.java
@@ -1,14 +1,15 @@
package xiaozhi.common.utils;
-import cn.hutool.json.JSONObject;
-import org.apache.commons.lang3.StringUtils;
-
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
-import java.util.HashMap;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+
+import cn.hutool.json.JSONObject;
+
/**
* 敏感数据处理工具类
*/
@@ -30,7 +31,7 @@ public class SensitiveDataUtils {
* 隐藏字符串中间部分
*/
public static String maskMiddle(String value) {
- if (StringUtils.isBlank(value)) {
+ if (StringUtils.isBlank(value) || value.length() == 1) {
return value;
}
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentPluginMappingServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentPluginMappingServiceImpl.java
index 2a53d4748..6d839d9c5 100644
--- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentPluginMappingServiceImpl.java
+++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentPluginMappingServiceImpl.java
@@ -1,16 +1,26 @@
package xiaozhi.modules.agent.service.impl;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import xiaozhi.common.utils.JsonUtils;
import xiaozhi.modules.agent.dao.AgentPluginMappingMapper;
import xiaozhi.modules.agent.entity.AgentPluginMapping;
import xiaozhi.modules.agent.service.AgentPluginMappingService;
+import xiaozhi.modules.knowledge.entity.KnowledgeBaseEntity;
+import xiaozhi.modules.knowledge.service.KnowledgeBaseService;
+import xiaozhi.modules.model.entity.ModelConfigEntity;
+import xiaozhi.modules.model.service.ModelConfigService;
/**
* @description 针对表【ai_agent_plugin_mapping(Agent与插件的唯一映射表)】的数据库操作Service实现
@@ -18,13 +28,73 @@ import xiaozhi.modules.agent.service.AgentPluginMappingService;
*/
@Service
@RequiredArgsConstructor
+@Slf4j
public class AgentPluginMappingServiceImpl extends ServiceImpl
implements AgentPluginMappingService {
private final AgentPluginMappingMapper agentPluginMappingMapper;
+ private final KnowledgeBaseService knowledgeBaseService;
+ private final ModelConfigService modelConfigService;
@Override
public List agentPluginParamsByAgentId(String agentId) {
- return agentPluginMappingMapper.selectPluginsByAgentId(agentId);
+ List list = agentPluginMappingMapper.selectPluginsByAgentId(agentId);
+ Map> knowledgeBaseMap = new HashMap<>();
+ Map modelConfigMap = new HashMap<>();
+ for (int i = list.size() - 1; i >= 0; i--) {
+ AgentPluginMapping mapping = list.get(i);
+ if (StringUtils.isBlank(mapping.getProviderCode())) {
+ // 查询知识库插件参数
+ KnowledgeBaseEntity knowledgeBaseEntity = knowledgeBaseService.selectById(mapping.getPluginId());
+ if (knowledgeBaseEntity == null) {
+ list.remove(i);
+ continue;
+ }
+ ModelConfigEntity modelConfigEntity = modelConfigService
+ .getModelByIdFromCache(knowledgeBaseEntity.getRagModelId());
+ if (modelConfigEntity == null) {
+ list.remove(i);
+ continue;
+ }
+ List knowledgeBaseList = knowledgeBaseMap.get(modelConfigEntity.getModelCode());
+ if (knowledgeBaseList == null) {
+ knowledgeBaseList = new ArrayList<>();
+ }
+ modelConfigMap.put(modelConfigEntity.getModelCode(), modelConfigEntity);
+ knowledgeBaseList.add(knowledgeBaseEntity);
+ knowledgeBaseMap.put(modelConfigEntity.getModelCode(), knowledgeBaseList);
+ list.remove(i);
+ }
+ }
+ if (knowledgeBaseMap.size() > 0) {
+ for (String pluginCode : knowledgeBaseMap.keySet()) {
+ List knowledgeBaseList = knowledgeBaseMap.get(pluginCode);
+ if (knowledgeBaseList == null || knowledgeBaseList.isEmpty()) {
+ continue;
+ }
+
+ AgentPluginMapping agentPluginMapping = new AgentPluginMapping();
+ agentPluginMapping.setAgentId(agentId);
+ agentPluginMapping.setPluginId(pluginCode);
+ agentPluginMapping.setProviderCode("search_from_" + pluginCode);
+ agentPluginMapping.setId(Long.valueOf(list.size() + 1));
+
+ Map paramInfo = new HashMap<>(4);
+ ModelConfigEntity modelConfigEntity = modelConfigMap.get(pluginCode);
+ paramInfo.put("base_url", modelConfigEntity.getConfigJson().getStr("base_url"));
+ paramInfo.put("api_key", modelConfigEntity.getConfigJson().getStr("api_key"));
+ paramInfo.put("dataset_ids",
+ knowledgeBaseList.stream().map(KnowledgeBaseEntity::getDatasetId).toList());
+
+ String description = "如果用户询问与【"
+ + String.join(",", knowledgeBaseList.stream().map(KnowledgeBaseEntity::getName).toList())
+ + "】涵盖的主体范围相关内容时应调用本方法,用于查询:" + String.join(",",
+ knowledgeBaseList.stream().map(KnowledgeBaseEntity::getDescription).toList());
+ paramInfo.put("description", description);
+ agentPluginMapping.setParamInfo(JsonUtils.toJsonString(paramInfo));
+ list.add(agentPluginMapping);
+ }
+ }
+ return list;
}
@Override
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java
index 72b8ea4d6..3556877d1 100644
--- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java
+++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java
@@ -42,6 +42,7 @@ import xiaozhi.modules.agent.service.AgentTemplateService;
import xiaozhi.modules.agent.vo.AgentInfoVO;
import xiaozhi.modules.device.service.DeviceService;
import xiaozhi.modules.model.dto.ModelProviderDTO;
+import xiaozhi.modules.model.dto.VoiceDTO;
import xiaozhi.modules.model.entity.ModelConfigEntity;
import xiaozhi.modules.model.service.ModelConfigService;
import xiaozhi.modules.model.service.ModelProviderService;
@@ -373,6 +374,22 @@ public class AgentServiceImpl extends BaseServiceImpl imp
entity.setLlmModelId(template.getLlmModelId());
entity.setVllmModelId(template.getVllmModelId());
entity.setTtsModelId(template.getTtsModelId());
+
+ if (template.getTtsVoiceId() == null && template.getTtsModelId() != null) {
+ ModelConfigEntity ttsModel = modelConfigService.selectById(template.getTtsModelId());
+ if (ttsModel != null && ttsModel.getConfigJson() != null) {
+ Map config = ttsModel.getConfigJson();
+ String voice = (String) config.get("voice");
+ if (StringUtils.isBlank(voice)) {
+ voice = (String) config.get("speaker");
+ }
+ VoiceDTO timbre = timbreModelService.getByVoiceCode(template.getTtsModelId(), voice);
+ if (timbre != null) {
+ template.setTtsVoiceId(timbre.getId());
+ }
+ }
+ }
+
entity.setTtsVoiceId(template.getTtsVoiceId());
entity.setMemModelId(template.getMemModelId());
entity.setIntentModelId(template.getIntentModelId());
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java
index 8c562edb9..321b5cb27 100644
--- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java
+++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java
@@ -45,6 +45,10 @@ public class AgentTemplateServiceImpl extends ServiceImpl wrapper = new UpdateWrapper<>();
switch (modelType) {
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/config/service/impl/ConfigServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/config/service/impl/ConfigServiceImpl.java
index 1b0181bc0..7883b8c1e 100644
--- a/main/manager-api/src/main/java/xiaozhi/modules/config/service/impl/ConfigServiceImpl.java
+++ b/main/manager-api/src/main/java/xiaozhi/modules/config/service/impl/ConfigServiceImpl.java
@@ -38,6 +38,8 @@ import xiaozhi.modules.sys.dto.SysParamsDTO;
import xiaozhi.modules.sys.service.SysParamsService;
import xiaozhi.modules.timbre.service.TimbreService;
import xiaozhi.modules.timbre.vo.TimbreDetailsVO;
+import xiaozhi.modules.voiceclone.entity.VoiceCloneEntity;
+import xiaozhi.modules.voiceclone.service.VoiceCloneService;
@Service
@AllArgsConstructor
@@ -51,6 +53,7 @@ public class ConfigServiceImpl implements ConfigService {
private final TimbreService timbreService;
private final AgentPluginMappingService agentPluginMappingService;
private final AgentMcpAccessPointService agentMcpAccessPointService;
+ private final VoiceCloneService cloneVoiceService;
private final AgentVoicePrintDao agentVoicePrintDao;
@Override
@@ -88,6 +91,7 @@ public class ConfigServiceImpl implements ConfigService {
null,
null,
null,
+ null,
result,
isCache);
@@ -124,6 +128,11 @@ public class ConfigServiceImpl implements ConfigService {
voice = timbre.getTtsVoice();
referenceAudio = timbre.getReferenceAudio();
referenceText = timbre.getReferenceText();
+ } else {
+ VoiceCloneEntity voice_print = cloneVoiceService.selectById(agent.getTtsVoiceId());
+ if (voice_print != null) {
+ voice = voice_print.getVoiceId();
+ }
}
// 构建返回数据
Map result = new HashMap<>();
@@ -187,6 +196,7 @@ public class ConfigServiceImpl implements ConfigService {
agent.getTtsModelId(),
agent.getMemModelId(),
agent.getIntentModelId(),
+ null,
result,
true);
@@ -363,12 +373,14 @@ public class ConfigServiceImpl implements ConfigService {
String ttsModelId,
String memModelId,
String intentModelId,
+ String ragModelId,
Map result,
boolean isCache) {
Map selectedModule = new HashMap<>();
- String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM" };
- String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId };
+ String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM", "RAG" };
+ String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId,
+ ragModelId };
String intentLLMModelId = null;
String memLocalShortLLMModelId = null;
@@ -392,6 +404,15 @@ public class ConfigServiceImpl implements ConfigService {
((Map) model.getConfigJson()).put("ref_audio", referenceAudio);
if (referenceText != null)
((Map) model.getConfigJson()).put("ref_text", referenceText);
+
+ // 火山引擎声音克隆需要替换resource_id
+ Map map = (Map) model.getConfigJson();
+ if (Constant.VOICE_CLONE_HUOSHAN_DOUBLE_STREAM.equals(map.get("type"))) {
+ // 如果voice是”S_“开头的,使用seed-icl-1.0
+ if (voice != null && voice.startsWith("S_")) {
+ map.put("resource_id", "seed-icl-1.0");
+ }
+ }
}
// 如果是Intent类型,且type=intent_llm,则给他添加附加模型
if ("Intent".equals(modelTypes[i])) {
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java
index e476dc326..a3f9d2366 100644
--- a/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java
+++ b/main/manager-api/src/main/java/xiaozhi/modules/device/controller/DeviceController.java
@@ -93,7 +93,7 @@ public class DeviceController {
}
@PostMapping("/bind/{agentId}")
- @Operation(summary = "转发POST请求到MQTT网关")
+ @Operation(summary = "设备在线接口")
@RequiresPermissions("sys:role:normal")
public Result forwardToMqttGateway(@PathVariable String agentId, @RequestBody String requestBody) {
try {
@@ -208,63 +208,4 @@ public class DeviceController {
deviceService.manualAddDevice(user.getId(), dto);
return new Result<>();
}
-
- @PostMapping("/commands/{deviceId}")
- @Operation(summary = "发送设备指令")
- @RequiresPermissions("sys:role:normal")
- public Result sendDeviceCommand(@PathVariable String deviceId, @RequestBody String command) {
- try {
- // 从系统参数中获取MQTT网关地址
- String mqttGatewayUrl = sysParamsService.getValue("server.mqtt_manager_api", true);
- if (StringUtils.isBlank(mqttGatewayUrl) || "null".equals(mqttGatewayUrl)) {
- return new Result().error("MQTT网关地址未配置");
- }
-
- // 构建完整的URL
- // 获取设备信息以构建mqttClientId
- DeviceEntity deviceById = deviceService.selectById(deviceId);
-
- if (!deviceById.getUserId().equals(SecurityUser.getUser().getId())) {
- return new Result().error("设备不存在");
- }
- String macAddress = deviceById != null ? deviceById.getMacAddress() : "unknown";
- String groupId = deviceById != null ? deviceById.getBoard() : null;
- if (groupId == null) {
- groupId = "GID_default";
- }
- groupId = groupId.replace(":", "_");
- macAddress = macAddress.replace(":", "_");
-
- // 拼接为groupId@@@macAddress@@@deviceId格式
- String mqttClientId = groupId + "@@@" + macAddress + "@@@" + macAddress;
-
- String url = "http://" + mqttGatewayUrl + "/api/commands/" + mqttClientId;
-
- // 设置请求头
- HttpHeaders headers = new HttpHeaders();
- headers.set("Content-Type", "application/json");
-
- // 生成Bearer令牌
- String dateStr = java.time.LocalDate.now()
- .format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"));
- String signatureKey = sysParamsService.getValue("server.mqtt_signature_key", false);
- if (StringUtils.isBlank(signatureKey)) {
- return new Result().error("MQTT签名密钥未配置");
- }
- String tokenContent = dateStr + signatureKey;
- String token = org.apache.commons.codec.digest.DigestUtils.sha256Hex(tokenContent);
- headers.set("Authorization", "Bearer " + token);
-
- // 构建请求体
- HttpEntity requestEntity = new HttpEntity<>(command, headers);
-
- // 发送POST请求
- ResponseEntity response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
-
- // 返回响应
- return new Result().ok(response.getBody());
- } catch (Exception e) {
- return new Result().error("发送指令失败: " + e.getMessage());
- }
- }
}
\ No newline at end of file
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportRespDTO.java b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportRespDTO.java
index 423868ca1..85c8972af 100644
--- a/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportRespDTO.java
+++ b/main/manager-api/src/main/java/xiaozhi/modules/device/dto/DeviceReportRespDTO.java
@@ -19,7 +19,7 @@ public class DeviceReportRespDTO {
@Schema(description = "固件版本信息")
private Firmware firmware;
-
+
@Schema(description = "WebSocket配置")
private Websocket websocket;
@@ -66,12 +66,14 @@ public class DeviceReportRespDTO {
@Schema(description = "时区偏移量,单位为分钟")
private Integer timezone_offset;
}
-
+
@Getter
@Setter
public static class Websocket {
@Schema(description = "WebSocket服务器地址")
private String url;
+ @Schema(description = "WebSocket 认证 token")
+ private String token;
}
@Getter
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java
index a79d1f2e9..5c3f854df 100644
--- a/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java
+++ b/main/manager-api/src/main/java/xiaozhi/modules/device/service/impl/DeviceServiceImpl.java
@@ -169,6 +169,7 @@ public class DeviceServiceImpl extends BaseServiceImpl
DeviceReportRespDTO.Websocket websocket = new DeviceReportRespDTO.Websocket();
// 从系统参数获取WebSocket URL,如果未配置则使用默认值
String wsUrl = sysParamsService.getValue(Constant.SERVER_WEBSOCKET, true);
+ websocket.setToken("");
if (StringUtils.isBlank(wsUrl) || wsUrl.equals("null")) {
log.error("WebSocket地址未配置,请登录智控台,在参数管理找到【server.websocket】配置");
wsUrl = "ws://xiaozhi.server.com:8000/xiaozhi/v1/";
diff --git a/main/manager-api/src/main/java/xiaozhi/modules/knowledge/controller/KnowledgeBaseController.java b/main/manager-api/src/main/java/xiaozhi/modules/knowledge/controller/KnowledgeBaseController.java
new file mode 100644
index 000000000..cddfead53
--- /dev/null
+++ b/main/manager-api/src/main/java/xiaozhi/modules/knowledge/controller/KnowledgeBaseController.java
@@ -0,0 +1,159 @@
+package xiaozhi.modules.knowledge.controller;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import xiaozhi.common.exception.ErrorCode;
+import xiaozhi.common.exception.RenException;
+import xiaozhi.common.page.PageData;
+import xiaozhi.common.utils.Result;
+import xiaozhi.modules.knowledge.dto.KnowledgeBaseDTO;
+import xiaozhi.modules.knowledge.service.KnowledgeBaseService;
+import xiaozhi.modules.security.user.SecurityUser;
+
+@AllArgsConstructor
+@RestController
+@RequestMapping("/datasets")
+@Tag(name = "知识库管理")
+public class KnowledgeBaseController {
+
+ private final KnowledgeBaseService knowledgeBaseService;
+
+ @GetMapping
+ @Operation(summary = "分页查询知识库列表")
+ @RequiresPermissions("sys:role:normal")
+ public Result> getPageList(
+ @RequestParam(required = false) String name,
+ @RequestParam(required = false, defaultValue = "1") Integer page,
+ @RequestParam(required = false, defaultValue = "10") Integer page_size) {
+ // 获取当前登录用户ID
+ Long currentUserId = SecurityUser.getUserId();
+
+ KnowledgeBaseDTO knowledgeBaseDTO = new KnowledgeBaseDTO();
+ knowledgeBaseDTO.setName(name);
+ knowledgeBaseDTO.setCreator(currentUserId); // 设置创建者ID,用于权限过滤
+
+ PageData pageData = knowledgeBaseService.getPageList(knowledgeBaseDTO, page, page_size);
+ return new Result>().ok(pageData);
+ }
+
+ @GetMapping("/{dataset_id}")
+ @Operation(summary = "根据知识库ID获取知识库详情")
+ @RequiresPermissions("sys:role:normal")
+ public Result getByDatasetId(@PathVariable("dataset_id") String datasetId) {
+ // 获取当前登录用户ID
+ Long currentUserId = SecurityUser.getUserId();
+
+ KnowledgeBaseDTO knowledgeBaseDTO = knowledgeBaseService.getByDatasetId(datasetId);
+
+ // 检查权限:用户只能查看自己创建的知识库
+ if (knowledgeBaseDTO.getCreator() == null || !knowledgeBaseDTO.getCreator().equals(currentUserId)) {
+ throw new RenException(ErrorCode.NO_PERMISSION);
+ }
+
+ return new Result().ok(knowledgeBaseDTO);
+ }
+
+ @PostMapping
+ @Operation(summary = "创建知识库")
+ @RequiresPermissions("sys:role:normal")
+ public Result save(@RequestBody @Validated KnowledgeBaseDTO knowledgeBaseDTO) {
+ KnowledgeBaseDTO resp = knowledgeBaseService.save(knowledgeBaseDTO);
+ return new Result().ok(resp);
+ }
+
+ @PutMapping("/{dataset_id}")
+ @Operation(summary = "更新知识库")
+ @RequiresPermissions("sys:role:normal")
+ public Result update(@PathVariable("dataset_id") String datasetId,
+ @RequestBody @Validated KnowledgeBaseDTO knowledgeBaseDTO) {
+ // 获取当前登录用户ID
+ Long currentUserId = SecurityUser.getUserId();
+
+ // 先获取现有知识库信息以检查权限
+ KnowledgeBaseDTO existingKnowledgeBase = knowledgeBaseService.getByDatasetId(datasetId);
+
+ // 检查权限:用户只能更新自己创建的知识库
+ if (existingKnowledgeBase.getCreator() == null || !existingKnowledgeBase.getCreator().equals(currentUserId)) {
+ throw new RenException(ErrorCode.NO_PERMISSION);
+ }
+
+ knowledgeBaseDTO.setDatasetId(datasetId);
+ KnowledgeBaseDTO resp = knowledgeBaseService.update(knowledgeBaseDTO);
+ return new Result().ok(resp);
+ }
+
+ @DeleteMapping("/{dataset_id}")
+ @Operation(summary = "删除单个知识库")
+ @Parameter(name = "dataset_id", description = "知识库ID", required = true)
+ @RequiresPermissions("sys:role:normal")
+ public Result delete(@PathVariable("dataset_id") String datasetId) {
+ // 获取当前登录用户ID
+ Long currentUserId = SecurityUser.getUserId();
+
+ // 先获取现有知识库信息以检查权限
+ KnowledgeBaseDTO existingKnowledgeBase = knowledgeBaseService.getByDatasetId(datasetId);
+
+ // 检查权限:用户只能删除自己创建的知识库
+ if (existingKnowledgeBase.getCreator() == null || !existingKnowledgeBase.getCreator().equals(currentUserId)) {
+ throw new RenException(ErrorCode.NO_PERMISSION);
+ }
+
+ knowledgeBaseService.deleteByDatasetId(datasetId);
+ return new Result<>();
+ }
+
+ @DeleteMapping("/batch")
+ @Operation(summary = "批量删除知识库")
+ @Parameter(name = "ids", description = "知识库ID列表,用逗号分隔", required = true)
+ @RequiresPermissions("sys:role:normal")
+ public Result deleteBatch(@RequestParam("ids") String ids) {
+ if (StringUtils.isBlank(ids)) {
+ throw new RenException(ErrorCode.PARAMS_GET_ERROR);
+ }
+
+ // 获取当前登录用户ID
+ Long currentUserId = SecurityUser.getUserId();
+ String[] idArray = ids.split(",");
+ for (String datasetId : idArray) {
+ if (StringUtils.isNotBlank(datasetId)) {
+ // 先获取现有知识库信息以检查权限
+ KnowledgeBaseDTO existingKnowledgeBase = knowledgeBaseService.getByDatasetId(datasetId.trim());
+
+ // 检查权限:用户只能删除自己创建的知识库
+ if (existingKnowledgeBase.getCreator() == null
+ || !existingKnowledgeBase.getCreator().equals(currentUserId)) {
+ throw new RenException(ErrorCode.NO_PERMISSION);
+ }
+
+ knowledgeBaseService.deleteByDatasetId(datasetId.trim());
+ }
+ }
+ return new Result<>();
+ }
+
+ @GetMapping("/rag-models")
+ @Operation(summary = "获取RAG模型列表")
+ @RequiresPermissions("sys:role:normal")
+ public Result>> getRAGModels() {
+ List