diff --git a/README.md b/README.md new file mode 100644 index 0000000..0bc4067 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +just run +``` +docker compose up --build -d +``` +for testing \ No newline at end of file diff --git a/bot/handlers/user/model_processing.py b/bot/handlers/user/model_processing.py index b2f1ad4..b7c78e1 100644 --- a/bot/handlers/user/model_processing.py +++ b/bot/handlers/user/model_processing.py @@ -1,8 +1,13 @@ from aiogram.filters.callback_data import CallbackData from aiogram.types import InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder + from db.db import * +class PageCallBack(CallbackData, prefix="page"): + page: int + page_name: str + models_description = { "1o": "Это базовая модель ИИ, которая \"умеет думать\". Она хороша для выполнения повседневных задач, \ таких как анализ данных, обработка текста и создание отчетов. Она подходит для малого и среднего бизнеса, \ @@ -104,13 +109,15 @@ class ChooseCallBack(CallbackData, prefix="choose"): name: str async def get_model_page(*, page: int, name: str, user_id): + temp_kbds: InlineKeyboardBuilder = InlineKeyboardBuilder() + + if name in ['1o', '1o mini']: + return "Данная модель сейчас не работает", temp_kbds + tokens = await get_current_model_tokens(user_id, name) status = await get_current_model(user_id) == name text: str = models_description[name] + str(tokens) - - temp_kbds: InlineKeyboardBuilder = InlineKeyboardBuilder() - for option_name, item in model_prices[name].items(): option_name_rus, tokens, amount = name_of_model[option_name], item["tokens"], item["amount"] temp_text = f"{name_of_model[option_name]} | {tokens} запросов" diff --git a/bot/handlers/user/user_handlers.py b/bot/handlers/user/user_handlers.py index ff2ed7a..55ef0fb 100644 --- a/bot/handlers/user/user_handlers.py +++ b/bot/handlers/user/user_handlers.py @@ -130,18 +130,6 @@ async def pay(callback: types.CallbackQuery, callback_data: PayCallBack): async def process_pre_checkout_query(pre_checkout_query: PreCheckoutQuery): await pre_checkout_query.answer(ok=True) - # time.sleep(2) - # - # await pre_checkout_query.bot.send_message(chat_id=pre_checkout_query.from_user.id, text="Спасибо, пользутесь нашим сервисом!") - # - # text, reply_markup = await get_page_content(page=0, name="main", user_id=pre_checkout_query.from_user.id) - # - # await pre_checkout_query.bot.send_message( - # chat_id=pre_checkout_query.from_user.id, - # text=text, - # reply_markup=reply_markup, - # ) - @user.message(F.successful_payment) async def process_payment(message: types.Message): @@ -167,6 +155,8 @@ async def process_payment(message: types.Message): await message.bot.send_message(chat_id=message.from_user.id, text="Для работы с chatGPT отправьте текст с вашим вопросом и получите на него ответ)") + await set_curren_model(user_id, model_name) + @user.message(Command(commands=["failed"])) async def process_payment(message: types.Message): await message.bot.send_message(chat_id=message.from_user.id, @@ -314,8 +304,8 @@ async def chatgpt_chatting(message: types.Message): await message.bot.send_message(chat_id=message.from_user.id, text="У вас еще не выбрана модель", reply_markup=kbds.adjust(*(1,)).as_markup()) models = { - '1o' : "o1-preview", - '1o mini': "o1-mini", + '1o' : "o1-preview-2024-09-12", + '1o mini': "o1-mini-2024-09-12", '4o': "gpt-4o", '4o mini': "gpt-4o-mini" } diff --git a/bot/kbs/inline.py b/bot/kbs/inline.py index 94932ae..3bd57e0 100644 --- a/bot/kbs/inline.py +++ b/bot/kbs/inline.py @@ -72,11 +72,3 @@ def get_kb_buttons(*, btns: list[InlineKeyboardButton], sizes: tuple[int] = (1,) return kb_temp.adjust(*sizes).as_markup() -def get_callback_btns(*, btns: dict[str, str]): - keyboard = InlineKeyboardBuilder - - for text, data in btns.items(): - keyboard.add(InlineKeyboardButton(text=text, callback_data=data).pack()) - - return keyboard.as_markup() -