|
|
@ -23,9 +23,11 @@ bot = telebot.TeleBot(API_TOKEN)
|
|
|
|
def send_welcome(message):
|
|
|
|
def send_welcome(message):
|
|
|
|
bot.reply_to(message, f"""Это подобие ChatGPT на минималках.
|
|
|
|
bot.reply_to(message, f"""Это подобие ChatGPT на минималках.
|
|
|
|
|
|
|
|
|
|
|
|
__ Есть 2 версии:
|
|
|
|
__ Есть 3 версии:
|
|
|
|
{telebot.formatting.hcode("/m 0.1")} - Простейшая, быстрая, краткая, не помнит что вы говорили.
|
|
|
|
{telebot.formatting.hcode("/m 0.1")} - Простейшая, быстрейшая, краткая, не помнит что вы говорили.
|
|
|
|
{telebot.formatting.hcode("/m 0.2")} - Умнее, относительно быстрая, помнит что вы говорили.
|
|
|
|
{telebot.formatting.hcode("/m 0.2")} - Умнее, относительно быстрая, помнит что вы говорили.
|
|
|
|
|
|
|
|
{telebot.formatting.hcode("/m 3.5")} - Самая умная, есть цензура, помнит что вы говорили.
|
|
|
|
|
|
|
|
(1,2 - Mistral, 3 - ChatGPT)
|
|
|
|
|
|
|
|
|
|
|
|
__ Список кратких команд:
|
|
|
|
__ Список кратких команд:
|
|
|
|
/info - /i
|
|
|
|
/info - /i
|
|
|
@ -77,7 +79,7 @@ def set_model(message):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
model = message.text.split()[1]
|
|
|
|
model = message.text.split()[1]
|
|
|
|
if model == "0.1" or model == "0.2":
|
|
|
|
if model == "0.1" or model == "0.2" or model == "3.5":
|
|
|
|
setted_models[str(message.chat.id)] = model
|
|
|
|
setted_models[str(message.chat.id)] = model
|
|
|
|
bot.reply_to(message, "Установлена новая модель 🤖")
|
|
|
|
bot.reply_to(message, "Установлена новая модель 🤖")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -101,17 +103,17 @@ def clear_prompt(message):
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['ccontext','cc'])
|
|
|
|
@bot.message_handler(commands=['ccontext','cc'])
|
|
|
|
def clear_context(message):
|
|
|
|
def clear_context(message):
|
|
|
|
global iddb
|
|
|
|
global iddb, history
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
iddb.pop(str(message.chat.id))
|
|
|
|
iddb.pop(str(message.chat.id))
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
history[id] = []
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
bot.reply_to(message, "Контекст очищен 🤖")
|
|
|
|
bot.reply_to(message, "Контекст очищен 🤖")
|
|
|
|
|
|
|
|
|
|
|
|
#@bot.message_handler(commands=['onoff'])
|
|
|
|
|
|
|
|
#def set_onoff(message):
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(func=lambda message: True)
|
|
|
|
@bot.message_handler(func=lambda message: True)
|
|
|
|
def echo_message(message):
|
|
|
|
def echo_message(message):
|
|
|
@ -122,12 +124,16 @@ def echo_message(message):
|
|
|
|
setted_models[id] = "0.1"
|
|
|
|
setted_models[id] = "0.1"
|
|
|
|
|
|
|
|
|
|
|
|
if id in system_prompts:
|
|
|
|
if id in system_prompts:
|
|
|
|
|
|
|
|
if setted_models[id] != 3.5:
|
|
|
|
prompt = '[INST]' + system_prompts[id] + '[/INST]\n\n' + message.text
|
|
|
|
prompt = '[INST]' + system_prompts[id] + '[/INST]\n\n' + message.text
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
prompt = message.text
|
|
|
|
prompt = message.text
|
|
|
|
|
|
|
|
|
|
|
|
st = bot.send_message(message.chat.id, "Печатает...")
|
|
|
|
st = bot.send_message(message.chat.id, "Печатает...")
|
|
|
|
|
|
|
|
try:
|
|
|
|
predicted = gen(prompt, message.chat.id, setted_models[id])
|
|
|
|
predicted = gen(prompt, message.chat.id, setted_models[id])
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
bot.send_message(message.chat.id, "Извините, возникла непредвиденная ошибка")
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
bot.reply_to(message, predicted, parse_mode="Markdown")
|
|
|
|
bot.reply_to(message, predicted, parse_mode="Markdown")
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|