mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 05:39:16 +08:00
🐛 fix(loading.py): handle invalid JSON strings in kwargs by removing the key from params
This commit is contained in:
@ -60,7 +60,12 @@ def convert_kwargs(params):
|
||||
kwargs_keys = [key for key in params.keys() if "kwargs" in key or "config" in key]
|
||||
for key in kwargs_keys:
|
||||
if isinstance(params[key], str):
|
||||
params[key] = json.loads(params[key])
|
||||
try:
|
||||
params[key] = json.loads(params[key])
|
||||
except json.JSONDecodeError:
|
||||
# if the string is not a valid json string, we will
|
||||
# remove the key from the params
|
||||
params.pop(key, None)
|
||||
return params
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user