import html from typing import Any from review_studio_gates import status_label SCRIPT_INTERFACE = "internal-module" SCRIPT_INTERFACE_REASON = "Imported by render_review_studio.py to keep small Review Studio panel renderers out of the main page composer." def render_gate_list(gates: list[dict[str, str]]) -> str: items = [] for item in gates: link_html = f"证据" if item.get("link") else "" items.append( "
" f"
{html.escape(status_label(item['status']))}

{html.escape(item['label'])}

" f"

{html.escape(item['detail'])}

" f"" "
" ) return "".join(items) def render_insights(cards: list[dict[str, str]]) -> str: return "".join( ( "
" f"{html.escape(item['label'])}" f"{html.escape(item['value'])}" f"

{html.escape(item['detail'])}

" "
" ) for item in cards ) def render_issue_list(title: str, items: list[dict[str, str]]) -> str: if not items: return f"

{html.escape(title)}

无。

" body = "".join( ( "
  • " f"{html.escape(item['label'])}" f"{html.escape(item['detail'])}" "
  • " ) for item in items ) return f"

    {html.escape(title)}

    " def render_review_annotations_panel(annotations_report: dict[str, Any]) -> str: annotations = annotations_report.get("annotations", []) if isinstance(annotations_report, dict) else [] if not annotations: return "

    当前没有 reviewer 批注。

    " cards = [] for item in annotations: line_suffix = f":{item['line']}" if item.get("line") else "" target_label = f"{item.get('target_path', '')}{line_suffix}" meta = " · ".join( part for part in [ str(item.get("gate_key", "")), str(item.get("reviewer", "")), str(item.get("created_at", "")), ] if part ) cards.append( "
    " f"
    {html.escape(str(item.get('severity', 'note')))} · {html.escape(str(item.get('status', 'open')))}" f"

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

    " f"

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

    " f"
    位置
    {html.escape(target_label)}
    " f"
    Gate
    {html.escape(str(item.get('gate_key', '')))}
    " f"
    建议
    {html.escape(str(item.get('suggested_action', '') or '无'))}
    " f"{html.escape(meta)}" f"" "
    " ) return "".join(cards)