Fix /llm command to show status when no args
This commit is contained in:
19
bot_logic.py
19
bot_logic.py
@@ -252,19 +252,28 @@ async def llm_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
args = context.args
|
||||
from config import get_config, save_config
|
||||
|
||||
if not args:
|
||||
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
|
||||
|
||||
new_model = args[0].lower()
|
||||
if new_model in ["gemini", "ollama"]:
|
||||
cfg = get_config()
|
||||
cfg["active_provider"] = new_model
|
||||
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:
|
||||
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):
|
||||
if not await auth_check(update): return
|
||||
|
||||
Reference in New Issue
Block a user