scmanjarrez / EdgeGPT-Telegram-Bot

Telegram bot using EdgeGPT unofficial API
MIT License
62 stars 22 forks source link

Error when sending Md #106

Open Eikosa opened 1 year ago

Eikosa commented 1 year ago

Sometimes it seems to freeze when answering questions and then it sends md, and when I look at it, it gives an error like this.

***  Exception caught in edit (168434435):  Message_too_long
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/.vscode-server/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/root/.vscode-server/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/root/.vscode-server/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/root/.vscode-server/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/root/.vscode-server/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/root/.vscode-server/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/root/EdgeGPT-Telegram-Bot/src/edge.py", line 336, in <module>
    application.run_polling()
  File "/usr/local/lib/python3.10/dist-packages/telegram/ext/_application.py", line 752, in run_polling
    return self.__run(
  File "/usr/local/lib/python3.10/dist-packages/telegram/ext/_application.py", line 940, in __run
    loop.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/root/EdgeGPT-Telegram-Bot/src/backend.py", line 326, in run
    await self.parse_message(message)
  File "/root/EdgeGPT-Telegram-Bot/src/backend.py", line 417, in parse_message
    await ut.edit(
  File "/root/EdgeGPT-Telegram-Bot/src/utils.py", line 386, in edit
    traceback.print_stack()

And sometimes it also happens like this: image

scmanjarrez commented 1 year ago

I need more context to debug this error, but if it's related to EdgeGPT, I won't able to fix it.

scmanjarrez commented 1 year ago

Ok, I've debugged this error. It happens because the output from EdgeGPT is a bit bugged and the bot tries to send the json directly. The exception is there just for debug purposes.

Eikosa commented 1 year ago

Ok, I've debugged this error. It happens because the output from EdgeGPT is a bit bugged and the bot tries to send the json directly. The exception is there just for debug purposes.

This problem sometimes does not happen and still happens sometimes.