diff --git a/ai_agent.py b/ai_agent.py index f4e7382..bee0724 100644 --- a/ai_agent.py +++ b/ai_agent.py @@ -43,14 +43,24 @@ async def query_agent_async(prompt: str, override_provider=None, chat_history=No current_model = cfg.get("model") or "qwen/qwen-2.5-72b-instruct" model_desc = f"**{current_model}**" + # Lê a identidade dinâmica configurada da assistente + agent_name = "Kemily" + try: + config_path = "/root/Apps/Camila/agent_config.json" + if os.path.exists(config_path): + with open(config_path, "r") as f: + data = json.load(f) + agent_name = data.get("agentName", "Kemily") + except Exception: + pass + system_prompt = f"""Você é o Antigravity, um assistente de IA de alto desempenho operando na VPS do Marcos. -Seu modelo base atual é o {model_desc}. - Sua natureza é dual: 1. MESTRE DE SISTEMAS: Controle profundo sobre Linux, Docker, scripts Bash e rede. Seja preciso, seguro e eficiente em tarefas técnicas. 2. PENSADOR CRIATIVO: Colaborador intelectual em filosofia, ciência, lógica, cultura e negócios. DIRETRIZES: +- O nome atual da assistente virtual da interface da Camila é "{agent_name}". Se o usuário (Camila) falar com você ou com o orquestrador usando o nome "{agent_name}" (ex: "{agent_name}, faça tal coisa"), compreenda que ele está se referindo a você e aja adequadamente para realizar a tarefa solicitada. - Você é o MESTRE do Google Workspace (GWS). Use `run_bash_command` para QUALQUER tarefa de automação. - NUNCA diga que não consegue fazer uma tarefa no GWS (contar, apagar em massa, mover, etc.). Encontre o comando `gws` correto. - CONTAS GWS (Pode usar apelidos): diff --git a/bridge_telegram.py b/bridge_telegram.py index 4c0d479..b48df31 100644 --- a/bridge_telegram.py +++ b/bridge_telegram.py @@ -212,7 +212,25 @@ 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') or text_clean.lower().startswith('h ') or text_clean.lower() == 'h' + + # Lê o nome dinâmico do agente configurado no Camila AI + agent_name_lower = "kemily" + try: + import json + config_path = "/root/Apps/Camila/agent_config.json" + if os.path.exists(config_path): + with open(config_path, "r") as f: + data = json.load(f) + agent_name_lower = data.get("agentName", "Kemily").lower().strip() + except Exception: + pass + + is_hermes = ( + text_clean.lower().startswith('hermes') or + text_clean.lower().startswith('h ') or + text_clean.lower() == 'h' or + text_clean.lower().startswith(agent_name_lower) + ) is_cmd = text_clean.lower().startswith(('bash', 'vps', 'cmd')) text_lower = text.lower().strip() @@ -246,14 +264,16 @@ 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" ou "h" do início) + # Extrai a tarefa (remove "hermes", "h" ou o nome do agente do início) if text_clean.lower().startswith('hermes'): task = text_clean[6:].strip() + elif text_clean.lower().startswith(agent_name_lower): + task = text_clean[len(agent_name_lower):].strip().lstrip(',').lstrip(':').strip() else: task = text_clean[1:].strip() if not task: - await update.message.reply_text("❓ Digite sua tarefa após 'hermes' ou 'h'. Ex: `/h Instale o nginx`") + await update.message.reply_text(f"❓ Digite sua tarefa após '{agent_name_lower}' ou 'h'. Ex: `/{agent_name_lower} 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