#!/bin/bash
#
# 根据 comparison_report.json 自动生成 Markdown 评测报告
#
# 用法:
#   bash eval_tools/model_comparison/gen_report.sh <comparison_report.json>
#   bash eval_tools/model_comparison/gen_report.sh <comparison_report.json> [--output <输出路径>] [--title "标题"] [--background "背景说明"] [--date YYYY-MM-DD]
#
# 示例:
#   bash eval_tools/model_comparison/gen_report.sh \
#       evaluation_results/eval_results_.../comparison_common_matches_.../comparison_report.json
#
#   bash eval_tools/model_comparison/gen_report.sh \
#       evaluation_results/.../comparison_report.json \
#       --output my_report.md \
#       --title "ROI0 模型对比报告"

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
export PYTHONPATH="${PROJECT_ROOT}:${PYTHONPATH}"

if [ $# -eq 0 ]; then
    echo "用法: bash $0 <comparison_report.json> [选项...]"
    echo ""
    echo "选项:"
    echo "  --output/-o <路径>      输出 Markdown 文件路径（默认：JSON 同目录下的 COMPARISON_REPORT.md）"
    echo "  --title <标题>          自定义报告标题"
    echo "  --background <说明>     背景说明文字"
    echo "  --date <YYYY-MM-DD>     评测日期（默认：今天）"
    exit 1
fi

python "${SCRIPT_DIR}/generate_comparison_report.py" "$@"
