fix: 智能体唤醒后消息发送问题

This commit is contained in:
jxxghp
2026-04-02 19:23:40 +08:00
parent 1f526adbe7
commit 244112be5c
2 changed files with 40 additions and 36 deletions
+6 -2
View File
@@ -384,12 +384,16 @@ class MoviePilotAgent:
""" """
通过原渠道发送消息给用户 通过原渠道发送消息给用户
""" """
user_id = self.user_id
if self.user_id == "system":
user_id = None
await AgentChain().async_post_message( await AgentChain().async_post_message(
Notification( Notification(
channel=self.channel, channel=self.channel,
source=self.source, source=self.source,
mtype=NotificationType.Agent, mtype=NotificationType.Agent,
userid=self.user_id, userid=user_id,
username=self.username, username=self.username,
title=title, title=title,
text=message, text=message,
@@ -632,7 +636,7 @@ class AgentManager:
try: try:
# 每次使用唯一的 session_id,避免共享上下文 # 每次使用唯一的 session_id,避免共享上下文
session_id = f"__agent_heartbeat_{uuid.uuid4().hex[:12]}__" session_id = f"__agent_heartbeat_{uuid.uuid4().hex[:12]}__"
user_id = settings.SUPERUSER user_id = "system"
logger.info("智能体心跳唤醒:开始检查待处理任务...") logger.info("智能体心跳唤醒:开始检查待处理任务...")
+1 -1
View File
@@ -580,7 +580,7 @@ class MessageChain(ChainBase):
total = len(cache_list) total = len(cache_list)
# 加一页 # 加一页
cache_list = cache_list[ cache_list = cache_list[
(_current_page + 1) * self._page_size : (_current_page + 2) (_current_page + 1) * self._page_size: (_current_page + 2)
* self._page_size * self._page_size
] ]
if not cache_list: if not cache_list: