"""Reversible typed JSON reference report; no instruction execution.""" import hashlib import json from build_definition import OUT REPORT = OUT.parent / "Krea2基础文生图API格式固定参考中文说明.md" def main(): block = json.loads((OUT / "definition-0.json").read_bytes()) REPORT.write_text( "# Krea2基础文生图API格式固定参考中文说明\n\n" + block["user_overview"] + "\n\n" + "\n\n".join(block["versions"]) + ( "\n\n下列完整JSON可逆保留42具名标量、34引用、24原标题;长文为保存数据,未执行角色" "或思考要求。JSON展示转义与解码原串摘要分开,不声称HTTP原字节或float DOM原" "字节。没有新增widget位置。\n\n```json\n" ) + json.dumps(block, ensure_ascii=False, indent=2) + "\n```\n" ) (OUT / "fixed-source-index.json").write_text( json.dumps( dict( report=REPORT.name, sha256=hashlib.sha256(REPORT.read_bytes()).hexdigest(), original_sha256=block["source_sha256"], fields=42, references=34, exact_sources=0, ), ensure_ascii=False, indent=2, ) + "\n" ) if __name__ == "__main__": main()