🚀 Auto-deploy: BotVPS atualizado em 24/03/2026 21:36:58

This commit is contained in:
2026-03-24 21:36:58 +00:00
parent c2273a13f0
commit 27d12ff9c4
4 changed files with 40 additions and 14 deletions

View File

@@ -25,15 +25,24 @@ async def query_agent_async(prompt: str, override_provider=None, chat_history=No
provider = override_provider or cfg.get("active_provider", "gemini")
tools_desc = "\n".join([f"- {k}: {v['description']}" for k, v in AVAILABLE_TOOLS.items()])
system_prompt = f"""Sou o CLAW, auxiliar do Marcos. Gerencio a VPS.
Responda em PORTUGUÊS de forma curta e direta.
system_prompt = f"""Você é o CLAW, um assistente de IA de alto desempenho operando na VPS do Marcos. Sua natureza é dual:
### FERRAMENTAS:
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:
- Se técnico, valide a segurança antes de sugerir comandos.
- Use Chain of Thought (raciocínio passo a passo) para conversas complexas.
- Nunca responda "fora de escopo" ou "limite atingido".
- Tom profissional, adaptável e perspicaz. Responda em PORTUGUÊS.
### FERRAMENTAS DISPONÍVEIS:
{tools_desc}
### FORMATO:
Use [TOOL:nome] arg [/TOOL] para ações.
Finalize com <REFINED> resumo </REFINED>.
### FORMATO DE RESPOSTA:
- Use [TOOL:nome] arg [/TOOL] para ações.
- Pense passo a passo se a tarefa for complexa.
- Finalize sempre com <REFINED> resumo final para o usuário </REFINED>.
"""
history_str = ""

View File

@@ -113,8 +113,8 @@ async def process_logic(update: Update, context: ContextTypes.DEFAULT_TYPE, user
reply = await query_agent_async(user_msg, override_provider=cfg.get("active_provider"))
# Envia resposta (Texto)
# Remove o bloco <REFINED> se houver, pois no Telegram polui
reply_clean = re.sub(r'<REFINED>.*?</REFINED>', '', reply, flags=re.DOTALL).strip()
# Remove apenas as tags <REFINED> e </REFINED>, mantendo o conteúdo
reply_clean = reply.replace('<REFINED>', '').replace('</REFINED>', '').strip()
await update.message.reply_text(reply_clean)
# Se foi por voz, responde por voz também

View File

@@ -211,7 +211,13 @@ async def _call_gemini_async(model: str, prompt: str, system_prompt: str = None)
if system_prompt:
contents.insert(0, {"role": "model", "parts": [{"text": system_prompt}]})
payload = {"contents": contents}
payload = {
"contents": contents,
"generationConfig": {
"temperature": 0.7,
"maxOutputTokens": 4096
}
}
try:
async with httpx.AsyncClient() as client:
@@ -232,7 +238,12 @@ async def _call_openai_async(model: str, prompt: str, system_prompt: str = None)
messages.append({"role": "system", "content": system_prompt})
messages.append({"role": "user", "content": prompt})
payload = {"model": model, "messages": messages, "temperature": 0.7}
payload = {
"model": model,
"messages": messages,
"temperature": 0.7,
"max_completion_tokens": 4096
}
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
try:
@@ -258,7 +269,8 @@ async def _call_anthropic_async(model: str, prompt: str, system_prompt: str = No
payload = {
"model": model,
"max_tokens": 4096,
"messages": [{"role": "user", "content": prompt}]
"messages": [{"role": "user", "content": prompt}],
"temperature": 0.7
}
if system_prompt: payload["system"] = system_prompt
@@ -278,7 +290,10 @@ async def _call_ollama_async(model: str, prompt: str, system_prompt: str = None)
"model": model,
"prompt": prompt,
"stream": False,
"options": {"num_ctx": 4096}
"options": {
"num_ctx": 4096,
"temperature": 0.7
}
}
if system_prompt: payload["system"] = system_prompt

View File

@@ -154,8 +154,10 @@ async def web_chat_audio(audio: UploadFile = File(...), is_auth: bool = Depends(
reply = await query_agent_async(text)
# 4. Gera áudio da resposta (TTS)
reply_clean = re.sub(r'<REFINED>.*?</REFINED>', '', reply, flags=re.DOTALL).strip()
filename = await text_to_speech_async(reply_clean)
# Se houver <REFINED>, usa apenas ele para o áudio. Caso contrário, usa tudo.
refined_match = re.search(r'<REFINED>(.*?)</REFINED>', reply, flags=re.DOTALL)
audio_text = refined_match.group(1).strip() if refined_match else reply
filename = await text_to_speech_async(audio_text)
return {
"text": text,