feat(distribution_manager): 在处理成功后添加短暂等待,确保清理操作完成

feat(message_manager): 简化清除未读消息逻辑,移除冗余注释
feat(action_manager): 移除自动清空未读消息的逻辑,改为手动处理
feat(plan_executor): 扩展回复类动作的分类,包含 respond 动作
This commit is contained in:
Windpicker-owo
2025-11-10 21:38:55 +08:00
parent c46df81bca
commit f3af3caf71
5 changed files with 16 additions and 86 deletions

View File

@@ -215,9 +215,6 @@ class ChatterActionManager:
action_name="no_reply",
)
# 自动清空所有未读消息(改为同步等待)
await self._clear_all_unread_messages(chat_stream.stream_id, "no_reply")
return {"action_type": "no_reply", "success": True, "reply_text": "", "command": ""}
elif action_name != "reply" and action_name != "respond" and action_name != "no_action":
@@ -235,9 +232,6 @@ class ChatterActionManager:
# 记录执行的动作到目标消息(改为同步等待)
if success:
await self._record_action_to_message(chat_stream, action_name, target_message, action_data)
# 自动清空所有未读消息
if clear_unread_messages:
await self._clear_all_unread_messages(chat_stream.stream_id, action_name)
# 重置打断计数
await self._reset_interruption_count_after_action(chat_stream.stream_id)
@@ -322,9 +316,6 @@ class ChatterActionManager:
# 记录回复动作到目标消息
await self._record_action_to_message(chat_stream, action_name, target_message, action_data)
if clear_unread_messages:
await self._clear_all_unread_messages(chat_stream.stream_id, action_name)
# 回复成功,重置打断计数(改为同步等待)
await self._reset_interruption_count_after_action(chat_stream.stream_id)
@@ -401,24 +392,6 @@ class ChatterActionManager:
except Exception as e:
logger.warning(f"重置打断计数时出错: {e}")
async def _clear_all_unread_messages(self, stream_id: str, action_name: str):
"""在动作执行成功后自动清空所有未读消息
Args:
stream_id: 聊天流ID
action_name: 动作名称
"""
try:
from src.chat.message_manager.message_manager import message_manager
# 清空所有未读消息
await message_manager.clear_all_unread_messages(stream_id)
logger.debug(f"[{action_name}] 已自动清空聊天流 {stream_id} 的所有未读消息")
except Exception as e:
logger.error(f"[{action_name}] 自动清空未读消息时出错: {e}")
# 不抛出异常,避免影响主要功能
async def _handle_action(
self, chat_stream, action, reasoning, action_data, cycle_timers, thinking_id, action_message
) -> tuple[bool, str, str]: