8000 No public description · goodrules/adk-python@32dc145 · GitHub
[go: up one dir, main page]

Skip to content

Commit 32dc145

Browse files
DeanChensjcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 749399264
1 parent 6742ab9 commit 32dc145

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/google/adk/sessions/database_session_service.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
from datetime import datetime
1818
import json
1919
import logging
20-
from typing import Any
21-
from typing import Optional
20+
from typing import Any, Optional
2221
import uuid
2322

23+
from google.genai import types
2424
from sqlalchemy import Boolean
2525
from sqlalchemy import delete
2626
from sqlalchemy import Dialect
@@ -136,7 +136,7 @@ class StorageEvent(Base):
136136
author: Mapped[str] = mapped_column(String)
137137
branch: Mapped[str] = mapped_column(String, nullable=True)
138138
timestamp: Mapped[DateTime] = mapped_column(DateTime(), default=func.now())
139-
content: Mapped[dict[str, Any]] = mapped_column(DynamicJSON)
139+
content: Mapped[dict[str, Any]] = mapped_column(DynamicJSON, nullable=True)
140140
actions: Mapped[MutableDict[str, Any]] = mapped_column(PickleType)
141141

142142
long_running_tool_ids_json: Mapped[Optional[str]] = mapped_column(
@@ -576,8 +576,12 @@ def _merge_state(app_state, user_state, session_state):
576576
return merged_state
577577

578578

579-
def _decode_content(content: dict[str, Any]) -> dict[str, Any]:
579+
def _decode_content(
580+
content: Optional[dict[str, Any]],
581+
) -> Optional[types.Content]:
582+
if not content:
583+
return None
580584
for p in content["parts"]:
581585
if "inline_data" in p:
582586
p["inline_data"]["data"] = base64.b64decode(p["inline_data"]["data"][0])
583-
return content
587+
return types.Content.model_validate(content)

0 commit comments

Comments
 (0)
0