Update connection.py

This commit is contained in:
Chris 2025-02-18 11:33:07 +08:00 committed by GitHub
parent 4b826ebcc2
commit caa7352028
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,6 +18,7 @@ from core.handle.audioHandle import handleAudioMessage, sendAudioMessage
from config.private_config import PrivateConfig from config.private_config import PrivateConfig
from core.auth import AuthMiddleware, AuthenticationError from core.auth import AuthMiddleware, AuthenticationError
from core.utils.auth_code_gen import AuthCodeGenerator # 添加导入 from core.utils.auth_code_gen import AuthCodeGenerator # 添加导入
from core.utils.performance_monitor import track_performance
TAG = __name__ TAG = __name__
@ -189,7 +190,8 @@ class ConnectionHandler:
return False return False
return not self.is_device_verified return not self.is_device_verified
def chat(self, query): @track_performance("LLM")
def process_llm_response(self, query: str) -> bool:
# 如果设备未验证,就发送验证码 # 如果设备未验证,就发送验证码
if self.isNeedAuth(): if self.isNeedAuth():
self.llm_finish_task = True self.llm_finish_task = True
@ -335,4 +337,4 @@ class ConnectionHandler:
while self.scheduled_tasks: while self.scheduled_tasks:
task = self.scheduled_tasks.popleft() task = self.scheduled_tasks.popleft()
task.cancel() task.cancel()
self.scheduled_tasks.clear() self.scheduled_tasks.clear()