Wire dashboard context into Hearthkeeper

This commit is contained in:
2026-05-12 10:28:33 -05:00
parent c1d6032eb2
commit 74e3c0dcaa
7 changed files with 117 additions and 31 deletions

View File

@@ -7,11 +7,37 @@ class PromptTemplates:
"""Collection of prompt templates for different modes."""
@staticmethod
def gentle_prompt(current_theme: Optional[str] = None) -> str:
def gentle_prompt(
current_theme: Optional[str] = None,
dashboard: Optional[dict] = None,
recent_discussion: Optional[list[str]] = None,
) -> str:
"""Generate a gentle prompt when chat has been inactive."""
dashboard = dashboard or {}
recent_discussion = recent_discussion or []
context_lines = [
"Generate one brief Hearthkeeper prompt for a calm, reflective livestream.",
"The prompt must be restrained, thematic, and not engagement bait.",
]
if dashboard.get("stream_title"):
context_lines.append(f"Stream title: {dashboard['stream_title']}")
if dashboard.get("game"):
context_lines.append(f"Game: {dashboard['game']}")
if dashboard.get("mood"):
context_lines.append(f"Mood: {dashboard['mood']}")
if dashboard.get("content_angle"):
context_lines.append(f"Content angle: {dashboard['content_angle']}")
if dashboard.get("session_goals"):
goals = "; ".join(dashboard["session_goals"])
context_lines.append(f"Session goals: {goals}")
if current_theme:
return f"Gently prompt the chat about: {current_theme}"
return "Generate a gentle, inviting prompt to encourage discussion in the stream."
context_lines.append(f"Current theme: {current_theme}")
if recent_discussion:
context_lines.append("Recent human discussion:")
context_lines.extend(f"- {message}" for message in recent_discussion[:5])
return "\n".join(context_lines)
@staticmethod
def steward_response(message: str, context: Optional[str] = None) -> str: