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

Something went wrong: Telegram server says - Bad Request: can't parse entities: Can't find end of the entity starting at byte offset.. #76

Open
nierto opened this issue Dec 4, 2024 · 1 comment

Comments

@nierto
Copy link
Contributor

nierto commented Dec 4, 2024

Hi I am running into this issue having updated to ollama 0.4.0

I fixed it by adding an escape_markdown func

def escape_markdown(text):
escape_chars = r'_*~`>#+-=|{}.!'
return re.sub(r'([%s])' % re.escape(escape_chars), r'\\1', text)

And then escaping all the MARKDOWN responses.

I also ensured the markdown responses are now: ParseMode.MARKDOWN_V2 instead of the deprecated MARKDOWN, I left the ParseMode.HTML alone.

I'm still testing the fixes if I can still reproduce the error, if I can't should I submit a PR for the fixes?

@trashken
Copy link

+1 when responses has markdown in them...

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

No branches or pull requests

2 participants