mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
Merge pull request #1129 from xinnan-tech/py-timeout-fix
Py timeout fix
This commit is contained in:
@@ -510,7 +510,7 @@ class ConnectionHandler:
|
||||
future = self.executor.submit(
|
||||
self.speak_and_play, segment_text, text_index
|
||||
)
|
||||
self.tts_queue.put(future)
|
||||
self.tts_queue.put((future, text_index))
|
||||
|
||||
self.llm_finish_task = True
|
||||
self.dialogue.put(Message(role="assistant", content="".join(response_message)))
|
||||
@@ -685,7 +685,7 @@ class ConnectionHandler:
|
||||
future = self.executor.submit(
|
||||
self.speak_and_play, segment_text, text_index
|
||||
)
|
||||
self.tts_queue.put(future)
|
||||
self.tts_queue.put((future, text_index))
|
||||
|
||||
# 存储对话内容
|
||||
if len(response_message) > 0:
|
||||
@@ -747,7 +747,7 @@ class ConnectionHandler:
|
||||
text = result.response
|
||||
self.recode_first_last_text(text, text_index)
|
||||
future = self.executor.submit(self.speak_and_play, text, text_index)
|
||||
self.tts_queue.put(future)
|
||||
self.tts_queue.put((future, text_index))
|
||||
self.dialogue.put(Message(role="assistant", content=text))
|
||||
elif result.action == Action.REQLLM: # 调用函数后再请求llm生成回复
|
||||
text = result.result
|
||||
@@ -780,7 +780,7 @@ class ConnectionHandler:
|
||||
text = result.result
|
||||
self.recode_first_last_text(text, text_index)
|
||||
future = self.executor.submit(self.speak_and_play, text, text_index)
|
||||
self.tts_queue.put(future)
|
||||
self.tts_queue.put((future, text_index))
|
||||
self.dialogue.put(Message(role="assistant", content=text))
|
||||
else:
|
||||
pass
|
||||
|
||||
@@ -10,6 +10,7 @@ from pathlib import Path
|
||||
from core.utils import p3
|
||||
from core.handle.sendAudioHandle import send_stt_message
|
||||
from plugins_func.register import register_function, ToolType, ActionResponse, Action
|
||||
from core.utils.dialogue import Message
|
||||
|
||||
|
||||
TAG = __name__
|
||||
@@ -214,6 +215,7 @@ async def play_local_music(conn, specific_file=None):
|
||||
return
|
||||
text = _get_random_play_prompt(selected_music)
|
||||
await send_stt_message(conn, text)
|
||||
conn.dialogue.put(Message(role="assistant", content=text))
|
||||
conn.tts_first_text_index = 0
|
||||
conn.tts_last_text_index = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user