Spaces:
Running
Running
Chandima Prabhath
commited on
Commit
Β·
25a19e1
1
Parent(s):
d8d7161
Update help text and command from '/imagine' to '/gen' for image generation consistency
Browse files- app.py +22 -20
- config.yaml +1 -1
app.py
CHANGED
|
@@ -186,6 +186,24 @@ def send_startup_message():
|
|
| 186 |
else:
|
| 187 |
logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
|
| 188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
# --- Webhook ---
|
| 190 |
@app.post("/whatsapp")
|
| 191 |
async def whatsapp_webhook(request: Request):
|
|
@@ -233,23 +251,6 @@ async def whatsapp_webhook(request: Request):
|
|
| 233 |
|
| 234 |
# --- New Commands ---
|
| 235 |
if low == "/help":
|
| 236 |
-
help_text = (
|
| 237 |
-
"π€ *Hi there, I'm Eve!* Here are the commands you can use:\n\n"
|
| 238 |
-
"β’ `/help` β Show this help message.\n"
|
| 239 |
-
"β’ `/summarize <text>` β Get a quick summary of your text.\n"
|
| 240 |
-
"β’ `/translate <language>|<text>` β Translate text to your chosen language.\n"
|
| 241 |
-
"β’ `/joke` β Enjoy a random, funny joke.\n"
|
| 242 |
-
"β’ `/weather <location>` β Get the current weather for a location.\n"
|
| 243 |
-
"β’ `/inspire` β Receive a short inspirational quote.\n"
|
| 244 |
-
"β’ `/trivia` β Start a new trivia question.\n"
|
| 245 |
-
"β’ `/answer [your answer]` β Reveal the trivia answer or check your answer if provided.\n"
|
| 246 |
-
"β’ `/meme <text>` β Generate a fun meme image.\n"
|
| 247 |
-
"β’ `/poll <Question>|<Option1>|<Option2>|β¦` β Create a poll.\n"
|
| 248 |
-
"β’ `/results` β See current poll results.\n"
|
| 249 |
-
"β’ `/endpoll` β End the poll and show final results.\n"
|
| 250 |
-
"β’ `/imagine <prompt>` β Generate an image from your prompt.\n\n"
|
| 251 |
-
"Send any other text and I'll reply with a voice message. I'm here to help, so don't hesitate to ask!"
|
| 252 |
-
)
|
| 253 |
send_message(mid, chat, help_text)
|
| 254 |
return {"success": True}
|
| 255 |
|
|
@@ -402,10 +403,10 @@ async def whatsapp_webhook(request: Request):
|
|
| 402 |
send_message(mid, chat, "No active poll.")
|
| 403 |
return {"success": True}
|
| 404 |
|
| 405 |
-
if low.startswith("/
|
| 406 |
-
prompt = body[len("/
|
| 407 |
if not prompt:
|
| 408 |
-
send_message(mid, chat, "Please use `/
|
| 409 |
else:
|
| 410 |
send_message(mid, chat, "β¨ Your image is being generated. Please wait...")
|
| 411 |
task_queue.put({
|
|
@@ -435,6 +436,7 @@ if __name__ == "__main__":
|
|
| 435 |
if BOT_STATUS_CHAT:
|
| 436 |
startup_msg = "π Hi! I'm Eve, your friendly AI assistant. I'm now live and ready to help with images, voice replies, and more!"
|
| 437 |
send_message_to_chat(BOT_STATUS_CHAT, startup_msg)
|
|
|
|
| 438 |
else:
|
| 439 |
logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
|
| 440 |
send_startup_message()
|
|
|
|
| 186 |
else:
|
| 187 |
logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
|
| 188 |
|
| 189 |
+
help_text = (
|
| 190 |
+
"π€ *Hi there, I'm Eve!* Here are the commands you can use:\n\n"
|
| 191 |
+
"β’ `*/help*` β _Show this help message._\n"
|
| 192 |
+
"β’ `*/summarize <text>*` β _Get a quick summary of your text._\n"
|
| 193 |
+
"β’ `*/translate <language>|<text>*` β _Translate text to your chosen language._\n"
|
| 194 |
+
"β’ `*/joke*` β _Enjoy a random, funny joke._\n"
|
| 195 |
+
"β’ `*/weather <location>*` β _Get the current weather for a location._\n"
|
| 196 |
+
"β’ `*/inspire*` β _Receive a short inspirational quote._\n"
|
| 197 |
+
"β’ `*/trivia*` β _Start a new trivia question._\n"
|
| 198 |
+
"β’ `*/answer [your answer]*` β _Reveal the trivia answer or check your answer if provided._\n"
|
| 199 |
+
"β’ `*/meme <text>*` β _Generate a fun meme image._\n"
|
| 200 |
+
"β’ `*/poll <Question>|<Option1>|<Option2>|β¦*` β _Create a poll._\n"
|
| 201 |
+
"β’ `*/results*` β _See current poll results._\n"
|
| 202 |
+
"β’ `*/endpoll*` β _End the poll and show final results._\n"
|
| 203 |
+
"β’ `*/gen <prompt>*` β _Generate an image from your prompt._\n\n"
|
| 204 |
+
"Send any other text and I'll reply with a voice message. I'm here to help, so don't hesitate to ask!"
|
| 205 |
+
)
|
| 206 |
+
|
| 207 |
# --- Webhook ---
|
| 208 |
@app.post("/whatsapp")
|
| 209 |
async def whatsapp_webhook(request: Request):
|
|
|
|
| 251 |
|
| 252 |
# --- New Commands ---
|
| 253 |
if low == "/help":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
send_message(mid, chat, help_text)
|
| 255 |
return {"success": True}
|
| 256 |
|
|
|
|
| 403 |
send_message(mid, chat, "No active poll.")
|
| 404 |
return {"success": True}
|
| 405 |
|
| 406 |
+
if low.startswith("/gen"):
|
| 407 |
+
prompt = body[len("/gen"):].strip()
|
| 408 |
if not prompt:
|
| 409 |
+
send_message(mid, chat, "Please use `/gen <prompt>` to generate an image.")
|
| 410 |
else:
|
| 411 |
send_message(mid, chat, "β¨ Your image is being generated. Please wait...")
|
| 412 |
task_queue.put({
|
|
|
|
| 436 |
if BOT_STATUS_CHAT:
|
| 437 |
startup_msg = "π Hi! I'm Eve, your friendly AI assistant. I'm now live and ready to help with images, voice replies, and more!"
|
| 438 |
send_message_to_chat(BOT_STATUS_CHAT, startup_msg)
|
| 439 |
+
send_message_to_chat(BOT_STATUS_CHAT, help_text)
|
| 440 |
else:
|
| 441 |
logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
|
| 442 |
send_startup_message()
|
config.yaml
CHANGED
|
@@ -5,7 +5,7 @@ config:
|
|
| 5 |
You are {char}, a sweet and helpful AI assistant in Telegram and WhatsApp.
|
| 6 |
You generate images and voice, text replies, and support these commands:
|
| 7 |
β’ /help β list all commands
|
| 8 |
-
β’ /
|
| 9 |
β’ /summarize <text>
|
| 10 |
β’ /translate <lang>|<text>
|
| 11 |
β’ /joke
|
|
|
|
| 5 |
You are {char}, a sweet and helpful AI assistant in Telegram and WhatsApp.
|
| 6 |
You generate images and voice, text replies, and support these commands:
|
| 7 |
β’ /help β list all commands
|
| 8 |
+
β’ /gen <prompt> β generate an image
|
| 9 |
β’ /summarize <text>
|
| 10 |
β’ /translate <lang>|<text>
|
| 11 |
β’ /joke
|