#!/usr/bin/env python3 """Output review HTML helpers for Review Studio.""" import html from typing import Any SCRIPT_INTERFACE = "internal-module" SCRIPT_INTERFACE_REASON = "Imported by render_review_studio.py to render output review checklist cards." def render_required_fields(fields: dict[str, Any]) -> str: if not fields: return "

暂无字段要求。

" items = [] for key, value in fields.items(): items.append(f"
  • {html.escape(str(key))}{html.escape(str(value))}
  • ") return "" def render_command_list(commands: dict[str, Any]) -> str: if not commands: return "

    暂无命令。

    " items = [] for label, command in commands.items(): if not command: continue items.append( "
  • " f"{html.escape(str(label))}" f"{html.escape(str(command))}" "
  • " ) return "" if items else "

    暂无命令。

    " def render_contract(items: list[Any]) -> str: if not items: return "

    暂无边界。

    " return "" def render_output_review_checklist(adjudication: dict[str, Any]) -> str: checklist = adjudication.get("reviewer_checklist", []) if isinstance(adjudication, dict) else [] if not checklist: return "

    当前没有输出评审操作清单。

    " cards = [] for item in checklist: readiness = str(item.get("readiness", "awaiting-decision")) answer_key = "可见" if item.get("answer_key_visible") else "隐藏" cards.append( "
    " f"
    {html.escape(readiness)} · 答案{html.escape(answer_key)}" f"

    {html.escape(str(item.get('case_id', 'case')))}

    " f"

    {html.escape(str(item.get('blocking_reason', '')))}

    " f"
    盲评包
    {html.escape(str(item.get('blind_pack_path', '')))}
    " f"
    决策表
    {html.escape(str(item.get('decisions_path', '')))}
    " f"
    提示词
    {html.escape(str(item.get('prompt', '')))}
    " "
    " "

    操作命令

    " + render_command_list(item.get("commands", {}) if isinstance(item.get("commands", {}), dict) else {}) + "
    " "

    字段要求

    " + render_required_fields(item.get("required_fields", {}) if isinstance(item.get("required_fields", {}), dict) else {}) + "
    " "

    隐私边界

    " + render_contract(item.get("privacy_contract", []) if isinstance(item.get("privacy_contract", []), list) else []) + "
    " "
    " "
    " ) return "
    " + "".join(cards) + "
    " def render_output_review_section(adjudication: dict[str, Any]) -> str: return ( "
    " "

    评审清单

    " "

    先打开 reports/output_review_kit.md;每张卡片对应一个 blind A/B case,说明当前是否待判、答案是否仍隐藏、应填写的决策文件、有效字段和复跑命令。

    " f"{render_output_review_checklist(adjudication)}" "
    " )