diff --git a/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.test.tsx b/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.test.tsx index 8a120e86485..2aef47f71d9 100644 --- a/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.test.tsx +++ b/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.test.tsx @@ -3,15 +3,16 @@ import userEvent from "@testing-library/user-event"; import { beforeEach, describe, expect, it, vi } from "vitest"; import type { ComparisonInstance } from "../CompareUI"; import { ComparisonPanel } from "./ComparisonPanel"; +import { EndpointId, ENDPOINT_CONFIGS } from "../endpoint_config"; vi.mock("./MessageDisplay", () => ({ MessageDisplay: () =>
MessageDisplay
, })); -vi.mock("./ModelSelector", () => ({ - ModelSelector: ({ value, onChange }: { value: string; onChange: (val: string) => void }) => ( - onChange(e.target.value)}> + ), @@ -48,6 +49,7 @@ beforeEach(() => { const mockComparison: ComparisonInstance = { id: "1", model: "gpt-4", + agent: "", messages: [], isLoading: false, tags: [], @@ -65,15 +67,19 @@ const mockProps = { onUpdate: vi.fn(), onRemove: vi.fn(), canRemove: true, - modelOptions: ["gpt-4", "gpt-3.5-turbo"], - isLoadingModels: false, + selectorOptions: [ + { value: "gpt-4", label: "gpt-4" }, + { value: "gpt-3.5-turbo", label: "gpt-3.5-turbo" }, + ], + isLoadingOptions: false, + endpointConfig: ENDPOINT_CONFIGS[EndpointId.CHAT_COMPLETIONS], apiKey: "test-api-key", }; describe("ComparisonPanel", () => { it("should render", () => { const { getByTestId } = render(); - expect(getByTestId("model-selector")).toBeInTheDocument(); + expect(getByTestId("unified-selector")).toBeInTheDocument(); expect(getByTestId("message-display")).toBeInTheDocument(); }); diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx index d163be057be..deeac3a8d0b 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx @@ -161,4 +161,31 @@ describe("RequestResponsePanel", () => { expect(mockWriteText).toHaveBeenCalledWith(JSON.stringify({ test: "response data" }, null, 2)); expect(mockNotificationsManager.success).toHaveBeenCalledWith("Response copied to clipboard"); }); + + it("should call formattedResponse for the response panel and not getRawRequest", () => { + const mockGetRawRequest = vi.fn().mockReturnValue({ requestData: "this should not appear in response" }); + const mockFormattedResponse = vi.fn().mockReturnValue({ responseData: "this should appear in response" }); + + render( + , + ); + + expect(mockFormattedResponse).toHaveBeenCalled(); + expect(mockGetRawRequest).toHaveBeenCalled(); + + const formattedResponseCallCount = mockFormattedResponse.mock.calls.length; + expect(formattedResponseCallCount).toBeGreaterThanOrEqual(1); + + const responseData = mockFormattedResponse.mock.results[0].value; + expect(responseData).toEqual({ responseData: "this should appear in response" }); + expect(responseData).not.toEqual({ requestData: "this should not appear in response" }); + }); }); diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx index 7e9901d8bd1..b2cae68184a 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx @@ -134,7 +134,7 @@ export function RequestResponsePanel({
{hasResponse ? (
- +
) : (
Response data not available