@@ -56,33 +56,41 @@ export class LLMAnalysisReportPanel {
5656 LLMAnalysisReportPanel . currentPanel = new LLMAnalysisReportPanel ( column ) ;
5757 }
5858
59- private getImpactLevel ( metric : any ) : string {
59+ private getImpactLevel ( metric : ModelCardResponse [ 'tasks' ] [ 0 ] [ 'metrics' ] [ 0 ] ) : string {
6060 if ( ! metric . thresholds || metric . thresholds . length === 0 ) {
6161 return 'unknown' ;
6262 }
6363
6464 const score = metric . score ;
6565 for ( const threshold of metric . thresholds ) {
6666 if ( score >= threshold . lower && score <= threshold . upper ) {
67- // Map threshold categories to impact levels
68- if ( threshold . category <= 2 ) {
69- return 'low' ;
70- }
71- if ( threshold . category <= 4 ) {
72- return 'moderate' ;
73- }
74- return 'high' ;
67+ return threshold . impact ;
7568 }
7669 }
7770 return 'unknown' ;
7871 }
7972
8073 private getImpactColor ( impactLevel : string ) : string {
8174 switch ( impactLevel ) {
82- case 'low' : return '#4CAF50' ; // Green
83- case 'moderate' : return '#FF9800' ; // Orange
84- case 'high' : return '#F44336' ; // Red
85- default : return '#9E9E9E' ; // Gray
75+ case 'no_measurable' : return '#C8E6C9' ; // Visible light green
76+ case 'very_low' : return '#26A69A' ; // Blue-green
77+ case 'low' : return '#8BC34A' ; // Light green
78+ case 'moderate' : return '#FF9800' ; // Orange
79+ case 'high' : return '#FF5722' ; // Red-orange
80+ case 'severe' : return '#F44336' ; // Red
81+ default : return '#9E9E9E' ; // Gray
82+ }
83+ }
84+
85+ private getImpactDisplayName ( impactLevel : string ) : string {
86+ switch ( impactLevel ) {
87+ case 'no_measurable' : return 'No Measurable Impact' ;
88+ case 'very_low' : return 'Very Low' ;
89+ case 'low' : return 'Low' ;
90+ case 'moderate' : return 'Moderate' ;
91+ case 'high' : return 'High' ;
92+ case 'severe' : return 'Severe' ;
93+ default : return 'Unknown' ;
8694 }
8795 }
8896
@@ -154,7 +162,17 @@ export class LLMAnalysisReportPanel {
154162
155163 // Sort by required metrics first, then by impact level
156164 allMetrics . sort ( ( a , b ) => {
157- const impactOrder : { [ key : string ] : number } = { 'high' : 0 , 'moderate' : 1 , 'low' : 2 , 'unknown' : 3 } ;
165+ const impactOrder : { [ key : string ] : number } = {
166+ 'severe' : 0 ,
167+ 'high' : 1 ,
168+ 'moderate' : 2 ,
169+ 'low' : 3 ,
170+ // eslint-disable-next-line @typescript-eslint/naming-convention
171+ 'very_low' : 4 ,
172+ // eslint-disable-next-line @typescript-eslint/naming-convention
173+ 'no_measurable' : 5 ,
174+ 'unknown' : 6 ,
175+ } ;
158176 return impactOrder [ a . impactLevel ] - impactOrder [ b . impactLevel ] ;
159177 } ) ;
160178
@@ -199,12 +217,14 @@ export class LLMAnalysisReportPanel {
199217 const metricKey = `${ task . name } :${ metric . name } ` ;
200218 const relatedGuardrailIds = metricToGuardrails . get ( metricKey ) || [ ] ;
201219
220+ const impactLevel = this . getImpactLevel ( metric ) ;
202221 return {
203222 name : metric . name ,
204223 score : metric . score ,
205224 categories : metric . categories ,
206225 higherIsBetter : metric . higher_is_better ,
207- impactLevel : this . getImpactLevel ( metric ) ,
226+ impactLevel : impactLevel ,
227+ impactDisplayName : this . getImpactDisplayName ( impactLevel ) ,
208228 relatedGuardrails : relatedGuardrailIds
209229 . filter ( id => recommendedGuardrails . some ( g => g . id === id ) )
210230 . map ( id => {
@@ -222,6 +242,7 @@ export class LLMAnalysisReportPanel {
222242 data : JSON . stringify ( allMetrics . map ( m => m . metric . score ) ) ,
223243 colors : JSON . stringify ( allMetrics . map ( m => this . getImpactColor ( m . impactLevel ) ) ) ,
224244 impactLevels : JSON . stringify ( allMetrics . map ( m => m . impactLevel ) ) ,
245+ impactDisplayNames : JSON . stringify ( allMetrics . map ( m => this . getImpactDisplayName ( m . impactLevel ) ) ) ,
225246 tasks : enrichedTasks ,
226247 contextData : {
227248 modelSource : resp . config . model_source ,
0 commit comments