|
|
@ -18,20 +18,44 @@ API_TOKEN = db["token"]
|
|
|
|
bot = telebot.TeleBot(API_TOKEN)
|
|
|
|
bot = telebot.TeleBot(API_TOKEN)
|
|
|
|
##################
|
|
|
|
##################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['help', 'start'])
|
|
|
|
@bot.message_handler(commands=['help', 'start'])
|
|
|
|
def send_welcome(message):
|
|
|
|
def send_welcome(message):
|
|
|
|
bot.reply_to(message, "None")
|
|
|
|
bot.reply_to(message, "Скоро...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### MAIN ###
|
|
|
|
### MAIN ###
|
|
|
|
from api import *
|
|
|
|
from api import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setted_models = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['model'])
|
|
|
|
|
|
|
|
def set_model(message):
|
|
|
|
|
|
|
|
global setted_models, iddb
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
iddb.pop(str(message.chat.id))
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model = message.text.split()[1]
|
|
|
|
|
|
|
|
if model == "0.1" or model == "0.2":
|
|
|
|
|
|
|
|
setted_models[str(message.chat.id)] = model
|
|
|
|
|
|
|
|
bot.reply_to(message, "Установлена новая модель 🤖")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
bot.reply_to(message, "Неизвестная модель")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(func=lambda message: True)
|
|
|
|
@bot.message_handler(func=lambda message: True)
|
|
|
|
def echo_message(message):
|
|
|
|
def echo_message(message):
|
|
|
|
bot.send_chat_action(message.chat.id, "typing", 30)
|
|
|
|
global setted_models
|
|
|
|
bot.reply_to(message, gen(message.text, message.chat.id))
|
|
|
|
prompt = 'Отвечай кратко не давая никакой лишней информации и не делая своих умозаключений. \n\n' + message.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
id = str(message.chat.id)
|
|
|
|
|
|
|
|
if id not in setted_models:
|
|
|
|
|
|
|
|
setted_models[id] = "0.1"
|
|
|
|
|
|
|
|
bot.reply_to(message, gen(prompt, message.chat.id, setted_models[id]))
|
|
|
|
|
|
|
|
|
|
|
|
############
|
|
|
|
############
|
|
|
|
|
|
|
|
|
|
|
|