Ensure batch AI redo returns plain text

This commit is contained in:
jxxghp
2026-06-06 07:37:42 +08:00
parent a0b3800f6b
commit bf98e4c954
2 changed files with 44 additions and 0 deletions

View File

@@ -124,6 +124,8 @@ task_types:
- "When several records obviously share the same media identity, avoid repeated `recognize_media` or `search_media` calls."
- "Process every selected record exactly once."
- "Keep the final response short and focused on the aggregate outcome."
- "Final response must be plain text only: one concise Chinese sentence or paragraph describing the aggregate result."
- "Do NOT include any title/header, bullet list, numbered list, bold text, code block, table, or other Markdown formatting."
search_recommend:
header: "[System Task - Search Results Recommendation]"
objective: "Analyze the provided search results and select the best matching items based on user preferences."

View File

@@ -0,0 +1,42 @@
from types import SimpleNamespace
from app.agent.prompt import prompt_manager
from app.api.endpoints.history import build_batch_manual_redo_prompt
def test_batch_manual_redo_prompt_requires_plain_text_result():
"""批量 AI 重新整理提示词应要求最终回复只输出纯文本描述。"""
history = SimpleNamespace(
id=7,
src_fileitem={"path": "/downloads/a.mkv"},
src="",
seasons="",
episodes="",
status=False,
title="示例",
type="电影",
category="电影",
year="2024",
src_storage="local",
dest="/media/a.mkv",
dest_storage="local",
mode="copy",
tmdbid=123,
doubanid=None,
errmsg="识别失败",
)
prompt = build_batch_manual_redo_prompt([history])
assert "Final response must be plain text only" in prompt
assert "Do NOT include any title/header, bullet list" in prompt
assert "Markdown formatting" in prompt
def test_batch_manual_redo_job_definition_contains_plain_text_rules():
"""批量 AI 重新整理任务定义应直接声明纯文本最终回复规则。"""
definition = prompt_manager.load_system_tasks_definition()
task_rules = definition.task_types["batch_manual_transfer_redo"].task_rules
assert any("plain text only" in rule for rule in task_rules)
assert any("Markdown formatting" in rule for rule in task_rules)