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
|
args = context.args
|
||||||
from config import get_config, save_config
|
from config import get_config, save_config
|
||||||
|
|
||||||
|
cfg = get_config()
|
||||||
|
current = cfg.get('active_provider', 'ollama').upper()
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
cfg = get_config()
|
# Sem argumentos: mostra status atual
|
||||||
await update.message.reply_text(f"Comando incompleto. Use: /llm gemini ou /llm ollama.\n*Status Atual:* {cfg.get('active_provider').upper()}")
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user