Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(ui): sort selects in evals ui (#2691)

Marc Klingen7c9564374ecf
diff --git a/web/src/ee/features/evals/components/eval-config-form.tsx b/web/src/ee/features/evals/components/eval-config-form.tsx
index fc1bd1be67..ffc1867672 100644
--- a/web/src/ee/features/evals/components/eval-config-form.tsx
+++ b/web/src/ee/features/evals/components/eval-config-form.tsx
@@ -82,11 +82,15 @@ export const EvalConfigForm = (props: {
<SelectValue placeholder="Select a template to run this eval config" />
</SelectTrigger>
<SelectContent>
- {props.evalTemplates.map((template) => (
- <SelectItem value={template.id} key={template.id}>
- {`${template.name}-v${template.version}`}
- </SelectItem>
- ))}
+ {props.evalTemplates
+ .sort(
+ (a, b) => a.name.localeCompare(b.name) || a.version - b.version,
+ )
+ .map((template) => (
+ <SelectItem value={template.id} key={template.id}>
+ {`${template.name}-v${template.version}`}
+ </SelectItem>
+ ))}
</SelectContent>
</Select>
) : undefined}
diff --git a/web/src/ee/features/evals/components/template-form.tsx b/web/src/ee/features/evals/components/template-form.tsx
index eee17eed20..95d382e00e 100644
--- a/web/src/ee/features/evals/components/template-form.tsx
+++ b/web/src/ee/features/evals/components/template-form.tsx
@@ -70,11 +70,13 @@ export const EvalTemplateForm = (props: {
/>
</SelectTrigger>
<SelectContent className="max-h-60 max-w-80">
- {TEMPLATES.map((project) => (
- <SelectItem key={project.name} value={project.name}>
- {project.name}
- </SelectItem>
- ))}
+ {TEMPLATES.sort((a, b) => a.name.localeCompare(b.name)).map(
+ (project) => (
+ <SelectItem key={project.name} value={project.name}>
+ {project.name}
+ </SelectItem>
+ ),
+ )}
</SelectContent>
</Select>
</div>