add GitHub callback (#38)

* add gpt-3.5-turbo-stream-GptChatly provider

* add GitHub callback
This commit is contained in:
Dmitry Afanasyev
2023-10-13 15:00:34 +03:00
committed by GitHub
parent b322e3c1da
commit 4c3c6039e3
11 changed files with 144 additions and 21 deletions

View File

@@ -18,6 +18,7 @@ async def main_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> st
return BotEntryPoints.end
reply_markup = InlineKeyboardMarkup(main_keyboard)
await update.message.reply_text("Выберете команду:", reply_markup=reply_markup)
await update.message.reply_text("Список этих команд всегда можно получить набрав /help")
return BotEntryPoints.start_routes
@@ -35,9 +36,9 @@ async def about_bot(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
chatgpt_service = ChatGptService.build()
model = await chatgpt_service.get_current_chatgpt_model()
await update.effective_message.reply_text(
f"Бот использует бесплатную модель {model} для ответов на вопросы. "
f"\nПринимает запросы на разных языках.\n\nБот так же умеет переводить русские голосовые сообщения в текст. "
f"Просто пришлите голосовуху и получите поток сознания в виде текста, но без знаков препинания",
f"Бот использует бесплатную модель *{model}* для ответов на вопросы.\nПринимает запросы на разных языках."
f"\n\nБот так же умеет переводить русские голосовые сообщения в текст. Просто пришлите или перешлите "
f"голосовуху боту и получите поток сознания в виде текста, но без знаков препинания.",
parse_mode="Markdown",
)
@@ -63,6 +64,17 @@ async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
)
async def github(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Send a message when the command /help is issued."""
if not update.effective_message:
return
await update.effective_message.reply_text(
"Проект на [GitHub](https://github.com/Balshgit/gpt_chat_bot)",
parse_mode="Markdown",
)
async def ask_question(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not update.message:
return

View File

@@ -14,6 +14,7 @@ from core.bot.commands import (
about_bot,
about_me,
ask_question,
github,
help_command,
main_command,
voice_recognize,
@@ -41,7 +42,7 @@ bot_event_handlers.add_handler(
BotEntryPoints.start_routes: [
CallbackQueryHandler(about_me, pattern="^" + BotStagesEnum.about_me + "$"),
CallbackQueryHandler(website, pattern="^" + BotStagesEnum.website + "$"),
CallbackQueryHandler(help_command, pattern="^" + BotStagesEnum.help + "$"),
CallbackQueryHandler(github, pattern="^" + BotStagesEnum.github + "$"),
CallbackQueryHandler(about_bot, pattern="^" + BotStagesEnum.about_bot + "$"),
],
},
@@ -50,5 +51,5 @@ bot_event_handlers.add_handler(
)
bot_event_handlers.add_handler(CallbackQueryHandler(about_me, pattern="^" + BotStagesEnum.about_me + "$"))
bot_event_handlers.add_handler(CallbackQueryHandler(website, pattern="^" + BotStagesEnum.website + "$"))
bot_event_handlers.add_handler(CallbackQueryHandler(help_command, pattern="^" + BotStagesEnum.help + "$"))
bot_event_handlers.add_handler(CallbackQueryHandler(github, pattern="^" + BotStagesEnum.github + "$"))
bot_event_handlers.add_handler(CallbackQueryHandler(about_bot, pattern="^" + BotStagesEnum.about_bot + "$"))

View File

@@ -8,7 +8,7 @@ main_keyboard = (
InlineKeyboardButton("Веб версия", callback_data=str(BotStagesEnum.website)),
),
(
InlineKeyboardButton("Помощь", callback_data=str(BotStagesEnum.help)),
InlineKeyboardButton("GitHub", callback_data=str(BotStagesEnum.github)),
InlineKeyboardButton("О боте", callback_data=str(BotStagesEnum.about_bot)),
),
)