Fix /llm command to show status when no args

This commit is contained in:
Marcos
2026-03-22 16:24:06 -03:00
parent 62f90a381c
commit 22af78e6a5

View File

@@ -252,19 +252,28 @@ async def llm_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
args = context.args args = context.args
from config import get_config, save_config from config import get_config, save_config
if not args:
cfg = get_config() cfg = get_config()
await update.message.reply_text(f"Comando incompleto. Use: /llm gemini ou /llm ollama.\n*Status Atual:* {cfg.get('active_provider').upper()}") current = cfg.get('active_provider', 'ollama').upper()
if not args:
# Sem argumentos: mostra status atual
await update.message.reply_text(
f"🤖 LLM Atual: *{current}*\n\n"
f"Para mudar: /llm gemini ou /llm ollama"
)
return return
new_model = args[0].lower() new_model = args[0].lower()
if new_model in ["gemini", "ollama"]: if new_model in ["gemini", "ollama"]:
cfg = get_config()
cfg["active_provider"] = new_model cfg["active_provider"] = new_model
save_config(cfg) save_config(cfg)
await update.message.reply_text(f"Inteligência Artificial comutada com sucesso para: *{new_model.upper()}*") await update.message.reply_text(f"LLM alterado para: *{new_model.upper()}*")
else: else:
await update.message.reply_text("Modelos disponíveis: gemini ou ollama.") await update.message.reply_text(
f"❌ Modelo inválido: {new_model}\n\n"
f"Disponíveis: gemini, ollama\n"
f"LLM Atual: *{current}*"
)
async def clear_history(update: Update, context: ContextTypes.DEFAULT_TYPE): async def clear_history(update: Update, context: ContextTypes.DEFAULT_TYPE):
if not await auth_check(update): return if not await auth_check(update): return