fix(scope-b): 修评审 4 HIGH + 同步 T6 工具数(15)
1. T6 e2e 工具数同步:list 断言 11→15(含 continue/expand/de-ai/teardown), 测试名 ...eleven→fifteen;保留 legacy/ingestable 意图。 2. teardown 书名(body.kind)前置入原文 → 进 text_input context(拆书 prompt 期待书名)。 3. text_input 工具(扩写/降AI/拆书)空原文 → 422 VALIDATION,不让 LLM 空跑。 4. 链 UI:busy 守卫加 awaiting,裁决期间禁止重复发起链。 测试:扩 teardown 断言书名入 context + 新增 expand 空原文 422;后端 642 passed, 前端 294 passed,两门禁全绿。
This commit is contained in:
@@ -192,6 +192,7 @@ async def generate_with_tool(
|
||||
world_context = ""
|
||||
beats: list[str] = []
|
||||
prior_text = ""
|
||||
text = body.text or ""
|
||||
if tool.context_strategy == "with_world":
|
||||
world_context = await _world_context(memory, project_id)
|
||||
elif tool.context_strategy == "with_outline_chapter":
|
||||
@@ -202,6 +203,18 @@ async def generate_with_tool(
|
||||
chapter_no = body.chapter_no or 1
|
||||
prior_text = await _prior_chapter_text(chapter_repo, project_id, chapter_no)
|
||||
beats = await _chapter_beats(outline_repo, project_id, chapter_no)
|
||||
elif tool.context_strategy == "text_input":
|
||||
# text_input 工具(扩写/降AI/拆书)必须有原文样本——空原文会让 LLM 空跑(守输入校验纪律)。
|
||||
if not text.strip():
|
||||
raise AppError(
|
||||
ErrorCode.VALIDATION,
|
||||
f"工具 {tool_key} 需要原文输入(text 不可为空)",
|
||||
{"tool_key": tool_key},
|
||||
)
|
||||
# 拆书的书名(body.kind)前置入原文,供拆解对照(teardown system prompt 期待书名)。
|
||||
kind = (body.kind or "").strip()
|
||||
if kind:
|
||||
text = f"书名:{kind}\n\n{text}"
|
||||
|
||||
context = build_toolbox_context(
|
||||
tool.context_strategy,
|
||||
@@ -211,7 +224,7 @@ async def generate_with_tool(
|
||||
chapter_no=body.chapter_no,
|
||||
beats=beats,
|
||||
prior_text=prior_text,
|
||||
text=body.text or "",
|
||||
text=text,
|
||||
)
|
||||
|
||||
gateway = await build_gateway(spec.tier)
|
||||
|
||||
Reference in New Issue
Block a user