fix: replace getattr with direct metadata access on DataPart

This commit is contained in:
Greyson Lalonde
2026-03-14 02:55:35 -04:00
parent d653a40394
commit e6fa652364
2 changed files with 2 additions and 2 deletions

View File

@@ -84,7 +84,7 @@ class A2UIClientExtension:
root = part.root
if root.kind != "data":
continue
metadata = getattr(root, "metadata", None) or {}
metadata = root.metadata or {}
mime_type = metadata.get("mimeType", "")
if mime_type != A2UI_MIME_TYPE:
continue

View File

@@ -312,7 +312,7 @@ def get_part_content_type(part: Part) -> str:
if root.kind == "text":
return TEXT_PLAIN
if root.kind == "data":
metadata = getattr(root, "metadata", None) or {}
metadata = root.metadata or {}
mime = metadata.get("mimeType", "")
if mime == APPLICATION_A2UI_JSON:
return APPLICATION_A2UI_JSON