@@ -1737,6 +1737,7 @@ $(function () {
17371737
17381738 // Pre-compute per-chapter data and find max values
17391739 var totalWords = 0 , totalTime = 0 , totalCalls = 0 , totalTokens = 0 ;
1740+ var totalErrors4xx = 0 , totalErrors5xx = 0 , totalTimeouts = 0 ;
17401741 var maxWords = 0 , maxTime = 0 ;
17411742 var rows = [ ] ;
17421743
@@ -1745,10 +1746,14 @@ $(function () {
17451746 var timeSec = ch . generation_time_seconds || 0 ;
17461747 var calls = ch . llm_calls || 0 ;
17471748 var tokens = ch . total_tokens || 0 ;
1749+ var err4 = ch . http_errors_4xx || 0 ;
1750+ var err5 = ch . http_errors_5xx || 0 ;
1751+ var errT = ch . timeout_errors || 0 ;
17481752 totalWords += words ; totalTime += timeSec ; totalCalls += calls ; totalTokens += tokens ;
1753+ totalErrors4xx += err4 ; totalErrors5xx += err5 ; totalTimeouts += errT ;
17491754 if ( words > maxWords ) maxWords = words ;
17501755 if ( timeSec > maxTime ) maxTime = timeSec ;
1751- rows . push ( { ch : ch , words : words , timeSec : timeSec , calls : calls , tokens : tokens } ) ;
1756+ rows . push ( { ch : ch , words : words , timeSec : timeSec , calls : calls , tokens : tokens , errors : err4 + err5 + errT } ) ;
17521757 } ) ;
17531758
17541759 $ . each ( rows , function ( _ , r ) {
@@ -1759,6 +1764,9 @@ $(function () {
17591764 var wordsBadge = ( r . words === maxWords && chapters . length > 1 ) ? ' <span class="nf-stat-badge nf-stat-badge-words">longest</span>' : "" ;
17601765 var timeBadge = ( r . timeSec === maxTime && maxTime > 0 && chapters . length > 1 ) ? ' <span class="nf-stat-badge nf-stat-badge-time">slowest</span>' : "" ;
17611766
1767+ var errorsStr = r . errors > 0 ? r . errors . toLocaleString ( ) : "-" ;
1768+ var errorsCls = r . errors > 0 ? ' class="text-end text-danger"' : ' class="text-end"' ;
1769+
17621770 $tbody . append (
17631771 "<tr>" +
17641772 "<td>" + escapeHtml ( r . ch . number ) + "</td>" +
@@ -1767,6 +1775,7 @@ $(function () {
17671775 '<td class="text-end">' + timeStr + timeBadge + "</td>" +
17681776 '<td class="text-end">' + callsStr + "</td>" +
17691777 '<td class="text-end">' + tokensStr + "</td>" +
1778+ "<td" + errorsCls + ">" + errorsStr + "</td>" +
17701779 "</tr>"
17711780 ) ;
17721781 } ) ;
@@ -1790,18 +1799,31 @@ $(function () {
17901799 if ( totalTokens > 0 ) {
17911800 summaryItems . push ( { label : "Total Tokens" , value : totalTokens . toLocaleString ( ) , icon : "bi-cpu" } ) ;
17921801 }
1802+ var totalLLMErrors = totalErrors4xx + totalErrors5xx + totalTimeouts ;
1803+ if ( totalLLMErrors > 0 ) {
1804+ var breakdown = [ ] ;
1805+ if ( totalErrors4xx > 0 ) breakdown . push ( totalErrors4xx + " 4xx" ) ;
1806+ if ( totalErrors5xx > 0 ) breakdown . push ( totalErrors5xx + " 5xx" ) ;
1807+ if ( totalTimeouts > 0 ) breakdown . push ( totalTimeouts + " timeout" ) ;
1808+ summaryItems . push ( { label : "LLM Errors" , value : totalLLMErrors . toLocaleString ( ) , icon : "bi-exclamation-triangle" , cls : "text-danger" , tooltip : breakdown . join ( ", " ) } ) ;
1809+ }
17931810
17941811 $ . each ( summaryItems , function ( _ , item ) {
1812+ var iconCls = item . cls || "text-primary" ;
1813+ var tooltipAttr = item . tooltip ? ' data-bs-toggle="tooltip" title="' + escapeHtml ( item . tooltip ) + '"' : "" ;
17951814 $summary . append (
17961815 '<div class="col-6 col-md-4 col-lg-2">' +
1797- '<div class="card text-center h-100">' +
1816+ '<div class="card text-center h-100"' + tooltipAttr + ' >' +
17981817 '<div class="card-body py-2 px-1">' +
1799- '<i class="bi ' + item . icon + ' text-primary mb-1 d-block"></i>' +
1800- '<div class="fw-bold">' + item . value + "</div>" +
1818+ '<i class="bi ' + item . icon + ' ' + iconCls + ' mb-1 d-block"></i>' +
1819+ '<div class="fw-bold ' + iconCls + ' ">' + item . value + "</div>" +
18011820 '<small class="text-muted">' + item . label + "</small>" +
18021821 "</div></div></div>"
18031822 ) ;
18041823 } ) ;
1824+ $summary . find ( '[data-bs-toggle="tooltip"]' ) . each ( function ( ) {
1825+ new bootstrap . Tooltip ( this ) ;
1826+ } ) ;
18051827
18061828 $panel . removeClass ( "d-none" ) ;
18071829 }
0 commit comments