fix(agent): decouple progress prompt from tool display

This commit is contained in:
jxxghp
2026-08-07 07:17:27 +08:00
parent 6d3161f3cb
commit b80642f56f
3 changed files with 29 additions and 31 deletions

View File

@@ -5,19 +5,27 @@ from app.core.config import settings
from app.schemas.types import MessageChannel
def test_non_verbose_prompt_keeps_long_running_tasks_user_visible() -> None:
"""非详细模式下的长任务仍应主动向用户提供阶段性进度"""
def test_progress_prompt_is_independent_from_tool_display_mode() -> None:
"""进度沟通规则不应随工具逐条或汇总展示模式变化"""
with patch.object(settings, "AI_AGENT_VERBOSE", False):
prompt = prompt_manager.get_agent_prompt(
summary_mode_prompt = prompt_manager.get_agent_prompt(
channel=MessageChannel.WebAgent.value
)
with patch.object(settings, "AI_AGENT_VERBOSE", True):
verbose_mode_prompt = prompt_manager.get_agent_prompt(
channel=MessageChannel.WebAgent.value
)
assert "before the first tool call" in prompt
assert "after a meaningful milestone or several tool calls" in prompt
assert "approximately every 30 to 60 seconds whenever you regain control" in prompt
assert "one or two short sentences" in prompt
assert "do not repeat an unchanged status" in prompt
assert "Continue working after each update" in prompt
assert "The final reply must be self-contained" in prompt
assert "remain completely silent" not in prompt
assert "DO NOT output any intermediate content" not in prompt
assert summary_mode_prompt == verbose_mode_prompt
assert "before the first tool call" in summary_mode_prompt
assert "after a meaningful milestone or several tool calls" in summary_mode_prompt
assert (
"approximately every 30 to 60 seconds whenever you regain control"
in summary_mode_prompt
)
assert "one or two short sentences" in summary_mode_prompt
assert "do not repeat an unchanged status" in summary_mode_prompt
assert "Continue working after each update" in summary_mode_prompt
assert "The final reply must be self-contained" 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