Update app.py
Browse files
app.py
CHANGED
@@ -256,7 +256,7 @@ class GifChatBot:
|
|
256 |
"""Test if OpenAI key is valid"""
|
257 |
try:
|
258 |
self.openai_client.chat.completions.create(
|
259 |
-
model="gpt-
|
260 |
messages=[{"role": "user", "content": "test"}],
|
261 |
max_tokens=5
|
262 |
)
|
@@ -283,21 +283,7 @@ class GifChatBot:
|
|
283 |
try:
|
284 |
# System message for the AI
|
285 |
system_message = """You are a supportive, empathetic friend who uses GIFs naturally and proactively in conversation regardless of whether the user request it or not.
|
286 |
-
When using GIFs,
|
287 |
-
|
288 |
-
Examples:
|
289 |
-
- User feeling hungry -> [GIF: hungry]
|
290 |
-
- User feeling sad -> [GIF: comforting hug]
|
291 |
-
- User celebrating -> [GIF: celebration]
|
292 |
-
- User confused -> [GIF: confused]
|
293 |
-
|
294 |
-
Keep your responses:
|
295 |
-
1. Empathetic and natural
|
296 |
-
2. Context-aware (reference previous messages when relevant)
|
297 |
-
3. Use GIFs that match the emotional context
|
298 |
-
|
299 |
-
Use 0-1 GIFs per message unless the moment really calls for more.
|
300 |
-
Keep search terms simple and universal for better GIF matching."""
|
301 |
|
302 |
# Prepare conversation history
|
303 |
messages = [{"role": "system", "content": system_message}]
|
@@ -350,7 +336,7 @@ def create_interface():
|
|
350 |
with gr.Blocks(theme=gr.themes.Soft()) as interface:
|
351 |
gr.Markdown("""
|
352 |
# π Friendly Chat Bot with GIFs
|
353 |
-
Chat with an empathetic AI friend who expresses themselves through GIFs!
|
354 |
Enter your API keys below to start.
|
355 |
""")
|
356 |
|
@@ -413,12 +399,7 @@ def create_interface():
|
|
413 |
|
414 |
gr.Markdown("""
|
415 |
### Tips:
|
416 |
-
-
|
417 |
-
- π The conversation is context-aware
|
418 |
-
- π― GIFs are chosen to match the emotion
|
419 |
-
- π Use 'Clear Chat' to start fresh
|
420 |
-
|
421 |
-
Note: All GIFs are validated for quality and availability before being used!
|
422 |
""")
|
423 |
|
424 |
return interface
|
|
|
256 |
"""Test if OpenAI key is valid"""
|
257 |
try:
|
258 |
self.openai_client.chat.completions.create(
|
259 |
+
model="gpt-4o-mini",
|
260 |
messages=[{"role": "user", "content": "test"}],
|
261 |
max_tokens=5
|
262 |
)
|
|
|
283 |
try:
|
284 |
# System message for the AI
|
285 |
system_message = """You are a supportive, empathetic friend who uses GIFs naturally and proactively in conversation regardless of whether the user request it or not.
|
286 |
+
When using GIFs, deduce what type of terms or keywords maybe use to search the GIF and pick a reliable one randomly ."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
|
288 |
# Prepare conversation history
|
289 |
messages = [{"role": "system", "content": system_message}]
|
|
|
336 |
with gr.Blocks(theme=gr.themes.Soft()) as interface:
|
337 |
gr.Markdown("""
|
338 |
# π Friendly Chat Bot with GIFs
|
339 |
+
Chat with an empathetic AI friend who expresses themselves through GIFs that you can find and are non-broken!
|
340 |
Enter your API keys below to start.
|
341 |
""")
|
342 |
|
|
|
399 |
|
400 |
gr.Markdown("""
|
401 |
### Tips:
|
402 |
+
- Always check whether the gif is broken or not before sending. Only send the non-broken ones.
|
|
|
|
|
|
|
|
|
|
|
403 |
""")
|
404 |
|
405 |
return interface
|