mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Merge pull request #2807 from BerriAI/litellm_support_all_team_models_as_ui_alias
UI - use all-team-models as an alias
This commit is contained in:
commit
203a91864c
3 changed files with 100 additions and 61 deletions
|
@ -142,12 +142,25 @@ const CreateKey: React.FC<CreateKeyProps> = ({
|
||||||
placeholder="Select models"
|
placeholder="Select models"
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
>
|
>
|
||||||
|
<Option key="all-team-models" value="all-team-models">
|
||||||
|
All Team Models
|
||||||
|
</Option>
|
||||||
{team && team.models ? (
|
{team && team.models ? (
|
||||||
|
team.models.includes("all-proxy-models") ? (
|
||||||
|
userModels.map((model: string) => (
|
||||||
|
(
|
||||||
|
<Option key={model} value={model}>
|
||||||
|
{model}
|
||||||
|
</Option>
|
||||||
|
)
|
||||||
|
))
|
||||||
|
) : (
|
||||||
team.models.map((model: string) => (
|
team.models.map((model: string) => (
|
||||||
<Option key={model} value={model}>
|
<Option key={model} value={model}>
|
||||||
{model}
|
{model}
|
||||||
</Option>
|
</Option>
|
||||||
))
|
))
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
userModels.map((model: string) => (
|
userModels.map((model: string) => (
|
||||||
<Option key={model} value={model}>
|
<Option key={model} value={model}>
|
||||||
|
@ -156,7 +169,6 @@ const CreateKey: React.FC<CreateKeyProps> = ({
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|
|
@ -116,16 +116,13 @@ const Team: React.FC<TeamProps> = ({
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="Models" name="models">
|
<Form.Item label="Models" name="models">
|
||||||
<Select2.Option key="all-proxy-models" value="all-proxy-models">
|
<Select2.Option key="all-proxy-models" value="all-proxy-models">
|
||||||
All Models on Proxy
|
All Proxy Models
|
||||||
</Select2.Option>
|
</Select2.Option>
|
||||||
<Select2
|
<Select2
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
placeholder="Select models"
|
placeholder="Select models"
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
>
|
>
|
||||||
<Select2.Option key="all-proxy-models" value="all-proxy-models">
|
|
||||||
All Models on Proxy
|
|
||||||
</Select2.Option>
|
|
||||||
{userModels && userModels.map((model) => (
|
{userModels && userModels.map((model) => (
|
||||||
<Select2.Option key={model} value={model}>
|
<Select2.Option key={model} value={model}>
|
||||||
{model}
|
{model}
|
||||||
|
@ -363,19 +360,26 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
||||||
{Array.isArray(team.models) ? (
|
{Array.isArray(team.models) ? (
|
||||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||||
{team.models.length === 0 ? (
|
{team.models.length === 0 ? (
|
||||||
<Badge size={"xs"} className="mb-1" color="blue">
|
<Badge size={"xs"} className="mb-1" color="red">
|
||||||
<Text>all-proxy-models</Text>
|
<Text>All Proxy Models</Text>
|
||||||
</Badge>
|
</Badge>
|
||||||
) : (
|
) : (
|
||||||
team.models.map((model: string, index: number) => (
|
team.models.map((model: string, index: number) => (
|
||||||
|
model === "all-proxy-models" ? (
|
||||||
|
<Badge key={index} size={"xs"} className="mb-1" color="red">
|
||||||
|
<Text>All Proxy Models</Text>
|
||||||
|
</Badge>
|
||||||
|
) : (
|
||||||
<Badge key={index} size={"xs"} className="mb-1" color="blue">
|
<Badge key={index} size={"xs"} className="mb-1" color="blue">
|
||||||
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
|
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
|
||||||
</Badge>
|
</Badge>
|
||||||
|
)
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
<TableCell style={{ maxWidth: "4px", whiteSpace: "pre-wrap", overflow: "hidden" }}>
|
<TableCell style={{ maxWidth: "4px", whiteSpace: "pre-wrap", overflow: "hidden" }}>
|
||||||
<Text>
|
<Text>
|
||||||
TPM:{" "}
|
TPM:{" "}
|
||||||
|
@ -484,7 +488,7 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
>
|
>
|
||||||
<Select2.Option key="all-proxy-models" value="all-proxy-models">
|
<Select2.Option key="all-proxy-models" value="all-proxy-models">
|
||||||
All Models on Proxy
|
All Proxy Models
|
||||||
</Select2.Option>
|
</Select2.Option>
|
||||||
{userModels.map((model) => (
|
{userModels.map((model) => (
|
||||||
<Select2.Option key={model} value={model}>
|
<Select2.Option key={model} value={model}>
|
||||||
|
|
|
@ -148,6 +148,9 @@ const ViewKeyTable: React.FC<ViewKeyTableProps> = ({
|
||||||
placeholder="Select models"
|
placeholder="Select models"
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
>
|
>
|
||||||
|
<Option key="all-team-models" value="all-team-models">
|
||||||
|
All Team Models
|
||||||
|
</Option>
|
||||||
{selectedTeam && selectedTeam.models ? (
|
{selectedTeam && selectedTeam.models ? (
|
||||||
selectedTeam.models.map((model: string) => (
|
selectedTeam.models.map((model: string) => (
|
||||||
<Option key={model} value={model}>
|
<Option key={model} value={model}>
|
||||||
|
@ -404,16 +407,26 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
||||||
|
|
||||||
</TableCell> */}
|
</TableCell> */}
|
||||||
|
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{Array.isArray(item.models) ? (
|
{Array.isArray(item.models) ? (
|
||||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||||
{item.models.length === 0 ? (
|
{item.models.length === 0 ? (
|
||||||
<>
|
<>
|
||||||
{selectedTeam && selectedTeam.models && selectedTeam.models.length > 0 ? (
|
{selectedTeam && selectedTeam.models && selectedTeam.models.length > 0 ? (
|
||||||
selectedTeam.models.map((model: string, index: number) => (
|
selectedTeam.models.map((model: string, index: number) => (
|
||||||
|
model === "all-proxy-models" ? (
|
||||||
|
<Badge key={index} size={"xs"} className="mb-1" color="red">
|
||||||
|
<Text>All Proxy Models</Text>
|
||||||
|
</Badge>
|
||||||
|
) : model === "all-team-models" ? (
|
||||||
|
<Badge key={index} size={"xs"} className="mb-1" color="red">
|
||||||
|
<Text>All Team Models</Text>
|
||||||
|
</Badge>
|
||||||
|
) : (
|
||||||
<Badge key={index} size={"xs"} className="mb-1" color="blue">
|
<Badge key={index} size={"xs"} className="mb-1" color="blue">
|
||||||
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
|
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
|
||||||
</Badge>
|
</Badge>
|
||||||
|
)
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
// If selected team is None or selected team's models are empty, show all models
|
// If selected team is None or selected team's models are empty, show all models
|
||||||
|
@ -424,14 +437,24 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
item.models.map((model: string, index: number) => (
|
item.models.map((model: string, index: number) => (
|
||||||
|
model === "all-proxy-models" ? (
|
||||||
|
<Badge key={index} size={"xs"} className="mb-1" color="red">
|
||||||
|
<Text>All Proxy Models</Text>
|
||||||
|
</Badge>
|
||||||
|
) : model === "all-team-models" ? (
|
||||||
|
<Badge key={index} size={"xs"} className="mb-1" color="red">
|
||||||
|
<Text>All Team Models</Text>
|
||||||
|
</Badge>
|
||||||
|
) : (
|
||||||
<Badge key={index} size={"xs"} className="mb-1" color="blue">
|
<Badge key={index} size={"xs"} className="mb-1" color="blue">
|
||||||
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
|
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
|
||||||
</Badge>
|
</Badge>
|
||||||
|
)
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Text>
|
<Text>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue