mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
fix:唤醒响应文件是一个空文件的bug
This commit is contained in:
parent
5440de0453
commit
64816e9183
2 changed files with 10 additions and 6 deletions
|
|
@ -323,6 +323,8 @@ class ConnectionHandler:
|
|||
self.dialogue.put(Message(role="user", content=query))
|
||||
|
||||
# Define intent functions
|
||||
functions = None
|
||||
if hasattr(self, 'func_handler'):
|
||||
functions = self.func_handler.get_functions()
|
||||
|
||||
response_message = []
|
||||
|
|
|
|||
|
|
@ -45,12 +45,14 @@ async def checkWakeupWords(conn, text):
|
|||
|
||||
def getWakeupWordFile(file_name):
|
||||
for file in os.listdir(WAKEUP_CONFIG["dir"]):
|
||||
if "my_"+file_name in file:
|
||||
if file.startswith("my_" + file_name):
|
||||
"""避免缓存文件是一个空文件"""
|
||||
if os.stat(f"config/assets/{file}").st_size > (5 * 1024):
|
||||
return f"config/assets/{file}"
|
||||
|
||||
"""查找config/assets/目录下名称为wakeup_words的文件"""
|
||||
for file in os.listdir(WAKEUP_CONFIG["dir"]):
|
||||
if file_name in file:
|
||||
if file.startswith(file_name):
|
||||
return f"config/assets/{file}"
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue