The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor(ui): migrate TruncatedValue and OutputCard to shadcn
Yuneng Jiangf17143086a8b
diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.jsonindex 8a86305b4cb..34d8c90e7b3 100644--- a/ui/litellm-dashboard/eslint-suppressions.json+++ b/ui/litellm-dashboard/eslint-suppressions.json@@ -3897,11 +3897,6 @@"count": 2}},- "src/components/view_logs/LogDetailsDrawer/OutputCard.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/components/view_logs/LogDetailsDrawer/RealtimePrettyView.test.tsx": {"unused-imports/no-unused-imports": {"count": 2@@ -3932,11 +3927,6 @@"count": 1}},- "src/components/view_logs/LogDetailsDrawer/TruncatedValue.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/components/view_logs/LogDetailsDrawer/useKeyboardNavigation.ts": {"react-hooks/immutability": {"count": 2diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/OutputCard.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/OutputCard.tsxindex 9362d249874..2b7f26a63e4 100644--- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/OutputCard.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/OutputCard.tsx@@ -4,14 +4,12 @@*/import { useState } from "react";-import { Typography } from "antd";import MessageManager from "@/components/molecules/message_manager";+import { COLOR_BORDER } from "./constants";import { ParsedMessage } from "./prettyMessagesTypes";import { SectionHeader } from "./SectionHeader";import { SimpleMessageBlock } from "./SimpleMessageBlock";-const { Text } = Typography;-interface OutputCardProps {message: ParsedMessage | null;completionTokens?: number;@@ -24,55 +22,12 @@ export function OutputCard({ message, completionTokens, outputCost }: OutputCardconst handleCopy = () => {if (!message) return;- const content = message.content || "";- navigator.clipboard.writeText(content);+ navigator.clipboard.writeText(message.content || "");MessageManager.success("Output copied");};- if (!message) {- return (- <div- style={{- border: "1px solid #f0f0f0",- borderRadius: 6,- overflow: "hidden",- }}- >- <SectionHeader- type="output"- tokens={completionTokens}- cost={outputCost}- onCopy={handleCopy}- isCollapsed={isCollapsed}- onToggleCollapse={() => setIsCollapsed(!isCollapsed)}- />- <div- style={{- maxHeight: isCollapsed ? "0px" : "10000px",- overflow: "hidden",- transition: "max-height 0.3s ease-out, opacity 0.3s ease-out",- opacity: isCollapsed ? 0 : 1,- }}- >- <div style={{ padding: "12px 16px" }}>- <Text type="secondary" style={{ fontSize: 13, fontStyle: "italic" }}>- No response data available- </Text>- </div>- </div>- </div>- );- }-return (- <div- style={{- border: "1px solid #f0f0f0",- borderRadius: 6,- overflow: "hidden",- }}- >- {/* Datadog-style Header */}+ <div className="overflow-hidden rounded-md" style={{ border: `1px solid ${COLOR_BORDER}` }}><SectionHeadertype="output"tokens={completionTokens}@@ -82,17 +37,16 @@ export function OutputCard({ message, completionTokens, outputCost }: OutputCardonToggleCollapse={() => setIsCollapsed(!isCollapsed)}/>- {/* Content */}<div- style={{- maxHeight: isCollapsed ? "0px" : "10000px",- overflow: "hidden",- transition: "max-height 0.3s ease-out, opacity 0.3s ease-out",- opacity: isCollapsed ? 0 : 1,- }}+ className="overflow-hidden transition-[max-height,opacity] duration-300 ease-out"+ style={{ maxHeight: isCollapsed ? "0px" : "10000px", opacity: isCollapsed ? 0 : 1 }}>- <div style={{ padding: "12px 16px" }}>- <SimpleMessageBlock label="ASSISTANT" content={message.content} toolCalls={message.toolCalls} />+ <div className="px-4 py-3">+ {message ? (+ <SimpleMessageBlock label="ASSISTANT" content={message.content} toolCalls={message.toolCalls} />+ ) : (+ <span className="text-[13px] text-muted-foreground italic">No response data available</span>+ )}</div></div></div>diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TruncatedValue.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TruncatedValue.tsxindex b03895808d6..2d4fa7ad7ef 100644--- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TruncatedValue.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TruncatedValue.tsx@@ -1,7 +1,6 @@-import { Typography, Tooltip } from "antd";-import { DEFAULT_MAX_WIDTH, FONT_FAMILY_MONO, FONT_SIZE_SMALL } from "./constants";--const { Text } = Typography;+import CopyButton from "@/components/shared/CopyButton";+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";+import { DEFAULT_MAX_WIDTH, FONT_FAMILY_MONO } from "./constants";interface TruncatedValueProps {value?: string;@@ -13,23 +12,23 @@ interface TruncatedValueProps {* Useful for displaying long IDs, URLs, or other text that may overflow.*/export function TruncatedValue({ value, maxWidth = DEFAULT_MAX_WIDTH }: TruncatedValueProps) {- if (!value) return <Text type="secondary">-</Text>;+ if (!value) return <span className="text-muted-foreground">-</span>;return (- <Tooltip title={value}>- <Text- copyable={{ text: value, tooltips: ["Copy", "Copied!"] }}- style={{- maxWidth,- display: "inline-block",- verticalAlign: "bottom",- fontFamily: FONT_FAMILY_MONO,- fontSize: FONT_SIZE_SMALL,- }}- ellipsis- >- {value}- </Text>- </Tooltip>+ <TooltipProvider delay={300}>+ <Tooltip>+ <TooltipTrigger+ render={+ <span className="inline-flex items-center gap-1 align-bottom">+ <span className="truncate text-xs" style={{ maxWidth, fontFamily: FONT_FAMILY_MONO }}>+ {value}+ </span>+ <CopyButton value={value} label="Copy" className="size-4 shrink-0" iconClassName="size-3" />+ </span>+ }+ />+ <TooltipContent>{value}</TooltipContent>+ </Tooltip>+ </TooltipProvider>);}