fix:修改工具调用问题
This commit is contained in:
@@ -844,13 +844,6 @@ class Heartflow:
|
||||
"""当主状态变为 OFFLINE 时,停止所有子心流的活动并设置为 ABSENT"""
|
||||
logger.info("[Heartflow Deactivate] 开始停用所有子心流...")
|
||||
try:
|
||||
# TODO: Ensure controller.stop_heartFC_chat is called if needed
|
||||
# This is now handled by subheartflow.set_chat_state(ChatState.ABSENT) called in _stop_subheartflow
|
||||
# from src.plugins.heartFC_chat.heartFC_controler import HeartFCController # Local import to avoid cycle
|
||||
# controller = HeartFCController.get_instance()
|
||||
# if controller and controller.is_heartFC_chat_active(flow_id):
|
||||
# await controller.stop_heartFC_chat(flow_id)
|
||||
|
||||
# 使用 ID 快照进行迭代
|
||||
flow_ids_snapshot = list(self._subheartflows.keys())
|
||||
deactivated_count = 0
|
||||
@@ -863,13 +856,6 @@ class Heartflow:
|
||||
stream_name = chat_manager.get_stream_name(flow_id) or flow_id
|
||||
|
||||
try:
|
||||
# 停止相关聊天进程 (例如 pf_chat)
|
||||
# TODO: 确认是否有 reason_chat 需要停止,并添加相应逻辑
|
||||
# if controller:
|
||||
# if controller.is_heartFC_chat_active(flow_id):
|
||||
# logger.debug(f"[Heartflow Deactivate] 正在停止子心流 {stream_name} 的 heartFC_chat。")
|
||||
# await controller.stop_heartFC_chat(flow_id)
|
||||
|
||||
# 设置状态为 ABSENT
|
||||
if subflow.chat_state.chat_status != ChatState.ABSENT:
|
||||
logger.debug(f"[Heartflow Deactivate] 正在将子心流 {stream_name} 状态设置为 ABSENT。")
|
||||
|
||||
@@ -95,7 +95,7 @@ class HeartFChatting:
|
||||
# 基础属性
|
||||
self.stream_id: str = chat_id # 聊天流ID
|
||||
self.chat_stream: Optional[ChatStream] = None # 关联的聊天流
|
||||
self.sub_hf: Optional[SubHeartflow] = None # 关联的子心流
|
||||
self.sub_hf: SubHeartflow = None # 关联的子心流
|
||||
|
||||
# 初始化状态控制
|
||||
self._initialized = False # 是否已初始化标志
|
||||
@@ -510,7 +510,11 @@ class HeartFChatting:
|
||||
# --- (Moved from _replier_work) 1. 思考前使用工具 --- #
|
||||
try:
|
||||
# Access tool_user directly
|
||||
tool_result = await self.tool_user.use_tool(message_txt=observed_messages_str, sub_heartflow=self.sub_hf)
|
||||
tool_result = await self.tool_user.use_tool(
|
||||
message_txt=observed_messages_str,
|
||||
chat_stream=self.chat_stream,
|
||||
observation=self.sub_hf._get_primary_observation(),
|
||||
)
|
||||
if tool_result.get("used_tools", False):
|
||||
tool_result_info = tool_result.get("structured_info", {})
|
||||
logger.debug(f"{log_prefix}[Planner] 规划前工具结果: {tool_result_info}")
|
||||
|
||||
Reference in New Issue
Block a user