diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index 86e171d8933..4bb5c20ef67 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -60,6 +60,8 @@ "src/components/guardrails/content_filter/ContentFilterDisplay.tsx", "src/components/prompts/prompt_editor_view/PromptEditorHeader.tsx", "src/app/(dashboard)/teams/components/TeamsTable/ModelsCell.tsx", + "src/components/prompts/prompt_editor_view/conversation_panel/MessageBubble.tsx", + "src/components/playground/chat_ui/SessionManagement.tsx", "src/components/policies/impact_preview_alert.tsx", "src/components/policies/impact_popover.tsx", "src/components/DeletedKeysPage/DeletedKeysPage.tsx", diff --git a/ui/litellm-dashboard/src/components/playground/chat_ui/SessionManagement.tsx b/ui/litellm-dashboard/src/components/playground/chat_ui/SessionManagement.tsx index e782845bfc3..91f68ce009b 100644 --- a/ui/litellm-dashboard/src/components/playground/chat_ui/SessionManagement.tsx +++ b/ui/litellm-dashboard/src/components/playground/chat_ui/SessionManagement.tsx @@ -1,6 +1,13 @@ import React from "react"; -import { Switch, Tooltip } from "antd"; -import { InfoCircleOutlined, CopyOutlined } from "@ant-design/icons"; +import { Switch } from "@/components/ui/switch"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Copy, Info } from "lucide-react"; +import { cn } from "@/lib/utils"; import { EndpointType } from "./mode_endpoint_mapping"; import NotificationsManager from "../../molecules/notifications_manager"; @@ -30,10 +37,14 @@ const SessionManagement: React.FC = ({ const getSessionDisplay = () => { if (!responsesSessionId) { - return useApiSessionManagement ? "API Session: Ready" : "UI Session: Ready"; + return useApiSessionManagement + ? "API Session: Ready" + : "UI Session: Ready"; } - const sessionPrefix = useApiSessionManagement ? "Response ID" : "UI Session"; + const sessionPrefix = useApiSessionManagement + ? "Response ID" + : "UI Session"; const truncatedId = responsesSessionId.slice(0, 10); return `${sessionPrefix}: ${truncatedId}...`; }; @@ -52,43 +63,83 @@ const SessionManagement: React.FC = ({ return (
- {/* Session Management Toggle */}
- Session Management - - - + + Session Management + + + + + + + + Choose between LiteLLM API session management (using + previous_response_id) or UI-based session management (using + chat history) + + + +
+
+ + UI + + + + API +
-
- {/* Session Status Indicator */}
- + {getSessionDisplay()}
{responsesSessionId && ( - -
Copy response ID to continue session:
-
- {`curl -X POST "your-proxy-url/v1/responses" \\ + + + + + + +
+
+ Copy response ID to continue session: +
+
+ {`curl -X POST "your-proxy-url/v1/responses" \\ -H "Authorization: Bearer your-api-key" \\ -H "Content-Type: application/json" \\ -d '{ @@ -97,18 +148,16 @@ const SessionManagement: React.FC = ({ "previous_response_id": "${responsesSessionId}", "stream": true }'`} +
-
- } - overlayStyle={{ maxWidth: "500px" }} - > - -
+ + + )}
-
{getSessionDescription()}
+
+ {getSessionDescription()} +
); diff --git a/ui/litellm-dashboard/src/components/prompts/prompt_editor_view/conversation_panel/MessageBubble.tsx b/ui/litellm-dashboard/src/components/prompts/prompt_editor_view/conversation_panel/MessageBubble.tsx index e5e4f46b409..9997e441ea4 100644 --- a/ui/litellm-dashboard/src/components/prompts/prompt_editor_view/conversation_panel/MessageBubble.tsx +++ b/ui/litellm-dashboard/src/components/prompts/prompt_editor_view/conversation_panel/MessageBubble.tsx @@ -1,41 +1,51 @@ import React from "react"; -import { RobotOutlined, UserOutlined } from "@ant-design/icons"; +import { Bot, User } from "lucide-react"; import ReactMarkdown from "react-markdown"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { coy } from "react-syntax-highlighter/dist/esm/styles/prism"; import ResponseMetrics from "../../../playground/chat_ui/ResponseMetrics"; import { Message } from "./types"; +import { cn } from "@/lib/utils"; interface MessageBubbleProps { message: Message; } const MessageBubble: React.FC = ({ message }) => { + const isUser = message.role === "user"; return ( -
+
- {message.role === "user" ? ( - + {isUser ? ( + ) : ( - + )}
{message.role} - {message.role === "assistant" && message.model && ( - + {!isUser && message.model && ( + {message.model} )} @@ -50,22 +60,23 @@ const MessageBubble: React.FC = ({ message }) => { hyphens: "auto", }} > - {message.role === "assistant" ? ( + {!isUser ? ( & { inline?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any node?: any; }) { const match = /language-(\w+)/.exec(className || ""); return !inline && match ? ( = ({ message }) => { ) : ( @@ -86,8 +97,11 @@ const MessageBubble: React.FC = ({ message }) => { ); }, - pre: ({ node, ...props }) => ( -
+                pre: ({ ...props }) => (
+                  
                 ),
               }}
             >
@@ -97,8 +111,10 @@ const MessageBubble: React.FC = ({ message }) => {
             
{message.content}
)} - {message.role === "assistant" && - (message.timeToFirstToken || message.totalLatency || message.usage) && ( + {!isUser && + (message.timeToFirstToken || + message.totalLatency || + message.usage) && ( = ({ message }) => { }; export default MessageBubble; -