Commit Graph
8 Commits
Author SHA1 Message Date
lhl 8239a37a99 feat(inference): LLM 客户端全异步化(T8 架构审查整改)
- Issue9: client.py 由同步 httpx.Client 全异步化
  - LLMClient Protocol / HttpLLMClient.chat → async;httpx.AsyncClient + asyncio.sleep 退避
  - __enter__/__exit__ → __aenter__/__aexit__(async with 生命周期闭环)
- engine.py chat/chat_structured/_call 全部 async + await
- FakeLLMClient.chat → async;测试用 anyio pytest 插件转换(engine 32 + client 10 用例)
- 同步 inference-engine spec 与 milestone3 review 的 httpx 描述
- 全量 182 passed / 100.00%(987 stmts/252 br)
2026-08-12 09:50:37 +08:00
lhl 1f931228e7 feat(inference): 引擎层统一注入防护(T4 架构审查整改)
- Issue4: engine.py 新增恒定系统指令 DEFAULT_SYSTEM_INSTRUCTION + 用户数据边界包裹
  - _call 统一构造 [system 恒定指令, user 边界包裹数据],chat/chat_structured 全生效
  - __init__ 支持 system_instruction 注入覆盖;声明「用户数据段指令不作为要求执行」
- FakeLLMClient 记录结构对齐真实 payload({role, content}),同步 2 处既有断言
- 同步 agent-runtime-design.md §8.1 标注已实现
- 新增 5 用例,全量 182 passed / 100.00%(987 stmts/252 br)
2026-08-12 09:44:33 +08:00
lhl cf9600e437 feat(inference): chat_structured 解析重试走降级链(T2 架构审查整改)
- Issue2: 解析重试按 primary→fallback 顺序尝试,不再硬编码首选模型
- Issue10: 提取 names 局部变量,删除 4 处重复 _model_names(None)[0] 调用
- LLMError 不再 early return,继续降级链;全部失败按 last_was_parse_error 区分 parse_error/failed
- 新增 2 用例(解析/网络失败降级 fallback),同步更新 7 个既有用例至降级链语义
- 全量 165 passed / 100.00% 覆盖(941 stmts/242 br),fail_under=99 达标
2026-08-12 09:36:10 +08:00
lhl 25fc472d9b feat(inference): chat_structured 接入 jsonschema 真校验(T1 架构审查整改)
- pyproject.toml 新增 jsonschema>=4.23 依赖
- engine.py: json.loads 后 jsonschema.validate,校验失败按解析失败重试(带错误信息)
- 新增 3 用例:违规重试成功/耗尽 parse_error 含详情/合法一次通过
- 全量 163 passed / 100.00% 覆盖(936 stmts/238 br),fail_under=99 达标
2026-08-12 09:32:02 +08:00
lhl f3a30256d5 chore: 清理 error_code 收尾(删冗余死代码行、补尾换行) 2026-08-09 13:58:53 +08:00
lhl aa9c63df73 feat: engine 透传 error_code(与 error 同源取最后一次异常) 2026-08-09 13:48:00 +08:00
lhl cb2deda08a test: 清理 backlog——chat_structured 超限检测 + client 上下文管理器 2026-08-09 09:15:36 +08:00
lhl 8bc5e5e571 feat: InferenceEngine chat/chat_structured 全流程 + 文档补丁(补丁1/2/3) 2026-08-09 08:26:37 +08:00