Skip to content

Commit 16e4160

Browse files
danymarquesdevversion
authored andcommitted
feat: display prompt names as badges in report list view
Add promptNames field to RunGroup interface and collect prompt names during report grouping. Display them as neutral status badges in the report list UI with backward compatibility for older groups.json files.
1 parent 41d0602 commit 16e4160

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

report-app/src/app/pages/report-list/report-list.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
</ul>
3838
}
3939
</div>
40+
@if (group.promptNames.length) {
41+
<ul class="status-badge-group prompt-names">
42+
@for (name of group.promptNames; track name) {
43+
<li class="status-badge neutral">{{ name }}</li>
44+
}
45+
</ul>
46+
}
4047
</div>
4148
<div class="run-meta-container">
4249
<div class="run-meta">

report-app/src/app/pages/report-list/report-list.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ h1, h2 {
106106
padding: 0 20px;
107107
}
108108

109+
.prompt-names {
110+
margin-top: 0.4rem;
111+
112+
.status-badge {
113+
font-size: 0.75rem;
114+
font-weight: 400;
115+
}
116+
}
117+
109118
.select-for-comparison input[type='checkbox'] {
110119
width: 20px;
111120
height: 20px;

runner/orchestration/grouping.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export function groupSimilarReports(inputRuns: RunInfo[]): RunGroup[] {
5555
const groupResults: AssessmentResult[] = [];
5656
const firstRun = groupRuns[0];
5757
const labels = new Set<string>();
58+
const promptNames = new Set<string>();
5859
let totalForGroup = 0;
5960
let maxForGroup = 0;
6061
let appsCount = 0;
@@ -70,6 +71,7 @@ export function groupSimilarReports(inputRuns: RunInfo[]): RunGroup[] {
7071
totalForRun += result.score.totalPoints;
7172
maxForRun += result.score.maxOverallPoints;
7273
groupResults.push(result);
74+
promptNames.add(result.promptDef.name);
7375
}
7476

7577
// `|| 0` in case there are no results, otherwise we'll get NaN.
@@ -90,6 +92,7 @@ export function groupSimilarReports(inputRuns: RunInfo[]): RunGroup[] {
9092
maxOverallPoints: maxForGroup / groupRuns.length || 0,
9193
appsCount,
9294
labels: Array.from(labels),
95+
promptNames: Array.from(promptNames),
9396
environmentId: firstRun.details.summary.environmentId,
9497
framework: firstRun.details.summary.framework,
9598
model: firstRun.details.summary.model,

runner/reporting/report-local-disk.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export async function fetchReportsFromDisk(directory: string): Promise<FetchedLo
3737
// were part of the same invocation. Add a unique suffix to the ID to
3838
// prevent further grouping.
3939
run.group = group.id = `${group.id}-l${index}`;
40+
41+
// Derive prompt names from the run data for backward compatibility
42+
// with older groups.json files that don't have the field.
43+
group.promptNames ??= run.results.map(r => r.promptDef.name);
44+
4045
data.set(group.id, {group, run});
4146
}),
4247
);

runner/shared-interfaces.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,8 @@ export interface RunGroup {
637637
};
638638
/** Runner used to generate code for the runs in the group. */
639639
runner?: CodegenRunnerInfo;
640+
/** Names of prompts that were evaluated in this group. */
641+
promptNames: string[];
640642
}
641643

642644
/** Request information for a file generation. */

0 commit comments

Comments
 (0)