update: 表情由llm发送,长文本进行约束

This commit is contained in:
Sakura-RanChen
2025-07-21 09:30:23 +08:00
parent 7c440f47b6
commit eead126f7a
7 changed files with 115 additions and 597 deletions
+11 -1
View File
@@ -39,7 +39,7 @@ from config.logger import setup_logging, build_module_string, create_connection_
from config.manage_api_client import DeviceNotFoundException, DeviceBindException
from core.utils.prompt_manager import PromptManager
from core.utils.voiceprint_provider import VoiceprintProvider
from core.utils import textUtils
TAG = __name__
@@ -713,6 +713,7 @@ class ConnectionHandler:
function_arguments = ""
content_arguments = ""
self.client_abort = False
emotion_flag = True
for response in llm_responses:
if self.client_abort:
break
@@ -738,6 +739,15 @@ class ConnectionHandler:
function_arguments += tools_call[0].function.arguments
else:
content = response
# 在llm回复中获取情绪表情,一轮对话只在开头获取一次
if emotion_flag:
asyncio.run_coroutine_threadsafe(
textUtils.get_emotion(self, content),
self.loop,
)
emotion_flag = False
if content is not None and len(content) > 0:
if not tool_call_flag:
response_message.append(content)