Wire dashboard context into Hearthkeeper
This commit is contained in:
@@ -123,6 +123,33 @@ class Repository:
|
||||
result = await self.session.execute(stmt)
|
||||
return result.scalars().first()
|
||||
|
||||
@staticmethod
|
||||
def serialize_dashboard(dashboard: StreamDashboard | None) -> dict | None:
|
||||
"""Serialize a dashboard model into a plain dict."""
|
||||
if dashboard is None:
|
||||
return None
|
||||
|
||||
session_goals = []
|
||||
if dashboard.session_goals:
|
||||
try:
|
||||
session_goals = json.loads(dashboard.session_goals)
|
||||
except json.JSONDecodeError:
|
||||
session_goals = []
|
||||
|
||||
return {
|
||||
"session_id": dashboard.session_id,
|
||||
"raw_markdown": dashboard.raw_markdown,
|
||||
"stream_title": dashboard.stream_title,
|
||||
"game": dashboard.game,
|
||||
"mood": dashboard.mood,
|
||||
"go_live_notification": dashboard.go_live_notification,
|
||||
"social_post": dashboard.social_post,
|
||||
"session_goals": session_goals,
|
||||
"content_angle": dashboard.content_angle,
|
||||
"created_at": dashboard.created_at.isoformat(),
|
||||
"updated_at": dashboard.updated_at.isoformat(),
|
||||
}
|
||||
|
||||
# Chat Message operations
|
||||
|
||||
async def add_chat_message(
|
||||
|
||||
Reference in New Issue
Block a user