🪢 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): show headings on map hovers (#18533)
Nimara429ff91b941
diff --git a/web/src/features/topics/EmbeddingMapView.stories.tsx b/web/src/features/topics/EmbeddingMapView.stories.tsxindex df48731f11..e7e46951e2 100644--- a/web/src/features/topics/EmbeddingMapView.stories.tsx+++ b/web/src/features/topics/EmbeddingMapView.stories.tsx@@ -656,6 +656,12 @@ export const HoverPreservesMapGeometry = meta.story({args: {fillContainer: true,data,+ topics: [+ {+ id: "billing",+ name: "Billing, invoices, subscriptions, and account administration",+ },+ ],selectedTopic: null,selectedTraceId: null,onSelectTrace: fn(),@@ -704,6 +710,15 @@ export const HoverPreservesMapGeometry = meta.story({await waitFor(() =>expect(Number(getComputedStyle(tooltip).opacity)).toBeCloseTo(0.96, 2),);+ const topicName = args.topics[0].name;+ await expect(tooltip).toHaveAccessibleName(+ `Trace summary: ${topicName}. ${trace.summary}`,+ );+ const topicLabel = within(tooltip).getByText(topicName);+ await expect(topicLabel).toBeVisible();+ await expect(topicLabel.scrollHeight).toBeLessThanOrEqual(+ topicLabel.clientHeight,+ );await expect(getComputedStyle(tooltip).pointerEvents).toBe("none");await expect(tooltip).not.toHaveAttribute("tabindex");const tooltipBounds = tooltip.getBoundingClientRect();diff --git a/web/src/features/topics/map/TopicMapExplorer.tsx b/web/src/features/topics/map/TopicMapExplorer.tsxindex ecd520191b..57b341f30f 100644--- a/web/src/features/topics/map/TopicMapExplorer.tsx+++ b/web/src/features/topics/map/TopicMapExplorer.tsx@@ -625,6 +625,7 @@ function MapLabels({const zone = hints.zones[0];if (!trace && !zone) return null;const rect = trace?.card ?? zone!.label;+ const topicPrefix = trace?.topicName ? `${trace.topicName}. ` : "";return (<divkey={label.token}@@ -639,7 +640,7 @@ function MapLabels({aria-hidden={!active}aria-label={trace- ? `Trace summary: ${trace.point.summary}`+ ? `Trace summary: ${topicPrefix}${trace.point.summary}`: `${zone!.name}, ${zone!.countLabel}`}onTransitionEnd={handleHoverTransitionEnd}@@ -658,7 +659,17 @@ function MapLabels({}}>{trace ? (- <span className="line-clamp-6">{trace.excerpt}</span>+ <>+ {trace.topicName && (+ <span+ className="mb-1 line-clamp-2"+ style={{ color: trace.point.color }}+ >+ {trace.topicName}+ </span>+ )}+ <span className="line-clamp-6">{trace.excerpt}</span>+ </>) : (<><spandiff --git a/web/src/features/topics/map/prepare-topic-map.ts b/web/src/features/topics/map/prepare-topic-map.tsindex 29d1ca5f57..ef18aba931 100644--- a/web/src/features/topics/map/prepare-topic-map.ts+++ b/web/src/features/topics/map/prepare-topic-map.ts@@ -613,6 +613,7 @@ function hoverRectangle(type TraceHover = {point: MapPoint;+ topicName: string | undefined;node: TopicMapNode;position: MapPosition;card: MapRectangle;@@ -635,13 +636,16 @@ export function prepareMapHover(return { traces: [], zones: [] };const card = hoverRectangle(node.rect, frame.size, {width: 264,- height: 144,+ height: 184,});return {traces: card? [{point: node.point,+ topicName: frame.model.zones.find(+ (zone) => zone.id === node.point.groupId,+ )?.name,node,position: node.center,card,