mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
Update conditional_public_model_name.tsx (#11713)
This commit is contained in:
parent
d895ae827d
commit
edc84b6b6d
1 changed files with 8 additions and 5 deletions
|
|
@ -40,11 +40,14 @@ const ConditionalPublicModelName: React.FC = () => {
|
|||
const currentMappings = form.getFieldValue('model_mappings') || [];
|
||||
|
||||
// Only update if the mappings don't exist or don't match the selected models
|
||||
const shouldUpdateMappings = currentMappings.length !== selectedModels.length ||
|
||||
!selectedModels.every(model =>
|
||||
currentMappings.some((mapping: { public_name: string; litellm_model: string }) =>
|
||||
mapping.public_name === model ||
|
||||
(model === 'custom' && mapping.public_name === customModelName)));
|
||||
const shouldUpdateMappings = currentMappings.length !== selectedModels.length ||
|
||||
!selectedModels.every(model =>
|
||||
currentMappings.some((mapping: { public_name: string; litellm_model: string }) => {
|
||||
if (model === 'custom') {
|
||||
return mapping.litellm_model === 'custom' || mapping.litellm_model === customModelName;
|
||||
}
|
||||
return mapping.litellm_model === model;
|
||||
}));
|
||||
|
||||
if (shouldUpdateMappings) {
|
||||
const mappings = selectedModels.map((model: string) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue