Skip to content

Feat/telegram buttons backend #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open

Conversation

ZergLev
Copy link
Collaborator

@ZergLev ZergLev commented Apr 16, 2025

Description

Added the backend for Telegram buttons. (the frontend will allow users to add buttons in bot responses and transition conditions)
Converting button from frontend_flows.yaml into a yaml format compatible with Chatsky. This PR does so by making Chatsky import the AddButtons class from Chatsky-UI into PRE_RESPONSE, which is just a modified 'PRE_RESPONSE' processing function from Chatsky.

  • ButtonConditionConverter is completed.
  • ButtonsConverter is complete (it's for responses, it may need renaming)
  • Added the AddButtons PRE_RESPONSE function, which gets imported via external:chatsky_ui clause by Chatsky.

Checklist

  • Test that the overall json_converter structure works for an arbitrary format of frontend_flows.yaml
  • Fix feature blocking for responses and test that it works
  • Make sure the buttons are merging when there are empty buttons. (If I'm not wrong, frontend already handles it, but I should test this)
  • Finish integration with the frontend.
  • I have performed a self-review of the changes

To Consider

  • The ReplyKeyboardMarkup looks extremely ugly for some reason (both on PC and especially my phone), not like in their examples of this class. Maybe they updated it or I'm doing it wrong. (it was probably a bad update) Well, at least InlineKeyboardMarkup looks good.
  • The ReplyKeyboard isn't removed automatically. It could be removed with a certain combo of PRE_TRANSITION and PRE_RESPONSE processing and changing Context.misc. But for now it's in the backlog as there are more pressing tasks in Chatsky-UI.
  • Rami asked me before to add the feature of adding 'parallel' conditions for these buttons. So, you could just enter "yes" instead of using the button, and some sort of condition is still going to parse it and there'll be a transition to the same node, where the button would go. It's really easy, just need to create the condition at frontend, send it's data like normal, convert it with our ConditionConverters at backend and then add it to a big cnd.Any from Chatsky. Maybe such a menu could be called "Add parallel conditions" or something. But that's for the frontend to decide. I think it's a decent idea. The backend for that sounds easy to make.
  • Add tests (if functionality is changed)
  • Update API reference / tutorials / guides
  • Update CONTRIBUTING.md (if devel workflow is changed)
  • Update .ignore files, scripts (such as lint), distribution manifest (if files are added/deleted)
  • Search for references to changed entities in the codebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant