Skip to content

Commit 21f9e52

Browse files
committed
refac
1 parent 0ffc047 commit 21f9e52

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

backend/open_webui/migrations/versions/3ff2c63645b8_reshape_config_to_per_key_rows.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,18 @@
443443

444444

445445
def _walk_blob(data: dict, prefix: str = '') -> dict:
446-
"""Recursively walk a nested dict, yielding (dot.path, value) for leaf nodes."""
446+
"""Recursively walk a nested config blob, preserving known config values.
447+
448+
Some config values are intentionally dictionaries, e.g. OPENAI_API_CONFIGS
449+
and OLLAMA_API_CONFIGS. Once the current path is a known config key, keep
450+
that value intact instead of flattening its internals into orphaned rows.
451+
"""
447452
result = {}
448453
for key, value in data.items():
449454
path = f'{prefix}{key}' if not prefix else f'{prefix}.{key}'
450-
if isinstance(value, dict):
455+
if path in BLOB_PATH_TO_KEY or path in LEGACY_KEY_TO_STORAGE_KEY:
456+
result[path] = value
457+
elif isinstance(value, dict):
451458
result.update(_walk_blob(value, path))
452459
else:
453460
result[path] = value

0 commit comments

Comments
 (0)