From c69d0c6aa6b3a370dce64f35a4ed5f7f68682c80 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 14:06:10 +0000 Subject: [PATCH] feat(ui): view_logs/VectorStoreViewer to shadcn - antd Collapse \u2192 shadcn Accordion. Inline SVG chevron \u2192 lucide ChevronRight. - Gray palette replaced with semantic bg-background/border-border/ bg-muted and text-muted-foreground tokens. Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- .../view_logs/VectorStoreViewer.tsx | 251 +++++++++++------- 1 file changed, 149 insertions(+), 102 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_logs/VectorStoreViewer.tsx b/ui/litellm-dashboard/src/components/view_logs/VectorStoreViewer.tsx index 807b2856590..911c4553dcd 100644 --- a/ui/litellm-dashboard/src/components/view_logs/VectorStoreViewer.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/VectorStoreViewer.tsx @@ -1,5 +1,12 @@ import React, { useState } from "react"; -import { Collapse } from "antd"; +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "@/components/ui/accordion"; +import { ChevronRight } from "lucide-react"; +import { cn } from "@/lib/utils"; import { getProviderLogoAndName } from "../provider_info_helpers"; interface VectorStoreContent { @@ -31,7 +38,9 @@ interface VectorStoreViewerProps { } export function VectorStoreViewer({ data }: VectorStoreViewerProps) { - const [expandedResults, setExpandedResults] = useState>({}); + const [expandedResults, setExpandedResults] = useState< + Record + >({}); if (!data || data.length === 0) { return null; @@ -43,7 +52,7 @@ export function VectorStoreViewer({ data }: VectorStoreViewerProps) { }; const calculateDuration = (start: number, end: number): string => { - const duration = (end - start) * 1000; // convert to milliseconds + const duration = (end - start) * 1000; return `${duration.toFixed(2)}ms`; }; @@ -56,111 +65,149 @@ export function VectorStoreViewer({ data }: VectorStoreViewerProps) { }; return ( -
- Vector Store Requests, - children: ( -
- {data.map((request, index) => ( -
-
-
-
-
- Query: - {request.query} -
-
- Vector Store ID: - {request.vector_store_id} -
-
- Provider: - - {(() => { - const { logo, displayName } = getProviderLogoAndName(request.custom_llm_provider); - return ( - <> - {logo && {`${displayName}} - {displayName} - - ); - })()} - -
-
-
-
- Start Time: - {formatTime(request.start_time)} -
-
- End Time: - {formatTime(request.end_time)} -
-
- Duration: - {calculateDuration(request.start_time, request.end_time)} -
-
-
-
- -

Search Results

-
- {request.vector_store_search_response.data.map((result, resultIndex) => { - const isExpanded = expandedResults[`${index}-${resultIndex}`] || false; - - return ( -
-
toggleResult(index, resultIndex)} - > - - - -
- Result {resultIndex + 1} - - Score: {result.score.toFixed(4)} +
+ + + +

+ Vector Store Requests +

+
+ +
+ {data.map((request, index) => ( +
+
+
+
+
+ Query: + {request.query} +
+
+ + Vector Store ID: + + + {request.vector_store_id} + +
+
+ Provider: + + {(() => { + const { logo, displayName } = + getProviderLogoAndName( + request.custom_llm_provider, + ); + return ( + <> + {logo && ( + // eslint-disable-next-line @next/next/no-img-element + {`${displayName} + )} + {displayName} + + ); + })()}
- - {isExpanded && ( -
- {result.content.map((content, contentIndex) => ( -
-
{content.type}
-
-                                {content.text}
-                              
-
- ))} +
+
+ + Start Time: + + {formatTime(request.start_time)}
- )} +
+ End Time: + {formatTime(request.end_time)} +
+
+ Duration: + + {calculateDuration( + request.start_time, + request.end_time, + )} + +
+
- ); - })} -
+
+ +

Search Results

+
+ {request.vector_store_search_response.data.map( + (result, resultIndex) => { + const isExpanded = + expandedResults[`${index}-${resultIndex}`] || false; + + return ( +
+
+ toggleResult(index, resultIndex) + } + > + +
+ + Result {resultIndex + 1} + + + Score:{" "} + + {result.score.toFixed(4)} + + +
+
+ + {isExpanded && ( +
+ {result.content.map( + (content, contentIndex) => ( +
+
+ {content.type} +
+
+                                        {content.text}
+                                      
+
+ ), + )} +
+ )} +
+ ); + }, + )} +
+
+ ))}
- ))} -
- ), - }, - ]} - /> + + +
); }