Files
MoviePilot/tests/test_agent_progress_updates.py
T
jxxghp 240a4dffe6 refactor(schemas): 统一 message/notification 命名边界,旧名收敛至兼容映射表
- notification 域:渠道能力(MessageChannel→NotificationChannel、ChannelCapability* 迁入 notification.py)
- message 域:消息收发(Notification→Message、NotificationType→MessageType、CommingMessage→IncomingMessage、NotificationHistoryItem→MessageHistoryItem、NotificationClear*→MessageClear*)
- Agent 工具契约:send_notification_message→send_message、notification_callback→message_callback
- 源码不保留旧名物理别名,旧导入经 app/runtime/compat/manifest.py SYMBOL_ALIASES 惰性解析
- API 路径与持久化键冻结不变,前端零改动
- 新增兼容守护测试与 docs/rules/07 命名边界规范
2026-08-16 19:32:20 +08:00

36 lines
1.9 KiB
Python

from unittest.mock import patch
from app.agent.prompt import prompt_manager
from app.runtime.config import settings
from app.schemas.types import NotificationChannel
def test_progress_prompt_is_independent_from_tool_display_mode() -> None:
"""进度沟通规则不应随工具逐条或汇总展示模式变化。"""
with patch.object(settings, "AI_AGENT_VERBOSE", False):
summary_mode_prompt = prompt_manager.get_agent_prompt(
channel=NotificationChannel.WebAgent.value
)
with patch.object(settings, "AI_AGENT_VERBOSE", True):
verbose_mode_prompt = prompt_manager.get_agent_prompt(
channel=NotificationChannel.WebAgent.value
)
assert summary_mode_prompt == verbose_mode_prompt
assert "meaningful changes in understanding or execution" in summary_mode_prompt
assert "not on elapsed time or the number of tool calls" in summary_mode_prompt
assert "one or two tools have finished" in summary_mode_prompt
assert "useful preliminary conclusion" in summary_mode_prompt
assert "materially changes the working direction" in summary_mode_prompt
assert "sustained blocker the user should know about" in summary_mode_prompt
assert "including the key evidence and what you will do next" in summary_mode_prompt
assert "brevity is not a goal by itself" in summary_mode_prompt
assert "do not repeat an unchanged status" in summary_mode_prompt.lower()
assert "Continue working after each update" in summary_mode_prompt
assert "The final reply must be self-contained" in summary_mode_prompt
assert "before the first tool call" not in summary_mode_prompt
assert "approximately every 30 to 60 seconds" not in summary_mode_prompt
assert "one or two short sentences" not in summary_mode_prompt
assert "remain completely silent" not in summary_mode_prompt
assert "DO NOT output any intermediate content" not in summary_mode_prompt