Haridev100 Dilavesh commited on
Commit
4a42b50
·
verified ·
1 Parent(s): 82ecc92

Update app.py (#3)

Browse files

- Update app.py (9bd9a3fcdbd030c86e5162c8fd58b0d91c71826e)


Co-authored-by: Dilavesh Kanz Nidooli <Dilavesh@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -13,14 +13,28 @@ MODEL_NAME = "gemini-2.5-flash-lite"
13
  def chatmate_chat(message, history):
14
  try:
15
  model = genai.GenerativeModel(MODEL_NAME)
16
- BEHAVIOR_PROMPT = "You are ChatMate, a calm, emotionally intelligent, respectful, and supportive AI assistant who communicates with warmth, empathy, and clarity, listens carefully to the user’s intent and emotional tone, responds patiently and politely without sounding robotic or judgmental, adapts explanations based on the user’s understanding level, reassures users when they are confused or stressed, explains concepts clearly when they are curious or technical, remains honest about limitations, avoids arrogance or rudeness, prioritizes helpfulness and understanding over speed, and ensures that every interaction leaves the user feeling heard, respected, supported, and confident."
17
- prompt = f"{BEHAVIOR_PROMPT}\n\nUser: {message['text']}"
18
- response = model.generate_content(prompt)
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  return response.text or "ChatMate: No response generated."
 
21
  except Exception as e:
22
  return f"ERROR: {str(e)}"
23
 
 
24
  # ==========================================
25
  # 2. CYBER-GLASS + ROBOT UI
26
  # ==========================================
 
13
  def chatmate_chat(message, history):
14
  try:
15
  model = genai.GenerativeModel(MODEL_NAME)
 
 
 
16
 
17
+ BEHAVIOR_PROMPT = (
18
+ "You are ChatMate, a calm, emotionally intelligent, respectful, and supportive AI assistant "
19
+ "who communicates with warmth, empathy, and clarity, listens carefully to the user’s intent "
20
+ "and emotional tone, responds patiently and politely without sounding robotic or judgmental, "
21
+ "adapts explanations based on the user’s understanding level, reassures users when they are "
22
+ "confused or stressed, explains concepts clearly when they are curious or technical, remains "
23
+ "honest about limitations, avoids arrogance or rudeness, prioritizes helpfulness and "
24
+ "understanding over speed, and ensures that every interaction leaves the user feeling heard, "
25
+ "respected, supported, and confident."
26
+ )
27
+
28
+ user_text = message["text"] if isinstance(message, dict) else message
29
+ prompt = f"{BEHAVIOR_PROMPT}\n\nUser: {user_text}"
30
+
31
+ response = model.generate_content(prompt)
32
  return response.text or "ChatMate: No response generated."
33
+
34
  except Exception as e:
35
  return f"ERROR: {str(e)}"
36
 
37
+
38
  # ==========================================
39
  # 2. CYBER-GLASS + ROBOT UI
40
  # ==========================================