Update Hermes integration

This commit is contained in:
Antigravity
2026-05-10 00:37:18 -03:00
parent 7b31435895
commit 8b577242ff
3 changed files with 54 additions and 12 deletions

View File

@@ -138,7 +138,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
text_normalized = text.strip()
starts_with_slash = text_normalized.startswith('/')
text_clean = text_normalized.lstrip('/')
is_hermes = text_clean.lower().startswith('hermes')
is_hermes = text_clean.lower().startswith('hermes') or text_clean.lower().startswith('h ') or text_clean.lower() == 'h'
is_cmd = text_clean.lower().startswith(('bash', 'vps', 'cmd'))
text_lower = text.lower().strip()
@@ -172,10 +172,14 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
reply = await call_antigravity_api("/api/chat", payload)
add_message(chat_id, text, reply)
elif is_hermes:
# Extrai a tarefa (remove "hermes" do início, com ou sem barra)
task = text_clean[6:].strip() if len(text_clean) > 6 else ""
# Extrai a tarefa (remove "hermes" ou "h" do início)
if text_clean.lower().startswith('hermes'):
task = text_clean[6:].strip()
else:
task = text_clean[1:].strip()
if not task:
await update.message.reply_text("❓ Digite sua tarefa após 'hermes'. Ex: `hermes Instale o nginx`")
await update.message.reply_text("❓ Digite sua tarefa após 'hermes' ou 'h'. Ex: `/h Instale o nginx`")
return
await update.message.reply_text("🤖 *Hermes assumindo o controle. Isso pode demorar alguns minutos...*", parse_mode='Markdown')
# Passa contexto completo: user_id, chat_id e histórico