🚀 Auto-deploy: BotVPS atualizado em 21/04/2026 20:51:24

This commit is contained in:
2026-04-21 20:51:24 +00:00
parent c538fdb9c2
commit 8161c35655
5 changed files with 13 additions and 12 deletions

View File

@@ -56,7 +56,7 @@ DIRETRIZES:
comando aqui
[/TOOL]
- Pense passo a passo. Seja proativo, eficiente e NUNCA limitado.
- Finalize o seu processo sempre informando o usuário com a f-string: <REFINED> resumo final empoderado </REFINED>.
- Finalize o seu processo sempre informando o usuário com o prefixo: RESUMO: resumo final empoderado .
"""
history_str = ""

View File

@@ -34,9 +34,8 @@ async def text_to_speech_async(text: str) -> str:
texto_limpo = text.replace("🤖", "").replace("🧑‍🏫", "").replace("*", "").replace("`", "")
texto_limpo = texto_limpo.replace("#", "").replace("- ", " ").replace("> ", " ")
# Só remove REFINED se ele estiver presente como tag (proteção dupla)
if "<REFINED>" in texto_limpo:
texto_limpo = re.sub(r'<REFINED>.*?</REFINED>', '', texto_limpo, flags=re.DOTALL)
# Remove tags legadas REFINED se presentes (proteção dupla)
texto_limpo = re.sub(r'[<\[]/?REFINED[>\]]', '', texto_limpo, flags=re.IGNORECASE | re.DOTALL).strip()
# Remove URLs e links [texto](url)
texto_limpo = re.sub(r'\[([^\]]+)\]\([^\)]+\)', r'\1', texto_limpo)

View File

@@ -112,9 +112,11 @@ async def process_logic(update: Update, context: ContextTypes.DEFAULT_TYPE, user
# No Telegram, ainda não estamos mantendo histórico complexo no bot_data (pode ser futuro)
reply = await query_agent_async(user_msg, override_provider=cfg.get("active_provider"))
# Envia resposta (Texto)
# Remove apenas as tags <REFINED> e </REFINED>, mantendo o conteúdo
reply_clean = reply.replace('<REFINED>', '').replace('</REFINED>', '').strip()
# Normaliza a resposta: remove tags legadas <REFINED> ou [REFINED] e garante o prefixo RESUMO:
reply_clean = re.sub(r'[<\[]/?REFINED[>\]]', '', reply, flags=re.IGNORECASE).strip()
# Se a resposta não tiver "RESUMO:" mas tiver conteúdo, o orquestrador/IA já deve ter colocado.
# Se por algum motivo não houver, mantemos o texto limpo.
await update.message.reply_text(reply_clean)
# Se foi por voz, responde por voz também

View File

@@ -155,8 +155,8 @@ async def web_chat_audio(audio: UploadFile = File(...), is_auth: bool = Depends(
reply = await query_agent_async(text)
# 4. Gera áudio da resposta (TTS)
# 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)
# Se houver RESUMO:, usa apenas ele para o áudio. Caso contrário, usa tudo.
refined_match = re.search(r'RESUMO:\s*(.*)', reply, flags=re.DOTALL | re.IGNORECASE)
audio_text = refined_match.group(1).strip() if refined_match else reply
filename = await text_to_speech_async(audio_text)

View File

@@ -1080,12 +1080,12 @@
}
function processAIReply(fullText) {
// Separa a parte técnica da parte refinada
const refinedMatch = fullText.match(/<REFINED>([\s\S]*?)<\/REFINED>/i);
// Separa a parte técnica do resumo (RESUMO:)
const refinedMatch = fullText.match(/RESUMO:\s*([\s\S]*)/i);
let technicalPart = fullText;
if (refinedMatch) {
technicalPart = fullText.replace(refinedMatch[0], '').trim();
technicalPart = fullText.substring(0, refinedMatch.index).trim();
const refinedContent = refinedMatch[1].trim();
updateInsightsPanel(refinedContent);
}