mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
Create Team Model Dropdown fix
This commit is contained in:
parent
917997cf79
commit
6e99faeced
4 changed files with 18 additions and 7 deletions
|
|
@ -616,13 +616,13 @@ describe("OldTeams - Default Team Settings tab visibility", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("OldTeams - all-proxy-models dropdown visibility", () => {
|
||||
describe("OldTeams - models dropdown options", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(fetchAvailableModelsForTeamOrKey).mockResolvedValue(["gpt-4", "gpt-3.5-turbo"]);
|
||||
});
|
||||
|
||||
it("should not show all-proxy-models option when user has no access to it", async () => {
|
||||
it("should not render all-proxy-models option in models select", async () => {
|
||||
vi.mocked(fetchAvailableModelsForTeamOrKey).mockResolvedValue(["gpt-4", "gpt-3.5-turbo"]);
|
||||
|
||||
render(
|
||||
|
|
|
|||
|
|
@ -1158,11 +1158,6 @@ const Teams: React.FC<TeamProps> = ({
|
|||
name="models"
|
||||
>
|
||||
<Select2 mode="multiple" placeholder="Select models" style={{ width: "100%" }}>
|
||||
{(isProxyAdminRole(userRole || "") || userModels.includes("all-proxy-models")) && (
|
||||
<Select2.Option key="all-proxy-models" value="all-proxy-models">
|
||||
All Proxy Models
|
||||
</Select2.Option>
|
||||
)}
|
||||
<Select2.Option key="no-default-models" value="no-default-models">
|
||||
No Default Models
|
||||
</Select2.Option>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { getModelDisplayName } from "./fetch_available_models_team_key";
|
||||
|
||||
describe("getModelDisplayName", () => {
|
||||
it("should return display label for all proxy models", () => {
|
||||
expect(getModelDisplayName("all-proxy-models")).toBe("All Proxy Models");
|
||||
});
|
||||
|
||||
it("should return provider-wide label for wildcard models", () => {
|
||||
expect(getModelDisplayName("openai/*")).toBe("All openai models");
|
||||
});
|
||||
});
|
||||
|
|
@ -36,6 +36,9 @@ export const fetchAvailableModelsForTeamOrKey = async (
|
|||
};
|
||||
|
||||
export const getModelDisplayName = (model: string) => {
|
||||
if (model === "all-proxy-models") {
|
||||
return "All Proxy Models";
|
||||
}
|
||||
if (model.endsWith("/*")) {
|
||||
const provider = model.replace("/*", "");
|
||||
return `All ${provider} models`;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue