mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
feat(agent): mark and propagate voice input metadata in agent messages; clarify terminal tool usage in prompts
- Add `has_audio_input` flag to agent message handling and propagate through processing pipeline - Structure agent input payloads to include `input.mode` and `input.transcribed` for voice messages - Update prompts and tool descriptions to clarify that `send_voice_message` and `ask_user_choice` are terminal tools and should not be followed by redundant text replies - Enhance tests to cover voice input metadata propagation and prompt updates
This commit is contained in:
@@ -244,6 +244,24 @@ class TestAgentPromptStyle(unittest.TestCase):
|
||||
prompt,
|
||||
)
|
||||
|
||||
def test_voice_prompt_marks_voice_tool_as_terminal_reply(self):
|
||||
"""语音回复提示词应说明语音工具会结束当前轮次。"""
|
||||
with patch.object(settings, "LLM_SUPPORT_AUDIO_OUTPUT", True):
|
||||
prompt = prompt_manager.get_agent_prompt()
|
||||
|
||||
self.assertIn("send_voice_message", prompt)
|
||||
self.assertIn("terminal response tool", prompt)
|
||||
self.assertIn("do not write a final text reply after it", prompt)
|
||||
self.assertIn("text fallback and still completes the reply", prompt)
|
||||
|
||||
def test_core_prompt_describes_voice_input_metadata(self):
|
||||
"""核心提示词应说明结构化消息中的语音输入元信息。"""
|
||||
prompt = prompt_manager.get_agent_prompt()
|
||||
|
||||
self.assertIn("input.mode", prompt)
|
||||
self.assertIn("voice", prompt)
|
||||
self.assertIn("`message` contains its transcript", prompt)
|
||||
|
||||
def test_verbose_prompt_does_not_inject_silence_until_tools_finish_rule(self):
|
||||
with patch.object(settings, "AI_AGENT_VERBOSE", True):
|
||||
prompt = prompt_manager.get_agent_prompt()
|
||||
|
||||
Reference in New Issue
Block a user