#!/usr/bin/env python3 """把 src/page.html 包成完整的 index.html(Hugging Face 静态 Space 直接使用)。 python tools/build.py """ from pathlib import Path ROOT = Path(__file__).resolve().parent.parent body = (ROOT / "src/page.html").read_text(encoding="utf-8") head_end = body.index("") + len("") head, rest = body[:head_end], body[head_end:] html = f""" {head} {rest} """ (ROOT / "index.html").write_text(html, encoding="utf-8") print("写出 index.html")