Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions crawl4ai/async_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,18 @@ def from_serializable_dict(data: Any) -> Any:
if isinstance(data, (str, int, float, bool)):
return data

# Handle typed data
if isinstance(data, dict) and "type" in data:
# Handle typed data.
# Only enter the typed-object path for dicts that match the shapes produced
# by to_serializable_dict(): {"type": "<ClassName>", "params": {...}} or
# {"type": "dict", "value": {...}}. Plain business dicts that happen to
# carry a "type" key (e.g. JSON-Schema fragments, JsonCss field specs like
# {"type": "text", "name": "..."}) have neither "params" nor "value" and
# must fall through to the raw-dict path below so they are passed as data.
if (
isinstance(data, dict)
and "type" in data
and ("params" in data or (data["type"] == "dict" and "value" in data))
):
# Handle plain dictionaries
if data["type"] == "dict" and "value" in data:
return {k: from_serializable_dict(v) for k, v in data["value"].items()}
Expand Down