Skip to content
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

Telegram interface upgrade #328

Merged
merged 163 commits into from
Jul 2, 2024
Merged

Telegram interface upgrade #328

merged 163 commits into from
Jul 2, 2024

Conversation

pseusys
Copy link
Collaborator

@pseusys pseusys commented Feb 7, 2024

Description

Telegram interface was rewritten and updated to be used with the most recent Interface and Attachment classes.

Checklist

  • I have performed a self-review of the changes
  • Documentation should still be written

To Consider

  • 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

@pseusys pseusys added the enhancement New feature or request label Feb 7, 2024
@pseusys pseusys requested review from kudep and RLKRo February 7, 2024 21:03
@pseusys pseusys self-assigned this Feb 7, 2024
github-actions[bot]

This comment was marked as outdated.

@RLKRo RLKRo changed the base branch from master to dev February 7, 2024 21:05
RLKRo added a commit that referenced this pull request Feb 12, 2024
This commit will conflict with #328 and can be dropped.
RLKRo and others added 3 commits February 22, 2024 15:20
dff/messengers/telegram.py Outdated Show resolved Hide resolved
dff/script/core/message.py Outdated Show resolved Hide resolved
dff/messengers/telegram.py Outdated Show resolved Hide resolved
dff/messengers/telegram.py Outdated Show resolved Hide resolved
dff/messengers/telegram.py Outdated Show resolved Hide resolved
dff/messengers/telegram.py Outdated Show resolved Hide resolved
dff/messengers/telegram.py Outdated Show resolved Hide resolved
@RLKRo RLKRo self-requested a review March 18, 2024 16:19
@pseusys pseusys requested a review from RLKRo June 27, 2024 10:47
@pseusys pseusys requested a review from RLKRo June 27, 2024 18:52
@pseusys
Copy link
Collaborator Author

pseusys commented Jun 27, 2024

I believe that asynchronous interface is also ready. Could you please validate it works correctly - and we are done with it?

@RLKRo
Copy link
Member

RLKRo commented Jun 27, 2024

This current implementation does not support graceful termination. You can tests this by running second tutorial, requesting media_group and interrupting right after receiving text message. It is supposed to send media group as well (i.e. terminate gracefully) which was previously assured by the sync run_polling method of the application.

I think it's better to merge the async version along with #357 which provides graceful termination for all messenger interfaces.

So I'd prefer to revert these last commits here and open a new PR with async version.

- subclass from attachment
- clarify doc
- remove animation as possible group element
- fix tutorials
They have a wierd name if filename is None
- remove original serializer to avoid warnings and improve performance
- add tests
- clarify usage in the docs
@pseusys pseusys force-pushed the feat/telegram_interface_upgrade branch from 0825f8e to b1131ef Compare July 1, 2024 09:37
RLKRo added 8 commits July 1, 2024 14:16
- Also store messages as objects instead of strings
I don't see a reason to pass DataAttachment instead of id
Also:
- Store TelegramMessage.caption in Message.text in case TelegramMessage.text is None
- Fix extra field specification for media group attachments
Otherwise, it raises an exception if the path does not exist.
remove:
- message.Session
- message.Command (and Message.commands)
- `__eq__` methods of attachments and Message
@RLKRo RLKRo merged commit 1593559 into dev Jul 2, 2024
16 of 17 checks passed
@RLKRo RLKRo deleted the feat/telegram_interface_upgrade branch July 2, 2024 11:11
@RLKRo RLKRo mentioned this pull request Jul 3, 2024
6 tasks
RLKRo added a commit that referenced this pull request Jul 3, 2024
# Changelog

## General

- Framework renamed from DFF to Chatsky (#368)

## Features

- New `has_text` condition for asserting that specific text is contained
inside the last request (#335)
- Validation stage reworked.
`Pipeline.validation_stage`, `Pipeline.verbose` and `Context.validation`
fields are removed.
  Added new type for annotating labels `dff.script.ConstLabel` (#289)
- Functions `cnd.exact_match` and `check_happy_path` now accept both
`Message` and `str`.
The following are now equivalent: `exact_match(Message("text"))` ==
`exact_match("text")`
  (#337)
- CLIMessengerInterface moved to `messengers.console` (#328)
- Attachments reworked (#328):
- `Session`, `Command`, `Link`, `Button`, `Keyboard` and `Attachments`
classes removed, `Message.commands` field removed.
- Added `CallbackQuery`, `Contact`, `Invoice`, `Poll`, `Animation`,
`Sticker`, `VoiceMessage`, `VideoMessage` and `MediaGroup` classes.
  - Added attachment caching feature.
  - Added `has_callback_query` condition.
  - Removed `title` field from Data Attachments. Use `caption` instead.
- Telegram Messenger interface reworked (#328):
  - Now provides methods for attachment byte download.
- Added support for receiving attachment types as members of
`Message.attachments`. Others may be accessed via
`Message.original_message`.
- Added support for sending new attachment types (`Sticker`, `Poll`,
e.t.c.).
- Added support for extra options such as `disable_notification`,
`message_effect_id` or `caption`.
  - Telegram tutorials rewritten to reflect all the changes.
- Added slots that simplify the process of extracting arbitrary data
from user messages and accessing it later (#36):
  - New user guide and tutorials on slots

## Documentation

- Return PRE_RESPONSE_PROCESSING and PRE_TRANSITION_PROCESSING tutorials
- New telegram interface tutorials (#328)
- Slots user guide and tutorials (#36)

## Contrib

- Added `poe quick_test` to run tests that are not slow and do not
require docker (#344)
- `Context.framework_states` renamed to `Context.framework_data` and
made `Pydantic.BaseModel` (#359)
- Added `MessengerInterfaceWithAttachments` class (#328)
- Added tools for enabling json serialization via pickle (#328)
- Telegram tests made independent from telegram servers (#328)
- `wrap_sync_function_in_async` moved to `utils.devel` (#36)

# Checklist

- [x] I have performed a self-review of the changes
- [x] Rename repos (this; template; demo)
- [ ] Add new logo; change favicons in conf.py (this can be done later)
- [x] Create new PyPi project and update pypi token
- [ ] Create a new release
- [x] Make a new release on the
[final_dff_release](https://github.com/deeppavlov/dialog_flow_framework/tree/final_dff_release)
branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants