Config: Deep merge model overrides

Anything below the first level of kwargs was not being merged properly.
A more bulletproof solution would be to refactor the loading code
to separate draft and normal model parameters.

Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
This commit is contained in:
kingbri
2025-07-03 12:17:09 -04:00
parent 0152a1665b
commit d339139fb6
3 changed files with 22 additions and 10 deletions

View File

@@ -11,7 +11,7 @@ from ruamel.yaml.comments import CommentedMap, CommentedSeq
from ruamel.yaml.scalarstring import PreservedScalarString
from common.config_models import BaseConfigModel, TabbyConfigModel
from common.utils import merge_dicts, filter_none_values, unwrap
from common.utils import deep_merge_dicts, filter_none_values, unwrap
yaml = YAML(typ=["rt", "safe"])
@@ -36,7 +36,7 @@ class TabbyConfig(TabbyConfigModel):
# Remove None (aka unset) values from the configs and merge them together
# This should be less expensive than pruning the entire merged dictionary
configs = filter_none_values(configs)
merged_config = merge_dicts(*configs)
merged_config = deep_merge_dicts(*configs)
# validate and update config
merged_config_model = TabbyConfigModel.model_validate(merged_config)