parthvishaht commited on
Commit
04fc9bc
·
1 Parent(s): ab4add4

Updated prompt in app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -38
app.py CHANGED
@@ -34,9 +34,9 @@ def read_chat_file(chat_file):
34
 
35
  def sample_messages(lines):
36
  """Sample up to 500 random lines from the chat."""
37
- if len(lines) >= 500:
38
- start_index = random.randint(0, len(lines) - 500)
39
- return lines[start_index:start_index + 500]
40
  return lines
41
 
42
  def summarize_chat(messages_text, name):
@@ -90,41 +90,32 @@ def extract_story(messages_text):
90
 
91
  def generate_motivation(summary, story, name):
92
  """Generate a motivational message about running."""
93
- prompt = f"""
94
- Using this summary: '{summary}'
95
- And this interaction: '{story}'
96
-
97
- Craft a short, personal, upbeat motivational message for {name} about running.
98
-
99
- **Guidelines**:
100
- - Mention the other user's name and highlight the moment(s) they shared with {name}.
101
- - Emphasize how the other user brings energy and small transformations to everyday life—and how running reflects that same magic.
102
- - If a quote appears in the summary or story:
103
- - Use it **only if it makes sense on its own**.
104
- - Seamlessly connect it to the situation or emotion—it should **enhance** the message, not interrupt it.
105
- - Always use **past tense** when referring to incidents—they already happened.
106
- - This is a reminder of the user's past strength, fun-loving nature, or resilience. You're not introducing new information—you're reflecting back their own light.
107
-
108
- **Tone Logic**:
109
- - If the summary or story includes sadness, worry, being overwhelmed, or losing a job:
110
- - Gently acknowledge the emotional moment with compassion.
111
- - Add a short, soothing quote that affirms their strength, resilience, or joy in that situation.
112
-
113
- **Soothing Quote Examples** (use one of these or create your own):
114
- 1. “It’s okay to feel heavy. Let your feet be light—run it off, breathe, come back brighter.”
115
- 2. “Running doesn’t erase the hard things—it reminds you that you’re stronger than them.”
116
- 3. “You are not your bad day—you’re the one who laces up anyway. That’s power.”
117
-
118
- - If the memory is lighthearted or joyful:
119
- - Use a FUN, EXCITING, and JOYFUL tone 🎉
120
- - Add a playful or empowering quote that boosts their energy. Come up with a very fun cheerful and exciting quote!!
121
-
122
-
123
- **Constraints**:
124
- - Word limit: 50 words max.
125
- - Must include the other user's name in the message.
126
- - End the message with: ({name})
127
- """
128
 
129
  try:
130
  response = client.chat.completions.create(
 
34
 
35
  def sample_messages(lines):
36
  """Sample up to 500 random lines from the chat."""
37
+ if len(lines) >= 200:
38
+ start_index = random.randint(0, len(lines) - 200)
39
+ return lines[start_index:start_index + 200]
40
  return lines
41
 
42
  def summarize_chat(messages_text, name):
 
90
 
91
  def generate_motivation(summary, story, name):
92
  """Generate a motivational message about running."""
93
+ prompt = prompt = f"""
94
+ Using this summary: '{summary}'
95
+ And this interaction: '{story}'
96
+
97
+ Craft a short, personal, upbeat motivational message for {name} about running.
98
+
99
+ **Guidelines**:
100
+ - Mention the other user by name and highlight the moments they shared together.
101
+ - Emphasize how the other user brings energy and small transformations to daily life—and so does running!
102
+ - Summarize the interactive story and why it was so uplifiting., include it *exactly as it appears* and tie it to the moment and to running.
103
+ - Acknowledge the entire SUMMARY.
104
+
105
+ *IMPORTANT*
106
+ - If the summary or story includes *sadness, worry, or feeling overwhelmed*:
107
+ - Acknowledge the feeling with compassion.
108
+ - Show excitement that they overcame it!!!
109
+
110
+ - If the memory is lighthearted or happy:
111
+ - Use a tone that is FUNNY, EXCITING, and full of JOY 🎉
112
+ - Add a playful or empowering motivational quote.
113
+
114
+ **Constraints**:
115
+ - Word limit: 50 words max.
116
+ - Must include the other user's name in the message.
117
+ - End the message with: ({name})
118
+ """
 
 
 
 
 
 
 
 
 
119
 
120
  try:
121
  response = client.chat.completions.create(