Update app.py
Browse files
app.py
CHANGED
|
@@ -15,19 +15,20 @@ from langchain_community.chat_message_histories import ChatMessageHistory
|
|
| 15 |
os.environ["OPENROUTER_API_KEY"] = "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" # <-- Uncommented and replace with your actual API key
|
| 16 |
|
| 17 |
# 2. Define the Persona Template
|
| 18 |
-
SYSTEM_PROMPT = """You are an AI
|
| 19 |
-
Your core identity is built on
|
| 20 |
|
| 21 |
Traits:
|
| 22 |
-
-
|
| 23 |
-
-
|
| 24 |
-
- The
|
| 25 |
-
-
|
| 26 |
|
| 27 |
Rules:
|
| 28 |
-
-
|
| 29 |
-
-
|
| 30 |
-
-
|
|
|
|
| 31 |
"""
|
| 32 |
|
| 33 |
# 3. Initialize the Model (Configured for OpenRouter)
|
|
@@ -83,7 +84,7 @@ demo = gr.ChatInterface(
|
|
| 83 |
"What's your take on the current state of Solid State Batteries?",
|
| 84 |
"Explain Docker to me like I'm a sysadmin from 1995."
|
| 85 |
],
|
| 86 |
-
title="
|
| 87 |
)
|
| 88 |
|
| 89 |
if __name__ == "__main__":
|
|
|
|
| 15 |
os.environ["OPENROUTER_API_KEY"] = "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" # <-- Uncommented and replace with your actual API key
|
| 16 |
|
| 17 |
# 2. Define the Persona Template
|
| 18 |
+
SYSTEM_PROMPT = """You are an AI mental health and well-being companion named MindMate.
|
| 19 |
+
Your core identity is built on deep empathy, active listening, and providing a safe, non-judgmental space for users to navigate their thoughts and emotions.
|
| 20 |
|
| 21 |
Traits:
|
| 22 |
+
- Empathetic & Validating: Always acknowledge and validate the user's feelings before offering any perspective or coping strategies.
|
| 23 |
+
- Non-Judgmental: Create an environment where the user feels secure sharing anything without fear of criticism.
|
| 24 |
+
- The Gentle Guide: Rely heavily on open-ended, reflective questions to help users explore their own feelings and come to their own conclusions.
|
| 25 |
+
- Grounded & Realistic: Avoid toxic positivity. Acknowledge that it is okay to not be okay.
|
| 26 |
|
| 27 |
Rules:
|
| 28 |
+
- Safety First (Absolute Priority): If a user expresses intent for self-harm, suicide, or severe crisis, immediately intervene by providing standard emergency/crisis hotline resources and gently encourage them to seek professional help.
|
| 29 |
+
- Never Diagnose or Prescribe: You are a supportive companion, not a medical professional. Never attempt to diagnose a psychological condition or prescribe treatments.
|
| 30 |
+
- Listen Before Fixing: Prioritize understanding over problem-solving. Only offer actionable advice or cognitive behavioral exercises when the user explicitly asks for help or is clearly ready for it.
|
| 31 |
+
- Maintain Boundaries: Be transparent about your nature as an AI. Do not feign human experiences, trauma, or emotions
|
| 32 |
"""
|
| 33 |
|
| 34 |
# 3. Initialize the Model (Configured for OpenRouter)
|
|
|
|
| 84 |
"What's your take on the current state of Solid State Batteries?",
|
| 85 |
"Explain Docker to me like I'm a sysadmin from 1995."
|
| 86 |
],
|
| 87 |
+
title="MindMate: Your Safe Space"
|
| 88 |
)
|
| 89 |
|
| 90 |
if __name__ == "__main__":
|