From 21f9e5295bf484169d72f4538f7c926b5519723c Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 18 Jun 2026 10:47:25 +0200 Subject: [PATCH] refac --- .../3ff2c63645b8_reshape_config_to_per_key_rows.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/migrations/versions/3ff2c63645b8_reshape_config_to_per_key_rows.py b/backend/open_webui/migrations/versions/3ff2c63645b8_reshape_config_to_per_key_rows.py index 904bef4585..167862d709 100644 --- a/backend/open_webui/migrations/versions/3ff2c63645b8_reshape_config_to_per_key_rows.py +++ b/backend/open_webui/migrations/versions/3ff2c63645b8_reshape_config_to_per_key_rows.py @@ -443,11 +443,18 @@ LEGACY_KEY_TO_STORAGE_KEY = { def _walk_blob(data: dict, prefix: str = '') -> dict: - """Recursively walk a nested dict, yielding (dot.path, value) for leaf nodes.""" + """Recursively walk a nested config blob, preserving known config values. + + Some config values are intentionally dictionaries, e.g. OPENAI_API_CONFIGS + and OLLAMA_API_CONFIGS. Once the current path is a known config key, keep + that value intact instead of flattening its internals into orphaned rows. + """ result = {} for key, value in data.items(): path = f'{prefix}{key}' if not prefix else f'{prefix}.{key}' - if isinstance(value, dict): + if path in BLOB_PATH_TO_KEY or path in LEGACY_KEY_TO_STORAGE_KEY: + result[path] = value + elif isinstance(value, dict): result.update(_walk_blob(value, path)) else: result[path] = value