chatgpt_telegram_bot icon indicating copy to clipboard operation
chatgpt_telegram_bot copied to clipboard

Use Telegram editMessageText API to stream the reply

Open lqhl opened this issue 1 year ago • 3 comments

Improve user experiment by using the editMessageText API to return the partial results.

A demo in https://twitter.com/wsvn53/status/1633799055167066113

Related #105

lqhl avatar Mar 10 '23 10:03 lqhl

Wow! It's a great feature. I'll work on it

karfly avatar Mar 10 '23 13:03 karfly

Hi, it would be great if you could also include the text formatting similar to the demo mentioned. Thank you in advance!

hamed-ehtesham avatar Mar 11 '23 16:03 hamed-ehtesham

I've just implemented message streaming feature. It appeared to be a really hard task. Big thanks to @gkorepanov for helping!

@gkorepanov @lqhl @hamed-ehtesham @CCCAUCHY @ronpay and other Guys, it would be really great if you helped me with testing this feature! I'm not going to push it to main until it has been tested by someone else 😌

It's on the stream branch. Here's PR.

karfly avatar Mar 14 '23 12:03 karfly

@gkorepanov @lqhl @hamed-ehtesham @CCCAUCHY @ronpay @ngn999 @clemsau Short demo of streaming (just to motivate you to test 😄)

Streaming demo

karfly avatar Mar 14 '23 19:03 karfly

I have deployed the stream branch to fly.io, and it is working perfectly.

ngn999 avatar Mar 15 '23 06:03 ngn999

@karfly I deployed it on a google cloud VM using docker-compose, and it works perfectly. Thank you for your work!

lqhl avatar Mar 15 '23 06:03 lqhl

In my case, openai api always returns leading "\n\n" as the first message. This leads to error in tg: Reason: Message must be non-empty. image

Am I alone?

flymin avatar Mar 15 '23 14:03 flymin

@flymin it's a bug. I'll fix it in a while

karfly avatar Mar 15 '23 15:03 karfly

@flymin try it now with latest commit in stream

karfly avatar Mar 15 '23 15:03 karfly

I tested locally and the functionality is good.

flymin avatar Mar 15 '23 15:03 flymin

MERGED 🎉

karfly avatar Mar 15 '23 16:03 karfly

What is needed to create streaming? Maybe there is material to study?

Sweetshotby avatar Mar 23 '23 14:03 Sweetshotby