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:
Ishaan Jaff 2024-04-02 17:53:59 -07:00 committed by GitHub
commit 203a91864c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 100 additions and 61 deletions

View file

@ -142,12 +142,25 @@ const CreateKey: React.FC<CreateKeyProps> = ({
placeholder="Select models"
style={{ width: "100%" }}
>
<Option key="all-team-models" value="all-team-models">
All Team Models
</Option>
{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) => (
<Option key={model} value={model}>
{model}
</Option>
))
)
) : (
userModels.map((model: string) => (
<Option key={model} value={model}>
@ -156,7 +169,6 @@ const CreateKey: React.FC<CreateKeyProps> = ({
))
)}
</Select>
</Form.Item>
<Form.Item

View file

@ -116,16 +116,13 @@ const Team: React.FC<TeamProps> = ({
</Form.Item>
<Form.Item label="Models" name="models">
<Select2.Option key="all-proxy-models" value="all-proxy-models">
All Models on Proxy
All Proxy Models
</Select2.Option>
<Select2
mode="multiple"
placeholder="Select models"
style={{ width: "100%" }}
>
<Select2.Option key="all-proxy-models" value="all-proxy-models">
All Models on Proxy
</Select2.Option>
{userModels && userModels.map((model) => (
<Select2.Option key={model} value={model}>
{model}
@ -363,19 +360,26 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
{Array.isArray(team.models) ? (
<div style={{ display: "flex", flexDirection: "column" }}>
{team.models.length === 0 ? (
<Badge size={"xs"} className="mb-1" color="blue">
<Text>all-proxy-models</Text>
<Badge size={"xs"} className="mb-1" color="red">
<Text>All Proxy Models</Text>
</Badge>
) : (
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">
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
</Badge>
)
))
)}
</div>
) : null}
</TableCell>
<TableCell style={{ maxWidth: "4px", whiteSpace: "pre-wrap", overflow: "hidden" }}>
<Text>
TPM:{" "}
@ -484,7 +488,7 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
style={{ width: "100%" }}
>
<Select2.Option key="all-proxy-models" value="all-proxy-models">
All Models on Proxy
All Proxy Models
</Select2.Option>
{userModels.map((model) => (
<Select2.Option key={model} value={model}>

View file

@ -148,6 +148,9 @@ const ViewKeyTable: React.FC<ViewKeyTableProps> = ({
placeholder="Select models"
style={{ width: "100%" }}
>
<Option key="all-team-models" value="all-team-models">
All Team Models
</Option>
{selectedTeam && selectedTeam.models ? (
selectedTeam.models.map((model: string) => (
<Option key={model} value={model}>
@ -404,16 +407,26 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
</TableCell> */}
<TableCell>
<TableCell>
{Array.isArray(item.models) ? (
<div style={{ display: "flex", flexDirection: "column" }}>
{item.models.length === 0 ? (
<>
{selectedTeam && selectedTeam.models && selectedTeam.models.length > 0 ? (
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">
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
</Badge>
)
))
) : (
// 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) => (
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">
<Text>{model.length > 30 ? `${model.slice(0, 30)}...` : model}</Text>
</Badge>
)
))
)}
</div>
) : null}
</TableCell>
</TableCell>
<TableCell>
<Text>