增加关闭聊天的功能

明确的退出命令可以直接关闭聊天
LLM检测到的结束聊天意图则在LLM回复后关闭聊天
This commit is contained in:
玄凤科技
2025-02-14 16:35:02 +08:00
parent ce64a76dcf
commit 4d35a5ae6a
4 changed files with 43 additions and 2 deletions
+6
View File
@@ -68,6 +68,12 @@ class ConnectionHandler:
self.tts_start_speak_time = None
self.tts_duration = 0
self.cmd_exit = self.config["CMD_exit"]
self.max_cmd_lenth = 0
for cmd in self.cmd_exit:
if len(cmd) > self.max_cmd_lenth:
self.max_cmd_lenth = len(cmd)
async def handle_connection(self, ws):
try:
# 获取并验证headers