mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 23:23:55 +08:00
update:智控台开启唤醒词加速
This commit is contained in:
@@ -227,7 +227,7 @@ public interface Constant {
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
public static final String VERSION = "0.5.4";
|
||||
public static final String VERSION = "0.5.5";
|
||||
|
||||
/**
|
||||
* 无效固件URL
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- 智控台开启唤醒词加速
|
||||
update `sys_params` set param_value = '你好小智;你好小志;小爱同学;你好小鑫;你好小新;小美同学;小龙小龙;喵喵同学;小滨小滨;小冰小冰;嘿你好呀' where param_code = 'wakeup_words';
|
||||
update `sys_params` set param_value = 'true' where param_code = 'enable_wakeup_words_response_cache';
|
||||
@@ -197,4 +197,11 @@ databaseChangeLog:
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506051538.sql
|
||||
path: classpath:db/changelog/202506051538.sql
|
||||
- changeSet:
|
||||
id: 202506080955
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506080955.sql
|
||||
@@ -5,7 +5,7 @@ from config.config_loader import load_config
|
||||
from config.settings import check_config_file
|
||||
from datetime import datetime
|
||||
|
||||
SERVER_VERSION = "0.5.4"
|
||||
SERVER_VERSION = "0.5.5"
|
||||
_logger_initialized = False
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import json
|
||||
import random
|
||||
import asyncio
|
||||
from core.utils.util import audio_to_data
|
||||
from core.handle.sendAudioHandle import send_stt_message
|
||||
from core.handle.sendAudioHandle import sendAudioMessage, send_stt_message
|
||||
from core.utils.util import remove_punctuation_and_length, opus_datas_to_wav_bytes
|
||||
from core.providers.tts.dto.dto import ContentType, SentenceType
|
||||
from core.handle.mcpHandle import (
|
||||
@@ -74,8 +74,10 @@ async def checkWakeupWords(conn, text):
|
||||
# 播放唤醒词回复
|
||||
conn.client_abort = False
|
||||
opus_packets, _ = audio_to_data(response["file_path"])
|
||||
conn.tts.tts_audio_queue.put((SentenceType.FIRST, opus_packets, response["text"]))
|
||||
conn.tts.tts_audio_queue.put((SentenceType.LAST, [], None))
|
||||
|
||||
conn.logger.bind(tag=TAG).info(f"播放唤醒词回复: {response['text']}")
|
||||
await sendAudioMessage(conn, SentenceType.FIRST, opus_packets, response["text"])
|
||||
await sendAudioMessage(conn, SentenceType.LAST, [], None)
|
||||
|
||||
# 检查是否需要更新唤醒词回复
|
||||
if time.time() - response["time"] > WAKEUP_CONFIG["refresh_time"]:
|
||||
|
||||
@@ -34,6 +34,7 @@ emoji_map = {
|
||||
|
||||
async def sendAudioMessage(conn, sentenceType, audios, text):
|
||||
# 发送句子开始消息
|
||||
conn.logger.bind(tag=TAG).info(f"发送音频消息: {sentenceType}, {text}")
|
||||
if text is not None:
|
||||
emotion = analyze_emotion(text)
|
||||
emoji = emoji_map.get(emotion, "🙂") # 默认使用笑脸
|
||||
|
||||
@@ -188,10 +188,8 @@ class TTSProvider(TTSProviderBase):
|
||||
|
||||
def tts_text_priority_thread(self):
|
||||
"""火山引擎双流式TTS的文本处理线程"""
|
||||
logger.bind(tag=TAG).info("TTS文本处理线程启动")
|
||||
while not self.conn.stop_event.is_set():
|
||||
try:
|
||||
logger.bind(tag=TAG).debug("等待TTS文本队列消息...")
|
||||
message = self.tts_text_queue.get(timeout=1)
|
||||
logger.bind(tag=TAG).debug(
|
||||
f"收到TTS任务|{message.sentence_type.name} | {message.content_type.name} | 会话ID: {self.conn.sentence_id}"
|
||||
|
||||
@@ -93,6 +93,8 @@ class TTSProvider(TTSProviderBase):
|
||||
self.processed_chars += len(full_text)
|
||||
else:
|
||||
self._process_before_stop_play_files()
|
||||
else:
|
||||
self._process_before_stop_play_files()
|
||||
|
||||
def to_tts_single_stream(self, text, is_last=False):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user