feat(inference): 接通真实 LLM 引擎工厂(P5-T10 门禁接线)

- 新增 inference/factory.build_inference_engine:读 GENESIS_INFERENCE__* / 裸
  DEEPSEEK_API_KEY·LLM_BASE_URL 环境变量与 .env,构造 HttpLLMClient + InferenceEngine
- orchestrator/qa_loop 的 engine=None 分支改用工厂,真正接通真实 LLM 路径
- 脚本注入校验改为通用(非空段落数 + 残留占位符),适配真实模式
- 补工厂测试(缺密钥/前缀变量/裸变量/默认值/.env 解析),覆盖率 99.04%
This commit is contained in:
lhl
2026-08-13 23:11:31 +08:00
parent e4f533799d
commit 958e2602cc
5 changed files with 197 additions and 7 deletions
+6 -3
View File
@@ -65,11 +65,14 @@ def _main() -> None:
template_path=args.template,
)
loaded = Document(args.output)
joined = "\n".join(p.text for p in loaded.paragraphs)
non_empty = [p.text for p in loaded.paragraphs if p.text.strip()]
remaining = sum(1 for p in loaded.paragraphs if "{{" in p.text)
print(f"[slice] 生成章节数: {len(contents)}")
print(f"[slice] 输出路径: {args.output}")
print(f"[slice] 注入校验: {'OK' if any('自动生成' in p.text for p in loaded.paragraphs) else 'EMPTY'}")
print(f"[slice] 文本内容预览:\n{joined[:200]}")
print(f"[slice] 注入校验: {'OK' if non_empty and remaining == 0 else 'CHECK'}")
print(f"[slice] 非空段落数: {len(non_empty)}; 残留占位符: {remaining}")
preview = "\n".join(non_empty[:5])
print(f"[slice] 文本内容预览:\n{preview[:400]}")
if __name__ == "__main__":