From b96cbd44a78e34859c1c5eb10f217cf94b1bec1c Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 28 Feb 2025 11:22:42 -0800 Subject: [PATCH] fix showing error / request / response logs --- .../src/components/view_logs/columns.tsx | 4 +- .../src/components/view_logs/index.tsx | 77 +++++++++++++++++-- 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_logs/columns.tsx b/ui/litellm-dashboard/src/components/view_logs/columns.tsx index b01239278f8..0652e3a8bfc 100644 --- a/ui/litellm-dashboard/src/components/view_logs/columns.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/columns.tsx @@ -247,7 +247,7 @@ export const RequestResponsePanel = ({ request, response }: { request: any; resp -
{requestStr}
+
{requestStr}
@@ -264,7 +264,7 @@ export const RequestResponsePanel = ({ request, response }: { request: any; resp
-
{responseStr}
+
{responseStr}
); diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx index d8a0bc44223..e313c120f4f 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx @@ -576,6 +576,25 @@ function RequestViewer({ row }: { row: Row }) { return input; }; + // Extract error information from metadata if available + const hasError = row.original.metadata?.status === "failure"; + const errorInfo = hasError ? row.original.metadata?.error_information : null; + + // Format the response with error details if present + const formattedResponse = () => { + if (hasError && errorInfo) { + return { + error: { + message: errorInfo.error_message || "An error occurred", + type: errorInfo.error_class || "error", + code: errorInfo.error_code || errorInfo.status_code || "unknown", + param: null + } + }; + } + return formatData(row.original.response); + }; + return (
{/* Combined Info Card */} @@ -640,10 +659,54 @@ function RequestViewer({ row }: { row: Row }) {
{/* Request/Response Panel */} - +
+ {/* Request Side */} +
+
+

Request

+ +
+
+
{JSON.stringify(formatData(row.original.messages), null, 2)}
+
+
+ + {/* Response Side */} +
+
+

+ Response + {hasError && ( + + • HTTP code {errorInfo?.status_code || 400} + + )} +

+ +
+
+
{JSON.stringify(formattedResponse(), null, 2)}
+
+
+
{/* Tags Card - Only show if there are tags */} {row.original.request_tags && Object.keys(row.original.request_tags).length > 0 && ( @@ -679,9 +742,9 @@ function RequestViewer({ row }: { row: Row }) { -
-            {JSON.stringify(row.original.metadata, null, 2)}
-          
+
+
{JSON.stringify(row.original.metadata, null, 2)}
+
)}