mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_claude_code_passthrough
This commit is contained in:
commit
c59963efe4
6 changed files with 1300 additions and 99 deletions
|
|
@ -3,7 +3,7 @@ name = "litellm"
|
|||
version = "1.94.0"
|
||||
description = "Library to easily interface with LLM API providers"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10, <3.14"
|
||||
requires-python = ">=3.10, <3.15"
|
||||
license = "MIT"
|
||||
license-files = ["LICENSE"]
|
||||
authors = [
|
||||
|
|
@ -129,7 +129,8 @@ proxy-runtime = [
|
|||
"opentelemetry-sdk==1.28.0",
|
||||
"opentelemetry-exporter-otlp==1.28.0",
|
||||
"opentelemetry-instrumentation-fastapi==0.49b0",
|
||||
"ddtrace>=2.19.0,<3.0",
|
||||
"ddtrace>=2.19.0,<3.0; python_version < '3.14'",
|
||||
"ddtrace>=4.0.0,<5.0; python_version >= '3.14'",
|
||||
"sentry-sdk>=2.21.0,<3.0",
|
||||
"mangum>=0.17.0,<1.0",
|
||||
"azure-ai-contentsafety>=1.0.0,<2.0",
|
||||
|
|
|
|||
70
ui/litellm-dashboard/src/components/BetaBadge.test.tsx
Normal file
70
ui/litellm-dashboard/src/components/BetaBadge.test.tsx
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import BetaBadge from "./BetaBadge";
|
||||
|
||||
// Mock the hook directly
|
||||
vi.mock("@/app/(dashboard)/hooks/useDisableShowNewBadge", () => ({
|
||||
useDisableShowNewBadge: vi.fn(),
|
||||
}));
|
||||
|
||||
import { useDisableShowNewBadge } from "@/app/(dashboard)/hooks/useDisableShowNewBadge";
|
||||
|
||||
const mockUseDisableShowNewBadge = vi.mocked(useDisableShowNewBadge);
|
||||
|
||||
describe("BetaBadge", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("should render the badge when disableShowNewBadge is false", () => {
|
||||
mockUseDisableShowNewBadge.mockReturnValue(false);
|
||||
|
||||
render(<BetaBadge>Test Content</BetaBadge>);
|
||||
|
||||
expect(screen.getByText("Beta")).toBeInTheDocument();
|
||||
expect(screen.getByText("Test Content")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should render the badge when disableShowNewBadge is not set", () => {
|
||||
mockUseDisableShowNewBadge.mockReturnValue(false);
|
||||
|
||||
render(<BetaBadge />);
|
||||
|
||||
expect(screen.getByText("Beta")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should render only children when disableShowNewBadge is true", () => {
|
||||
mockUseDisableShowNewBadge.mockReturnValue(true);
|
||||
|
||||
render(<BetaBadge>Test Content</BetaBadge>);
|
||||
|
||||
expect(screen.queryByText("Beta")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Test Content")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should render nothing when disableShowNewBadge is true and no children", () => {
|
||||
mockUseDisableShowNewBadge.mockReturnValue(true);
|
||||
|
||||
const { container } = render(<BetaBadge />);
|
||||
|
||||
expect(container.firstChild).toBeNull();
|
||||
});
|
||||
|
||||
it("should render badge with dot instead of text when dot prop is true", () => {
|
||||
mockUseDisableShowNewBadge.mockReturnValue(false);
|
||||
|
||||
render(<BetaBadge dot={true}>Test Content</BetaBadge>);
|
||||
|
||||
expect(screen.queryByText("Beta")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Test Content")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should render badge with 'Beta' text when dot prop is not provided (defaults to false)", () => {
|
||||
mockUseDisableShowNewBadge.mockReturnValue(false);
|
||||
|
||||
render(<BetaBadge>Test Content</BetaBadge>);
|
||||
|
||||
expect(screen.getByText("Beta")).toBeInTheDocument();
|
||||
expect(screen.getByText("Test Content")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
18
ui/litellm-dashboard/src/components/BetaBadge.tsx
Normal file
18
ui/litellm-dashboard/src/components/BetaBadge.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Badge } from "antd";
|
||||
import { useDisableShowNewBadge } from "@/app/(dashboard)/hooks/useDisableShowNewBadge";
|
||||
|
||||
export default function BetaBadge({ children, dot = false }: { children?: React.ReactNode; dot?: boolean }) {
|
||||
const disableShowNewBadge = useDisableShowNewBadge();
|
||||
|
||||
if (disableShowNewBadge) {
|
||||
return children ? <>{children}</> : null;
|
||||
}
|
||||
|
||||
return children ? (
|
||||
<Badge color="blue" count={dot ? undefined : "Beta"} dot={dot}>
|
||||
{children}
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge color="blue" count={dot ? undefined : "Beta"} dot={dot} />
|
||||
);
|
||||
}
|
||||
|
|
@ -72,6 +72,7 @@ import {
|
|||
rolesAllowedToViewWriteScopedPages,
|
||||
rolesWithWriteAccess,
|
||||
} from "../utils/roles";
|
||||
import BetaBadge from "./BetaBadge";
|
||||
import NewBadge from "./common_components/NewBadge";
|
||||
import type { Organization } from "./networking";
|
||||
import SidebarAccountMenu from "./SidebarAccountMenu/SidebarAccountMenu";
|
||||
|
|
@ -211,7 +212,7 @@ const menuGroups: MenuGroup[] = [
|
|||
page: "projects",
|
||||
label: (
|
||||
<span className="flex items-center gap-2">
|
||||
Projects <NewBadge />
|
||||
Projects <BetaBadge />
|
||||
</span>
|
||||
),
|
||||
icon: <Folder {...ICON} />,
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ describe("Navbar", () => {
|
|||
expect(screen.queryByRole("button", { name: /^notifications$/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should handle hide new features toggle", async () => {
|
||||
it("should handle hide new feature indicators toggle", async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
// Initially disabled
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue