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

parse_mode selection feature for telegram client #1458

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

nulLeeKH
Copy link

@nulLeeKH nulLeeKH commented Dec 26, 2024

Relates to:

Modified without ticket

Risks

Low

Background

What does this PR do?

There was issue when AI Agent send tg message with special characters.

Can't find end of the entity starting at byte offset 42

So, just add selection for user to use parse_mode in tg message or not.

And, this is chore update, but fix the node vertsion on integration test to 23.3.0 from 23 cause 23.5.0 is latest version so integration test will return fail till upgrade node version on whole repository to 23.5.0

What kind of change is this?

Improvements (misc. changes to existing features)

Why are we doing this? Any context or related work?

When my bot mean to send kaomoji or other special character, it throws error.

Documentation changes needed?

My changes do not require a change to the project documentation.

Testing

Where should a reviewer start?

check these following two options.

### clientConfig.telegram.disableParseMode?

> `optional` **disableParseMode**: `boolean`

### clientConfig.telegram.parseMode?

> `optional` **parseMode**: `"Markdown" | "MarkdownV2" | "HTML"`

Detailed testing steps

Try to several parse modes.

Discord username

BlairLee_Dev

kaomoji problem on telegram
@nulLeeKH nulLeeKH changed the title Do not use markdown as parse_mode on telegram client Disable parse_mode on telegram client Dec 26, 2024
@nulLeeKH
Copy link
Author

nulLeeKH commented Dec 26, 2024

FYI. Integration test failed due to node version issue. Github actions will work after merge my change.
We should specify node version in github action. For automated test, please check my forked repository.

shakkernerd and others added 4 commits December 26, 2024 06:16
SYSTEM """You are an assistant for PhD researchers, you help them find infos from research papers at ease."""
@simpletrontdip
Copy link
Contributor

I'm the one who added that parse_mode 👯 It helps formatting in many scenarios: code block, basic bold/italic, we can utilize it the code assistant bot...
@nulLeeKH when we have issues, it should be go for a root-cause fix instead of disabling the feature

@nulLeeKH
Copy link
Author

nulLeeKH commented Dec 26, 2024

@simpletrontdip then, how about add fallback and conditional parse_mode selection.

  1. check if message can parsed by markdown
  2. if yes, use markdown parse_mode
  3. when tg server returns error, re-try without parse_mode setup.

or jsut let user choose which parse_mode to utilize on tg client.

I think give the key to user might be the best solution.

@simpletrontdip
Copy link
Contributor

Agree that it would be the best if it was passed down along with message, or an option in the bot client config.
But I'm also curious what special with your input? Is it caused by non-ascii character?

@nulLeeKH nulLeeKH changed the title Disable parse_mode on telegram client parse_mode selection feature for telegram client Dec 27, 2024
@nulLeeKH
Copy link
Author

Agree that it would be the best if it was passed down along with message, or an option in the bot client config. But I'm also curious what special with your input? Is it caused by non-ascii character?

FYI. yeah, kaomoji means some text-based emoji like (。•̀ᴗ-)✧. if some of those non-ascii character placed on the end of message, tg api throw the error which I've mentioned above.

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.

3 participants