[Python] aiogram parsing deepseek's markdown reponses

Discussão em 'Python' iniciado por Stack, Julho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I'm developing a telegram bot using aiogram. The bot is integrated with deepseek. In short words, the bot sends text to deepseak and then returns deepseek's response to user.

    The problem is that deepseek generates its answers using markdown and telegram api can't swallow it.

    I tried:

    1. asking ai in system query to send responses using html or plain text - keeps sending md
    2. convert md to html and then using parse_mode.HTML returning it to user - conversion adds some tags unsupported by telegram api (ie <p>)
    3. using parse_mode.MARKDOWN_V2 - in this case it telegrams api asks to escape many characters. And when escaping with re.escape(gpt_response) characters like some text. turns to some text\.

    Is there any solution to this issue?

    Continue reading...

Compartilhe esta Página