mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-11 00:25:36 +08:00
fix(agent): decouple progress prompt from tool display
This commit is contained in:
@@ -85,7 +85,15 @@ You act as a proactive agent. Your goal is to fully resolve the user's media-rel
|
||||
</agent_core>
|
||||
|
||||
<communication_runtime>
|
||||
{verbose_spec}
|
||||
<progress_updates>
|
||||
- Use a concise Codex-style progress cadence.
|
||||
- For a quick single-step tool call, call the tool directly without a filler acknowledgement.
|
||||
- For multi-step work or any task that may take noticeable time, send one brief user-facing progress update before the first tool call.
|
||||
- While work continues, send another update after a meaningful milestone or several tool calls, and approximately every 30 to 60 seconds whenever you regain control.
|
||||
- Keep each update to one or two short sentences that state what you are doing, what you have learned, and what comes next when those details are useful.
|
||||
- Vary the wording and do not repeat an unchanged status. Do not expose hidden reasoning, raw tool arguments, or repetitive per-tool narration.
|
||||
- Continue working after each update. The final reply must be self-contained and summarize the outcome without relying on the user having read the progress updates.
|
||||
</progress_updates>
|
||||
|
||||
- Channel-aware formatting: Follow the capability rules below for Markdown, plain text, buttons, and voice replies.
|
||||
{button_choice_spec}
|
||||
|
||||
@@ -140,23 +140,6 @@ class PromptManager:
|
||||
markdown_spec = self._generate_formatting_instructions(caps)
|
||||
button_choice_spec = self._generate_button_choice_instructions(msg_channel)
|
||||
|
||||
# 啰嗦模式
|
||||
verbose_spec = ""
|
||||
if not settings.AI_AGENT_VERBOSE:
|
||||
verbose_spec = (
|
||||
"\n\n[Important Instruction] STRICTLY ENFORCED: "
|
||||
"Use a concise Codex-style progress cadence. "
|
||||
"For a quick single-step tool call, call the tool directly without a filler acknowledgement. "
|
||||
"For multi-step work or any task that may take noticeable time, send one brief user-facing progress update "
|
||||
"before the first tool call. While work continues, send another update after a meaningful milestone or "
|
||||
"several tool calls, and approximately every 30 to 60 seconds whenever you regain control. "
|
||||
"Keep each update to one or two short sentences that state what you are doing, what you have learned, "
|
||||
"and what comes next when those details are useful. Vary the wording and do not repeat an unchanged status. "
|
||||
"Do not expose hidden reasoning, raw tool arguments, or repetitive per-tool narration. "
|
||||
"Continue working after each update. The final reply must be self-contained and summarize the outcome "
|
||||
"without relying on the user having read the progress updates."
|
||||
)
|
||||
|
||||
# MoviePilot系统信息
|
||||
moviepilot_info = self._get_moviepilot_info()
|
||||
voice_reply_spec = self._generate_voice_reply_instructions()
|
||||
@@ -164,7 +147,6 @@ class PromptManager:
|
||||
# 始终替换占位符,避免后续 .format() 时因残留花括号报 KeyError
|
||||
base_prompt = base_prompt.format(
|
||||
markdown_spec=markdown_spec,
|
||||
verbose_spec=verbose_spec,
|
||||
moviepilot_info=moviepilot_info,
|
||||
voice_reply_spec=voice_reply_spec,
|
||||
button_choice_spec=button_choice_spec,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user