Refine agent background reply handling

This commit is contained in:
jxxghp
2026-04-30 00:25:23 +08:00
parent 11478faff3
commit 6532c60a3c
8 changed files with 128 additions and 50 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ from pathlib import Path
from typing import Any, Optional, Dict, Union, List
from urllib.parse import unquote, urlparse
from app.agent import agent_manager, prompt_manager
from app.agent import ReplyMode, agent_manager, prompt_manager
from app.chain import ChainBase
from app.chain.interaction import (
MediaInteractionChain,
@@ -635,7 +635,7 @@ class MessageChain(ChainBase):
message=redo_prompt,
session_prefix=f"__agent_manual_redo_{history_id}",
output_callback=_capture_output,
suppress_user_reply=True,
reply_mode=ReplyMode.CAPTURE_ONLY,
)
await self.async_post_message(
Notification(
+2 -2
View File
@@ -210,7 +210,7 @@ class SearchChain(ChainBase):
"""
通过统一后台提示词机制执行资源推荐。
"""
from app.agent import agent_manager
from app.agent import ReplyMode, agent_manager
from app.agent.prompt import prompt_manager
prompt = prompt_manager.render_system_task_message(
@@ -226,7 +226,7 @@ class SearchChain(ChainBase):
message=prompt,
session_prefix="__agent_search_recommend",
output_callback=on_output,
suppress_user_reply=True,
reply_mode=ReplyMode.CAPTURE_ONLY,
persist_output_message=False,
allow_message_tools=False,
)
+2 -1
View File
@@ -8,7 +8,7 @@ from pathlib import Path
from typing import List, Optional, Tuple, Union, Dict, Callable
from app import schemas
from app.agent import prompt_manager, agent_manager
from app.agent import ReplyMode, prompt_manager, agent_manager
from app.chain import ChainBase
from app.chain.media import MediaChain
from app.chain.storage import StorageChain
@@ -688,6 +688,7 @@ class FailedRetryScheduler:
await agent_manager.run_background_prompt(
message=self._build_retry_transfer_prompt(history_ids),
session_prefix="__agent_retry_transfer_batch",
reply_mode=ReplyMode.DISPATCH,
)
logger.info(
f"智能体重试整理:批量处理完成 IDs=[{ids_str}] (group={group_key})"