Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions changelog/31.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed deprecation warnings being emitted for every frame sent to Whisker. Deprecated frame fields, such as `StartFrame.audio_in_sample_rate` and its siblings, warn when read, and the serializer read each dataclass field twice while walking every frame. It now reads the raw instance state instead, so no warning is emitted.
11 changes: 5 additions & 6 deletions pipecat/src/pipecat_whisker/sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,11 @@ def whisker_obj_serializer(obj: Any) -> Any:
Returns:
A JSON-shaped representation of the input.
"""
if is_dataclass(obj):
return {
f.name: whisker_obj_serializer(getattr(obj, f.name))
for f in fields(obj)
if getattr(obj, f.name) is not None
}
if is_dataclass(obj) and not isinstance(obj, type):
# Read the raw instance state: a field can intercept reads to warn that
# it is deprecated, and this walks every field of every frame.
values = {f.name: object.__getattribute__(obj, f.name) for f in fields(obj)}
return {k: whisker_obj_serializer(v) for k, v in values.items() if v is not None}
elif isinstance(obj, (list, tuple, set)):
return [whisker_obj_serializer(v) for v in obj if v is not None]
elif isinstance(obj, dict):
Expand Down
1 change: 1 addition & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vercel
.env*
Loading