Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,6 @@ GEMINI_KEY = os.environ.get('GEMINI_KEY')
|
|
| 7 |
SEU_ID_TELEGRAM = int(os.environ.get('SEU_ID'))
|
| 8 |
|
| 9 |
genai.configure(api_key=GEMINI_KEY)
|
| 10 |
-
|
| 11 |
-
# AQUI ESTÁ O SEGREDO: Usamos o modelo estável
|
| 12 |
model = genai.GenerativeModel('gemini-1.5-flash')
|
| 13 |
|
| 14 |
bot = telebot.TeleBot(TELEGRAM_TOKEN)
|
|
@@ -18,13 +16,13 @@ def responder(message):
|
|
| 18 |
if message.from_user.id != SEU_ID_TELEGRAM:
|
| 19 |
return
|
| 20 |
try:
|
| 21 |
-
#
|
| 22 |
response = model.generate_content(message.text)
|
| 23 |
bot.reply_to(message, response.text)
|
| 24 |
except Exception as e:
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
if __name__ == "__main__":
|
| 29 |
bot.infinity_polling()
|
| 30 |
-
|
|
|
|
| 7 |
SEU_ID_TELEGRAM = int(os.environ.get('SEU_ID'))
|
| 8 |
|
| 9 |
genai.configure(api_key=GEMINI_KEY)
|
|
|
|
|
|
|
| 10 |
model = genai.GenerativeModel('gemini-1.5-flash')
|
| 11 |
|
| 12 |
bot = telebot.TeleBot(TELEGRAM_TOKEN)
|
|
|
|
| 16 |
if message.from_user.id != SEU_ID_TELEGRAM:
|
| 17 |
return
|
| 18 |
try:
|
| 19 |
+
# Tenta gerar a resposta
|
| 20 |
response = model.generate_content(message.text)
|
| 21 |
bot.reply_to(message, response.text)
|
| 22 |
except Exception as e:
|
| 23 |
+
# ISSO AQUI VAI TE DIZER O ERRO REAL
|
| 24 |
+
bot.reply_to(message, f"Erro na IA: {str(e)}")
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|
| 27 |
bot.infinity_polling()
|
| 28 |
+
|