Merge pull request #15160 from danielaskdd/fix-whitespace-handling

Fix(critical) : Preserve Whitespace Characters in Model Response Streams
This commit is contained in:
Krish Dholakia 2025-10-03 15:23:07 -07:00 committed by GitHub
commit f05dc27551
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -84,7 +84,9 @@ def _has_meaningful_content(value: Any) -> bool:
return False
if isinstance(value, str):
return len(value.strip()) > 0
# Don't strip whitespace - preserve all content including newlines, spaces, etc.
# Even pure whitespace characters like '\n' or ' ' are meaningful content
return len(value) > 0
if isinstance(value, (list, dict)):
return len(value) > 0