forked from phoenix/litellm-mirror
ui - fix bug showing mdoels to pic
This commit is contained in:
parent
2f9418eb46
commit
0e891528b6
1 changed files with 28 additions and 18 deletions
|
@ -39,6 +39,7 @@ const CreateKey: React.FC<CreateKeyProps> = ({
|
||||||
const [apiKey, setApiKey] = useState(null);
|
const [apiKey, setApiKey] = useState(null);
|
||||||
const [softBudget, setSoftBudget] = useState(null);
|
const [softBudget, setSoftBudget] = useState(null);
|
||||||
const [userModels, setUserModels] = useState([]);
|
const [userModels, setUserModels] = useState([]);
|
||||||
|
const [modelsToPick, setModelsToPick] = useState([]);
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
setIsModalVisible(false);
|
setIsModalVisible(false);
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
|
@ -95,6 +96,30 @@ const CreateKey: React.FC<CreateKeyProps> = ({
|
||||||
message.success('API Key copied to clipboard');
|
message.success('API Key copied to clipboard');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let tempModelsToPick = [];
|
||||||
|
|
||||||
|
if (team) {
|
||||||
|
if (team.models.length > 0) {
|
||||||
|
if (team.models.includes("all-proxy-models")) {
|
||||||
|
// if the team has all-proxy-models show all available models
|
||||||
|
tempModelsToPick = userModels;
|
||||||
|
} else {
|
||||||
|
// show team models
|
||||||
|
tempModelsToPick = team.models;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// show all available models if the team has no models set
|
||||||
|
tempModelsToPick = userModels;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// no team set, show all available models
|
||||||
|
tempModelsToPick = userModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
setModelsToPick(tempModelsToPick);
|
||||||
|
}, [team, userModels]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -161,30 +186,15 @@ const CreateKey: React.FC<CreateKeyProps> = ({
|
||||||
<Option key="all-team-models" value="all-team-models">
|
<Option key="all-team-models" value="all-team-models">
|
||||||
All Team Models
|
All Team Models
|
||||||
</Option>
|
</Option>
|
||||||
{team && team.models ? (
|
{
|
||||||
team.models.includes("all-proxy-models") ? (
|
modelsToPick.map((model: string) => (
|
||||||
userModels.map((model: string) => (
|
|
||||||
(
|
(
|
||||||
<Option key={model} value={model}>
|
<Option key={model} value={model}>
|
||||||
{model}
|
{model}
|
||||||
</Option>
|
</Option>
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
) : (
|
}
|
||||||
team.models.map((model: string) => (
|
|
||||||
<Option key={model} value={model}>
|
|
||||||
{model}
|
|
||||||
</Option>
|
|
||||||
))
|
|
||||||
)
|
|
||||||
) : (
|
|
||||||
userModels.map((model: string) => (
|
|
||||||
<Option key={model} value={model}>
|
|
||||||
{model}
|
|
||||||
</Option>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
|
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Accordion className="mt-20 mb-8" >
|
<Accordion className="mt-20 mb-8" >
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue