🪢 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
fix(topics): grouping copy in run history and content-width mobile actions menu (#19425)
Nimar2bd90f45b72f
diff --git a/web/src/components/layouts/MobilePageActionsContent.tsx b/web/src/components/layouts/MobilePageActionsContent.tsxindex de3495638f..a9cbf24d9d 100644--- a/web/src/components/layouts/MobilePageActionsContent.tsx+++ b/web/src/components/layouts/MobilePageActionsContent.tsx@@ -21,7 +21,7 @@ export function MobilePageActionsContent({<PopoverContentalign="end"collisionPadding={12}- className="w-[calc(100vw-1.5rem)] max-w-sm p-2"+ className="w-max max-w-[min(24rem,calc(100vw-1.5rem))] min-w-48 p-2"onCloseAutoFocus={onCloseAutoFocus}><div className="flex flex-col items-stretch gap-2">{children}</div>diff --git a/web/src/components/layouts/mobile-page-actions-content.stories.tsx b/web/src/components/layouts/mobile-page-actions-content.stories.tsxindex 3e32f8f16b..ab2f3db2a8 100644--- a/web/src/components/layouts/mobile-page-actions-content.stories.tsx+++ b/web/src/components/layouts/mobile-page-actions-content.stories.tsx@@ -1,23 +1,25 @@import {+ History,LayoutDashboard,PencilIcon,+ Play,+ RefreshCw,+ Settings,SlidersHorizontal,} from "@langfuse/icons";import { fn } from "storybook/test";import preview from "../../../.storybook/preview";+import { HeaderActionMenuRow } from "@/src/components/HeaderActionMenuRow";+import { Badge } from "@/src/components/design-system/Badge/Badge";import { Button } from "@/src/components/ui/button";import { Popover, PopoverTrigger } from "@/src/components/ui/popover";import { MobilePageActionsContent } from "@/src/components/layouts/MobilePageActionsContent";-const meta = preview.meta({- component: MobilePageActionsContent,-});--export const MixedPageControls = meta.story({- name: "Mixed page controls",+const phoneViewport = {globals: { viewport: { value: "page-actions-phone", isRotated: false } },parameters: {+ layout: "fullscreen",viewport: {options: {"page-actions-phone": {@@ -27,31 +29,79 @@ export const MixedPageControls = meta.story({},},},+} as const;++const meta = preview.meta({+ component: MobilePageActionsContent,+});++export const MenuRows = meta.story({+ name: "Menu rows",+ ...phoneViewport,+ render: () => (+ <div className="flex justify-end p-3">+ <Popover defaultOpen>+ <PopoverTrigger asChild>+ <Button variant="outline">More actions</Button>+ </PopoverTrigger>+ <MobilePageActionsContent onCloseAutoFocus={fn()}>+ <div className="flex flex-col items-stretch gap-0.5">+ <HeaderActionMenuRow+ label="Auto-analyze"+ icon={<Play size="base" color="default" />}+ badge={<Badge text="On" size="sm" />}+ />+ <HeaderActionMenuRow+ label="Regenerate topics"+ icon={<RefreshCw size="base" color="default" />}+ />+ <HeaderActionMenuRow+ label="History"+ icon={<History size="base" color="default" />}+ />+ <HeaderActionMenuRow+ label="Settings"+ icon={<Settings size="base" color="default" />}+ />+ </div>+ </MobilePageActionsContent>+ </Popover>+ </div>+ ),+});++export const MixedPageControls = meta.story({+ name: "Mixed page controls",+ ...phoneViewport,render: () => (- <Popover defaultOpen>- <PopoverTrigger asChild>- <Button variant="outline">More actions</Button>- </PopoverTrigger>- <MobilePageActionsContent onCloseAutoFocus={fn()}>- <div className="flex flex-col gap-1">- <span className="text-muted-foreground px-2 text-xs">Dashboard</span>- <Button variant="outline" className="w-full justify-start gap-2">- <LayoutDashboard size="base" color="default" />- Langfuse Home- </Button>- <Button variant="ghost" className="w-full justify-start gap-2">- <PencilIcon size="base" color="default" />- Edit dashboard- </Button>- </div>- <div className="flex flex-col gap-1 border-t pt-2">- <span className="text-muted-foreground px-2 text-xs">Data</span>- <Button variant="outline" className="w-full justify-start gap-2">- <SlidersHorizontal size="base" color="default" />- Environment and filters- </Button>- </div>- </MobilePageActionsContent>- </Popover>+ <div className="flex justify-end p-3">+ <Popover defaultOpen>+ <PopoverTrigger asChild>+ <Button variant="outline">More actions</Button>+ </PopoverTrigger>+ <MobilePageActionsContent onCloseAutoFocus={fn()}>+ <div className="flex flex-col gap-1">+ <span className="text-muted-foreground px-2 text-xs">+ Dashboard+ </span>+ <Button variant="outline" className="w-full justify-start gap-2">+ <LayoutDashboard size="base" color="default" />+ Langfuse Home+ </Button>+ <Button variant="ghost" className="w-full justify-start gap-2">+ <PencilIcon size="base" color="default" />+ Edit dashboard+ </Button>+ </div>+ <div className="flex flex-col gap-1 border-t pt-2">+ <span className="text-muted-foreground px-2 text-xs">Data</span>+ <Button variant="outline" className="w-full justify-start gap-2">+ <SlidersHorizontal size="base" color="default" />+ Environment and filters+ </Button>+ </div>+ </MobilePageActionsContent>+ </Popover>+ </div>),});diff --git a/web/src/features/topics/TopicRunDetails.stories.tsx b/web/src/features/topics/TopicRunDetails.stories.tsxindex e32ae4f6d5..76d679cbf5 100644--- a/web/src/features/topics/TopicRunDetails.stories.tsx+++ b/web/src/features/topics/TopicRunDetails.stories.tsx@@ -206,6 +206,43 @@ export const Running = meta.story({},});+export const Regenerating = meta.story({+ name: "(Test) Regenerating counts the summaries it groups",+ args: {+ execution: {+ ...doneWithIssues,+ status: "running",+ phase: "clustering",+ facets: [+ facetProgress("intent", {+ counts: { requested: 1_240, complete: 1_240, assigned: 1_193 },+ }),+ facetProgress("sentiment", {+ outcome: "pending",+ counts: { requested: 1_240, complete: 1_180, assigned: 0 },+ }),+ facetProgress("outcome", {+ outcome: "pending",+ counts: { requested: 0, complete: 0, assigned: 0, outlier: 0 },+ }),+ ],+ },+ traceErrors: traceErrorsClosed,+ retry: retryIdle,+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await expect(canvas.getByText("Clustering summaries")).toBeVisible();+ await expect(+ canvas.getByText("1,193 in topics · 20 didn’t fit a topic"),+ ).toBeVisible();+ await expect(+ canvas.getByText("Grouping 1,180 summaries into topics"),+ ).toBeVisible();+ await expect(canvas.queryByText(/summarized/)).toBeNull();+ },+});+export const DoneWithIssues = meta.story({args: {execution: doneWithIssues,@@ -319,7 +356,7 @@ export const QuestionStatusesExplainThemselves = meta.story({await expect(canvas.getByText("Waiting")).toBeVisible();await expect(canvas.getByText("Needs more traces")).toBeVisible();await expect(- canvas.getByText("64 summarized · 12 had too little text"),+ canvas.getByText("64 summaries · 12 had too little text"),).toBeVisible();await expect(canvas.getByText(diff --git a/web/src/features/topics/TopicRunDetails.tsx b/web/src/features/topics/TopicRunDetails.tsxindex 6e3c32d546..2de69210f0 100644--- a/web/src/features/topics/TopicRunDetails.tsx+++ b/web/src/features/topics/TopicRunDetails.tsx@@ -89,16 +89,24 @@ function canResume(execution: Run) {);}-function questionStats(progress: FacetProgress, runStatus: Run["status"]) {+/** Regenerate topics groups stored summaries, so its counts are summaries, not traces summarized by the run. */+function questionStats(progress: FacetProgress, execution: Run) {const c = progress.counts;- if (busy(runStatus))+ const runStatus = execution.status;+ const isUpdate = execution.input.operation === "update";+ if (isUpdate && busy(runStatus) && progress.outcome === "pending")+ return c.requested > 0+ ? `Grouping ${formatCount(c.complete)} summaries into topics`+ : null;+ if (!isUpdate && busy(runStatus))return `${formatCount(c.complete)} of ${formatCount(c.requested)} summarized`;- if (runStatus === "failed")+ if (!isUpdate && runStatus === "failed")return `${formatCount(c.complete)} of ${formatCount(c.requested)} summarized · ${formatCount(Math.max(0, c.requested - c.complete))} left`;+ const summaryNoun = isUpdate ? "summaries" : "summarized";const parts = [c.assigned > 0? `${formatCount(c.assigned)} in topics`- : `${formatCount(c.complete)} summarized`,+ : `${formatCount(c.complete)} ${summaryNoun}`,];if (c.outlier > 0) parts.push(`${formatCount(c.outlier)} didn’t fit a topic`);if (c.insufficientInput > 0)@@ -151,6 +159,7 @@ function QuestionRow({dot: "bg-muted-foreground",};const note = questionNote(progress, minimum);+ const stats = questionStats(progress, execution);const facetError =progress.error && progress.error !== execution.error? progress.error@@ -163,9 +172,7 @@ function QuestionRow({</h4><StatusLabel label={status.label} dot={status.dot} /></div>- <p className="text-muted-foreground text-xs">- {questionStats(progress, execution.status)}- </p>+ {stats && <p className="text-muted-foreground text-xs">{stats}</p>}{note && (<p className="text-foreground-secondary text-sm text-pretty">{note}</p>)}