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
+2 -2
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
from pathlib import Path
from genesis.inference.engine import InferenceEngine
from genesis.inference.factory import build_inference_engine
from genesis.inference.prompt_registry import PromptRegistry
from genesis.qa.guardrails import DEFAULT_MAX_QA_ROUNDS, QALoopController
from genesis.qa.report import QAReport
@@ -47,7 +47,7 @@ class QALoop:
return [contents_map[cid] for cid in order]
def run(self, structured_source, output_path, session_id="writer", samples_dir="samples", engine=None, prompt_registry=None, template_path=None) -> QAReport:
engine = engine or InferenceEngine()
engine = engine or build_inference_engine()
prompt_registry = prompt_registry or PromptRegistry()
validator = QAValidator()
contents = self._build(structured_source, samples_dir, engine, prompt_registry, template_path, output_path, session_id)