yGuy / chatgpt-mattermost-bot

A very simple implementation of a service for a mattermost bot that uses ChatGPT in the backend.
MIT License
145 stars 50 forks source link

Typing notification in main thread #70

Open maxime-netsyst opened 5 months ago

maxime-netsyst commented 5 months ago

Hello,

I added the typing effect to the main thread when the bot is requested. To activate it, use the env variable MATTERMOST_TYPE_IN_MAIN_THREAD=true. The default value is false.

yGuy commented 5 months ago

Thanks!

I think this was always intended to be the way it should work, but it didn't because this is wrong?

 const typing = () => wsClient.userTyping(msgData.post.channel_id, (msgData.post.root_id || msgData.post.id) ?? "")

So for the case when we are in main, we should just use "" ?

Then let's just fix that and make that unconditional - I don't think anyone wants to have this configurable - and the diff will be much smaller, too!

maxime-netsyst commented 5 months ago

To have the typing notification only in the main thread yes. But maybe you should put the notification in the main and the other thread.

yGuy commented 5 months ago

But showing the typing both in the main as well as in the thread is not what you would expect. Only for the first reply...

So wouldn't it suffice to just change the original line to:

 const typing = () => wsClient.userTyping(msgData.post.channel_id, msgData.post.id ?? "")

or is it

 const typing = () => wsClient.userTyping(msgData.post.channel_id, msgData.post.root_id ?? "")

and that's it? No other change required and you get the typing notification where the bot is actually responding to?