Fix bug where -s could reset settings to defaults, closes #2389

This commit is contained in:
Simon Willison 2024-08-14 14:28:48 -07:00
commit bf953628bb
4 changed files with 70 additions and 1 deletions

View file

@ -1451,3 +1451,12 @@ async def calculate_etag(filepath, chunk_size=4096):
_etag_cache[filepath] = etag
return etag
def deep_dict_update(dict1, dict2):
for key, value in dict2.items():
if isinstance(value, dict):
dict1[key] = deep_dict_update(dict1.get(key, type(value)()), value)
else:
dict1[key] = value
return dict1