fix(app): pass image metadata as stringified json

This commit is contained in:
psychedelicious 2024-05-18 08:55:15 +10:00
parent 985ef89825
commit b0cfca9d24
2 changed files with 3 additions and 4 deletions

View File

@ -80,7 +80,7 @@ class ImageRecordStorageBase(ABC):
starred: Optional[bool] = False, starred: Optional[bool] = False,
session_id: Optional[str] = None, session_id: Optional[str] = None,
node_id: Optional[str] = None, node_id: Optional[str] = None,
metadata: Optional[MetadataField] = None, metadata: Optional[str] = None,
) -> datetime: ) -> datetime:
"""Saves an image record.""" """Saves an image record."""
pass pass

View File

@ -328,10 +328,9 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
starred: Optional[bool] = False, starred: Optional[bool] = False,
session_id: Optional[str] = None, session_id: Optional[str] = None,
node_id: Optional[str] = None, node_id: Optional[str] = None,
metadata: Optional[MetadataField] = None, metadata: Optional[str] = None,
) -> datetime: ) -> datetime:
try: try:
metadata_json = metadata.model_dump_json() if metadata is not None else None
self._lock.acquire() self._lock.acquire()
self._cursor.execute( self._cursor.execute(
"""--sql """--sql
@ -358,7 +357,7 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
height, height,
node_id, node_id,
session_id, session_id,
metadata_json, metadata,
is_intermediate, is_intermediate,
starred, starred,
has_workflow, has_workflow,