Commit ·
04fc9bc
1
Parent(s): ab4add4
Updated prompt in app.py
Browse files
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) >=
|
| 38 |
-
start_index = random.randint(0, len(lines) -
|
| 39 |
-
return lines[start_index:start_index +
|
| 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
|
| 101 |
-
- Emphasize how the other user brings energy and small transformations to
|
| 102 |
-
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 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(
|