🪢 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(ui): truncate long model names in dashboard (#3417)
Marc Klingen2a11f1e8fb2b
diff --git a/web/src/features/dashboard/components/LeftAlignedCell.tsx b/web/src/features/dashboard/components/LeftAlignedCell.tsxindex 2c0f5c4438..733ccced68 100644--- a/web/src/features/dashboard/components/LeftAlignedCell.tsx+++ b/web/src/features/dashboard/components/LeftAlignedCell.tsx@@ -4,7 +4,13 @@ import { type ReactNode } from "react";export const LeftAlignedCell = ({children,className,+ title,}: {children: ReactNode;className?: string;-}) => <div className={cn("text-left", className)}>{children}</div>;+ title?: string;+}) => (+ <div className={cn("text-left", className)} title={title}>+ {children}+ </div>+);diff --git a/web/src/features/dashboard/components/MetricTable.tsx b/web/src/features/dashboard/components/ModelCostTable.tsxsimilarity index 91%rename from web/src/features/dashboard/components/MetricTable.tsxrename to web/src/features/dashboard/components/ModelCostTable.tsxindex 4b66cc5e87..834528408f 100644--- a/web/src/features/dashboard/components/MetricTable.tsx+++ b/web/src/features/dashboard/components/ModelCostTable.tsx@@ -1,5 +1,6 @@import DocPopup from "@/src/components/layouts/doc-popup";import { RightAlignedCell } from "@/src/features/dashboard/components/RightAlignedCell";+import { LeftAlignedCell } from "@/src/features/dashboard/components/LeftAlignedCell";import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";import { DashboardTable } from "@/src/features/dashboard/components/cards/DashboardTable";import { type FilterState } from "@langfuse/shared";@@ -7,10 +8,10 @@ import { api } from "@/src/utils/api";import { compactNumberFormatter } from "@/src/utils/numbers";import { TotalMetric } from "./TotalMetric";import { totalCostDashboardFormatted } from "@/src/features/dashboard/lib/dashboard-utils";-import { env } from "@/src/env.mjs";+import { truncate } from "@/src/utils/string";-export const MetricTable = ({+export const ModelCostTable = ({className,projectId,globalFilterState,@@ -66,7 +67,9 @@ export const MetricTable = ({? metrics.data.filter((item) => item.model !== null).map((item, i) => [- item.model as string,+ <LeftAlignedCell key={`${i}-model`} title={item.model as string}>+ {truncate(item.model as string, 30)}+ </LeftAlignedCell>,<RightAlignedCell key={`${i}-tokens`}>{item.sumTotalTokens? compactNumberFormatter(item.sumTotalTokens as number)diff --git a/web/src/features/dashboard/components/RightAlignedCell.tsx b/web/src/features/dashboard/components/RightAlignedCell.tsxindex 0088066b8e..2dc319fb6a 100644--- a/web/src/features/dashboard/components/RightAlignedCell.tsx+++ b/web/src/features/dashboard/components/RightAlignedCell.tsx@@ -4,7 +4,13 @@ import { type ReactNode } from "react";export const RightAlignedCell = ({children,className,+ title,}: {children: ReactNode;className?: string;-}) => <div className={cn("text-right", className)}>{children}</div>;+ title?: string;+}) => (+ <div className={cn("text-right", className)} title={title}>+ {children}+ </div>+);diff --git a/web/src/pages/project/[projectId]/index.tsx b/web/src/pages/project/[projectId]/index.tsxindex 4eac6dc879..f3d5bffe50 100644--- a/web/src/pages/project/[projectId]/index.tsx+++ b/web/src/pages/project/[projectId]/index.tsx@@ -3,7 +3,7 @@ import { useRouter } from "next/router";import { GenerationLatencyChart } from "@/src/features/dashboard/components/LatencyChart";import { ChartScores } from "@/src/features/dashboard/components/ChartScores";import { TracesBarListChart } from "@/src/features/dashboard/components/TracesBarListChart";-import { MetricTable } from "@/src/features/dashboard/components/MetricTable";+import { ModelCostTable } from "@/src/features/dashboard/components/ModelCostTable";import { ScoresTable } from "@/src/features/dashboard/components/ScoresTable";import { ModelUsageChart } from "@/src/features/dashboard/components/ModelUsageChart";import { TracesTimeSeriesChart } from "@/src/features/dashboard/components/TracesTimeSeriesChart";@@ -182,7 +182,7 @@ export default function Dashboard() {globalFilterState={mergedFilterState}/>{!disableExpensiveDashboardComponents && (- <MetricTable+ <ModelCostTableclassName="col-span-1 xl:col-span-2"projectId={projectId}globalFilterState={mergedFilterState}