mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
feat: modify opening && closing~
This commit is contained in:
parent
a419b8a607
commit
3a97704e40
4 changed files with 17 additions and 3 deletions
|
|
@ -445,6 +445,16 @@ class ConnectionHandler:
|
|||
"""初始化上报线程"""
|
||||
self._init_report_threads()
|
||||
|
||||
if self._voice_opening:
|
||||
self.logger.bind(tag=TAG).info(f"send the opening message: {self._voice_opening}")
|
||||
self.tts.tts_text_queue.put(TTSMessageDTO(
|
||||
sentence_id=str(uuid.uuid4().hex),
|
||||
sentence_type=SentenceType.MIDDLE,
|
||||
content_type=ContentType.TEXT,
|
||||
content_detail=self._voice_opening,
|
||||
)
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
self.logger.bind(tag=TAG).error(f"实例化组件失败: {e}")
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from core.handle.abortHandle import handleAbortMessage
|
|||
from core.handle.intentHandler import handle_user_intent
|
||||
from core.utils.output_counter import check_device_output_limit
|
||||
from core.handle.sendAudioHandle import send_stt_message, SentenceType
|
||||
from core.providers.tts.dto.dto import SentenceType, ContentType, TTSMessageDTO
|
||||
|
||||
TAG = __name__
|
||||
|
||||
|
|
|
|||
|
|
@ -196,8 +196,8 @@ services:
|
|||
MINIO_ROOT_USER: minioadmin
|
||||
MINIO_ROOT_PASSWORD: minioadmin
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9001:9001"
|
||||
- "19000:9000"
|
||||
- "19001:9001"
|
||||
volumes:
|
||||
- ../live-agent-api/data/minio:/data
|
||||
networks:
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ handle_exit_intent_function_desc = {
|
|||
def handle_exit_intent(conn, say_goodbye: str | None = None):
|
||||
# 处理退出意图
|
||||
try:
|
||||
if say_goodbye is None:
|
||||
if hasattr(conn, '_voice_closing') and conn._voice_closing:
|
||||
say_goodbye = conn._voice_closing
|
||||
else:
|
||||
# 如果没有自定义结束语,使用默认的
|
||||
say_goodbye = "再见,祝您生活愉快!"
|
||||
conn.close_after_chat = True
|
||||
logger.bind(tag=TAG).info(f"退出意图已处理:{say_goodbye}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue