Class: RubyLLM::Tribunal::Reporters::HTML

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/tribunal/reporters/html.rb

Overview

HTML report for shareable results.

Class Method Summary collapse

Class Method Details

.format(results) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ruby_llm/tribunal/reporters/html.rb', line 9

def format(results)
  "    <!DOCTYPE html>\n    <html lang=\"en\">\n    <head>\n      <meta charset=\"UTF-8\">\n      <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n      <title>Tribunal Evaluation Report</title>\n      <style>\n        * { box-sizing: border-box; margin: 0; padding: 0; }\n        body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; padding: 2rem; background: #f5f5f5; }\n        .container { max-width: 900px; margin: 0 auto; }\n        h1 { color: #333; margin-bottom: 1.5rem; }\n        .summary { background: white; border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }\n        .summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }\n        .stat { text-align: center; }\n        .stat-value { font-size: 2rem; font-weight: bold; color: #333; }\n        .stat-label { color: #666; font-size: 0.9rem; }\n        .status { padding: 0.5rem 1rem; border-radius: 4px; display: inline-block; font-weight: bold; margin-top: 1rem; }\n        .status.passed { background: #d4edda; color: #155724; }\n        .status.failed { background: #f8d7da; color: #721c24; }\n        .metrics { background: white; border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }\n        .metrics h2 { margin-bottom: 1rem; color: #333; font-size: 1.2rem; }\n        .metric-row { display: flex; align-items: center; margin-bottom: 0.75rem; }\n        .metric-name { width: 120px; font-weight: 500; }\n        .metric-bar { flex: 1; height: 20px; background: #e9ecef; border-radius: 4px; overflow: hidden; margin: 0 1rem; }\n        .metric-fill { height: 100%; background: #28a745; transition: width 0.3s; }\n        .metric-fill.warning { background: #ffc107; }\n        .metric-fill.danger { background: #dc3545; }\n        .metric-value { width: 100px; text-align: right; font-size: 0.9rem; color: #666; }\n        .failures { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }\n        .failures h2 { margin-bottom: 1rem; color: #333; font-size: 1.2rem; }\n        .failure { background: #fff5f5; border-left: 4px solid #dc3545; padding: 1rem; margin-bottom: 1rem; border-radius: 0 4px 4px 0; }\n        .failure-input { font-weight: 500; color: #333; margin-bottom: 0.5rem; }\n        .failure-reason { color: #666; font-size: 0.9rem; }\n        .failure-reason code { background: #f1f1f1; padding: 0.2rem 0.4rem; border-radius: 3px; }\n        .footer { text-align: center; margin-top: 2rem; color: #666; font-size: 0.85rem; }\n      </style>\n    </head>\n    <body>\n      <div class=\"container\">\n        <h1>Tribunal Evaluation Report</h1>\n        \#{summary_section(results[:summary])}\n        \#{metrics_section(results[:metrics])}\n        \#{failures_section(results[:cases])}\n        <div class=\"footer\">Generated by Tribunal</div>\n      </div>\n    </body>\n    </html>\n  HTML\nend\n"