fix:已经使用了intent_llm,不应该再回到functioncall的chat中

This commit is contained in:
hrz
2025-03-28 17:17:14 +08:00
parent 05356b6652
commit 17126303fa
5 changed files with 136 additions and 358 deletions
@@ -91,11 +91,18 @@ async def process_intent_result(conn, intent_result, original_text):
def process_function_call():
conn.dialogue.put(Message(role="user", content=original_text))
result = conn.func_handler.handle_llm_function_call(conn, function_call_data)
if result:
if result and function_name != 'play_music':
# 获取当前最新的文本索引
text_index = conn.tts_last_text_index + 1 if hasattr(conn, 'tts_last_text_index') else 0
# 处理函数调用结果
conn._handle_function_result(result, function_call_data, text_index)
text = result.response
if text is None:
text = result.result
if text is not None:
text_index = conn.tts_last_text_index + 1 if hasattr(conn, 'tts_last_text_index') else 0
conn.recode_first_last_text(text, text_index)
future = conn.executor.submit(conn.speak_and_play, text, text_index)
conn.llm_finish_task = True
conn.tts_queue.put(future)
conn.dialogue.put(Message(role="assistant", content=text))
# 将函数执行放在线程池中
conn.executor.submit(process_function_call)