"""Crisis detection and response.""" from __future__ import annotations import config def detect_crisis(text: str) -> bool: """Check if user message contains crisis indicators.""" text_lower = text.lower() return any(kw in text_lower for kw in config.CRISIS_KEYWORDS) def get_crisis_response() -> str: """Get the warm crisis response message.""" return ( "I hear you. What you're feeling right now matters, " "and you don't have to go through this alone." ) def get_crisis_banner_html() -> str: """Render crisis helpline banner as HTML.""" lines = [] for h in config.HELPLINES: lines.append(f"
{h['name']} — {h['contact']}
") return f"""
💜 You're not alone. Help is available:
{''.join(lines)}
"""