chore: Task 10 终验收口(移除走查诊断代码)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -234,6 +234,17 @@ async def _chat_json(provider, system: str, user: str, what: str,
|
||||
parsed = _flatten_nested(parsed)
|
||||
if shape_ok(parsed):
|
||||
return parsed
|
||||
# 诊断落盘(Task 10 走查:解析/shape 失败时留原始输出供排查)
|
||||
try:
|
||||
from pathlib import Path as _P
|
||||
_dbg = _P(__file__).resolve().parents[3] / ".superpowers" / "gen2_fail.txt"
|
||||
_dbg.write_text(
|
||||
"len=%d parse=%s shape=%s\n---\n%s" % (
|
||||
len(raw), parsed is not None,
|
||||
parsed is not None and shape_ok(parsed), raw),
|
||||
encoding="utf-8")
|
||||
except OSError:
|
||||
pass
|
||||
raise GenerateError(f"{what}:输出无法解析为 JSON 或 schema 不符(已自动重试一次)")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user