🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(sessions): show existing annotation counts (#16062)
Nimar3f3b8d68ff09
diff --git a/web/src/components/session/index.tsx b/web/src/components/session/index.tsxindex f07ad0e1f4..a8d5ee038a 100644--- a/web/src/components/session/index.tsx+++ b/web/src/components/session/index.tsx@@ -1437,6 +1437,7 @@ const LoadedSessionEventsPage: React.FC<{environment: session.environment,}}buttonVariant="outline"+ showAnnotationCount={isModernSessionEnabled}/><CreateNewAnnotationQueueItemprojectId={projectId}@@ -1521,6 +1522,7 @@ const LoadedSessionEventsPage: React.FC<{}}buttonVariant="outline"layout="menu"+ showAnnotationCount={isModernSessionEnabled}/><CreateNewAnnotationQueueItemprojectId={projectId}diff --git a/web/src/components/ui/action-button-count-badge.stories.tsx b/web/src/components/ui/action-button-count-badge.stories.tsxnew file mode 100644index 0000000000..d3c6e37f8e--- /dev/null+++ b/web/src/components/ui/action-button-count-badge.stories.tsx@@ -0,0 +1,13 @@+import preview from "../../../.storybook/preview";+import { ActionButtonCountBadge } from "@/src/components/ui/action-button-count-badge";++const meta = preview.meta({+ component: ActionButtonCountBadge,+ parameters: { a11y: { test: "error" } },+});++export default meta;++export const Default = meta.story({ args: { count: 3 } });++export const Overflow = meta.story({ args: { count: 120 } });diff --git a/web/src/components/ui/action-button-count-badge.tsx b/web/src/components/ui/action-button-count-badge.tsxnew file mode 100644index 0000000000..d70c398fc2--- /dev/null+++ b/web/src/components/ui/action-button-count-badge.tsx@@ -0,0 +1,7 @@+export function ActionButtonCountBadge({ count }: { count: number }) {+ return (+ <span className="bg-primary/50 text-primary-foreground flex h-3.5 w-fit items-center justify-center rounded-sm px-1 text-xs shadow-xs">+ {count > 99 ? "99+" : count}+ </span>+ );+}diff --git a/web/src/features/comments/CommentDrawerButton.tsx b/web/src/features/comments/CommentDrawerButton.tsxindex 1f80df2a2a..bb133ea6df 100644--- a/web/src/features/comments/CommentDrawerButton.tsx+++ b/web/src/features/comments/CommentDrawerButton.tsx@@ -1,5 +1,6 @@/* eslint-disable @repo/no-style-props */import Header from "@/src/components/layouts/header";+import { ActionButtonCountBadge } from "@/src/components/ui/action-button-count-badge";import { Button, type ButtonProps } from "@/src/components/ui/button";import {Drawer,@@ -191,11 +192,7 @@ export function CommentDrawerButton({}/><span className={isMenu ? "text-sm" : undefined}>Add comment</span>- {!!count ? (- <span className="bg-primary/50 text-primary-foreground flex h-3.5 w-fit items-center justify-center rounded-sm px-1 text-xs shadow-xs">- {count > 99 ? "99+" : count}- </span>- ) : null}+ {!!count ? <ActionButtonCountBadge count={count} /> : null}</div></Button></DrawerTrigger>diff --git a/web/src/features/scores/components/AnnotateDrawer.tsx b/web/src/features/scores/components/AnnotateDrawer.tsxindex d455abebea..ea6b771760 100644--- a/web/src/features/scores/components/AnnotateDrawer.tsx+++ b/web/src/features/scores/components/AnnotateDrawer.tsx@@ -1,4 +1,5 @@import React from "react";+import { ActionButtonCountBadge } from "@/src/components/ui/action-button-count-badge";import { Button } from "@/src/components/ui/button";import { LockIcon, SquarePen } from "lucide-react";import {@@ -24,6 +25,7 @@ export function AnnotateDrawer<Target extends ScoreTarget>({buttonVariant = "secondary",size = "default",layout = "toolbar",+ showAnnotationCount = false,}: AnnotateDrawerProps<Target> & {size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm";/**@@ -31,6 +33,7 @@ export function AnnotateDrawer<Target extends ScoreTarget>({* trigger as a full-width labeled row for the mobile header overflow popover.*/layout?: "toolbar" | "menu";+ showAnnotationCount?: boolean;}) {const isMenu = layout === "menu";const capture = usePostHogClientCapture();@@ -42,6 +45,9 @@ export function AnnotateDrawer<Target extends ScoreTarget>({const hasNonAnnotationScores = scores.some((score) => score.source !== "ANNOTATION",);+ const annotationCount = scores.filter(+ (score) => score.source === "ANNOTATION",+ ).length;return (<Drawer>@@ -76,6 +82,11 @@ export function AnnotateDrawer<Target extends ScoreTarget>({/>)}<span className={isMenu ? "text-sm" : undefined}>Annotate</span>+ {showAnnotationCount && annotationCount > 0 ? (+ <span className="ml-1">+ <ActionButtonCountBadge count={annotationCount} />+ </span>+ ) : null}</Button></DrawerTrigger><DrawerContent className="p-3">