Skip to content

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

fix(score-configs-ui): update category value append logic (#12784)

marliessophie5ebe890fb872
diff --git a/web/src/features/score-configs/components/UpsertScoreConfigDialog.tsx b/web/src/features/score-configs/components/UpsertScoreConfigDialog.tsx
index 722f1ae936..0a81853e73 100644
--- a/web/src/features/score-configs/components/UpsertScoreConfigDialog.tsx
+++ b/web/src/features/score-configs/components/UpsertScoreConfigDialog.tsx
@@ -383,7 +383,16 @@ export function UpsertScoreConfigDialog({
) && fields.length === 2
}
onClick={() =>
- append({ label: "", value: fields.length })
+ append({
+ label: "",
+ value:
+ fields.length > 0
+ ? fields.reduce(
+ (max, f) => Math.max(max, f.value),
+ 0,
+ ) + 1
+ : 0,
+ })
}
>
Add category