feat: Apply generic model settings when no exact model match found

This commit is contained in:
Paul Gauthier (aider) 2024-11-19 10:02:25 -08:00
parent 76f8791f3c
commit 2a80d9c555

View file

@ -850,14 +850,20 @@ class Model(ModelSettings):
self._copy_fields(self.default_model_settings) self._copy_fields(self.default_model_settings)
# Look for exact model match # Look for exact model match
exact_match = False
for ms in MODEL_SETTINGS: for ms in MODEL_SETTINGS:
# direct match, or match "provider/<model>" # direct match, or match "provider/<model>"
if model == ms.name: if model == ms.name:
self._copy_fields(ms, skip_name=False) self._copy_fields(ms, skip_name=False)
exact_match = True
break # Continue to apply overrides break # Continue to apply overrides
model = model.lower() model = model.lower()
# If no exact match, try generic settings
if not exact_match:
self.apply_generic_model_settings(model)
# Apply override settings last if they exist # Apply override settings last if they exist
if self.override_model_settings: if self.override_model_settings:
self._copy_fields(self.override_model_settings) self._copy_fields(self.override_model_settings)