Update main.py
Browse files
main.py
CHANGED
|
@@ -35,19 +35,19 @@ async def telegram_webhook(request: Request):
|
|
| 35 |
user_msg = data["message"]["text"].strip()
|
| 36 |
|
| 37 |
# 1. GEAR SHIFTER
|
|
|
|
| 38 |
if user_msg.lower() == "/pro":
|
| 39 |
-
user_engines[chat_id] = "gemini/gemini-
|
| 40 |
-
return {"method": "sendMessage", "chat_id": chat_id, "text": "🧠 Engine Switched: Gemini
|
| 41 |
elif user_msg.lower() == "/flash":
|
| 42 |
-
user_engines[chat_id] = "gemini/gemini-
|
| 43 |
-
return {"method": "sendMessage", "chat_id": chat_id, "text": "⚡ Engine Switched: Gemini
|
| 44 |
|
| 45 |
# 2. RUN AI
|
| 46 |
-
current_model = user_engines.get(chat_id, "gemini/gemini-
|
| 47 |
response_text = await run_agent(user_msg, current_model)
|
| 48 |
|
| 49 |
# 3. DIRECT WEBHOOK REPLY
|
| 50 |
-
# We respond directly to Telegram's knock. No background tasks, no httpx, no crashing.
|
| 51 |
return {
|
| 52 |
"method": "sendMessage",
|
| 53 |
"chat_id": chat_id,
|
|
|
|
| 35 |
user_msg = data["message"]["text"].strip()
|
| 36 |
|
| 37 |
# 1. GEAR SHIFTER
|
| 38 |
+
# Swapped to the active 2026 models
|
| 39 |
if user_msg.lower() == "/pro":
|
| 40 |
+
user_engines[chat_id] = "gemini/gemini-2.0-pro"
|
| 41 |
+
return {"method": "sendMessage", "chat_id": chat_id, "text": "🧠 Engine Switched: Gemini 2.0 Pro."}
|
| 42 |
elif user_msg.lower() == "/flash":
|
| 43 |
+
user_engines[chat_id] = "gemini/gemini-2.5-flash"
|
| 44 |
+
return {"method": "sendMessage", "chat_id": chat_id, "text": "⚡ Engine Switched: Gemini 2.5 Flash."}
|
| 45 |
|
| 46 |
# 2. RUN AI
|
| 47 |
+
current_model = user_engines.get(chat_id, "gemini/gemini-2.5-flash")
|
| 48 |
response_text = await run_agent(user_msg, current_model)
|
| 49 |
|
| 50 |
# 3. DIRECT WEBHOOK REPLY
|
|
|
|
| 51 |
return {
|
| 52 |
"method": "sendMessage",
|
| 53 |
"chat_id": chat_id,
|