mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
feat: Track and copy only explicitly set fields in ModelSettings
This commit is contained in:
parent
e56112739c
commit
8cba1fdd71
1 changed files with 11 additions and 2 deletions
|
@ -82,6 +82,13 @@ class ModelSettings:
|
||||||
editor_model_name: Optional[str] = None
|
editor_model_name: Optional[str] = None
|
||||||
editor_edit_format: Optional[str] = None
|
editor_edit_format: Optional[str] = None
|
||||||
|
|
||||||
|
def __post_init__(self):
|
||||||
|
# Track which fields were explicitly set during initialization
|
||||||
|
self._set_fields = set()
|
||||||
|
for field in fields(self.__class__):
|
||||||
|
if field.name in self.__dict__:
|
||||||
|
self._set_fields.add(field.name)
|
||||||
|
|
||||||
|
|
||||||
# https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo
|
# https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo
|
||||||
# https://platform.openai.com/docs/models/gpt-3-5-turbo
|
# https://platform.openai.com/docs/models/gpt-3-5-turbo
|
||||||
|
@ -841,8 +848,10 @@ class Model(ModelSettings):
|
||||||
for field in fields(ModelSettings):
|
for field in fields(ModelSettings):
|
||||||
if skip_name and field.name == "name":
|
if skip_name and field.name == "name":
|
||||||
continue
|
continue
|
||||||
val = getattr(source, field.name)
|
# Only copy fields that were explicitly set in the source
|
||||||
setattr(self, field.name, val)
|
if hasattr(source, '_set_fields') and field.name in source._set_fields:
|
||||||
|
val = getattr(source, field.name)
|
||||||
|
setattr(self, field.name, val)
|
||||||
|
|
||||||
def configure_model_settings(self, model):
|
def configure_model_settings(self, model):
|
||||||
# Apply default settings first if they exist
|
# Apply default settings first if they exist
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue