PrivateCoffee / matrix-gptbot

GPT Chatbot for Matrix
Other
8 stars 3 forks source link

In-thread replies #6

Open mwnu opened 2 months ago

mwnu commented 2 months ago

I believe that having robots reply within threads (message columns) is a better approach. Firstly, use a command (such as !gpt) followed by a prompt to trigger the robot's response. Then, the robot replies within the thread, where users can converse without needing further commands. The robot will gather context from within the thread. This setup allows for multiple topics to be discussed within a single room, avoiding the clutter of long contexts and mixed topics in the message list.Like this project Additionally, Docker installation is a simpler method, and future updates are also easier.

kumitterer commented 2 months ago

Hi, thanks for your suggestions! I have split them into two separate issues to make it easier to keep track of them – the Docker portion is now in #7.

As for the in-thread replies, I actually considered doing just that when I started developing the bot, but I soon noticed that threads can cause problems in Element sometimes, where marking things as read doesn't work as expected, so I went for the current approach with just using different rooms for different chats. But maybe they fixed that problem. And I guess we can just make it optional, as a feature that can be enabled on a per-room basis or in the config file, so people can decide if they want it. So I will definitely look into that.

mwnu commented 2 months ago

Hi, thanks for your suggestions! I have split them into two separate issues to make it easier to keep track of them – the Docker portion is now in #7.

As for the in-thread replies, I actually considered doing just that when I started developing the bot, but I soon noticed that threads can cause problems in Element sometimes, where marking things as read doesn't work as expected, so I went for the current approach with just using different rooms for different chats. But maybe they fixed that problem. And I guess we can just make it optional, as a feature that can be enabled on a per-room basis or in the config file, so people can decide if they want it. So I will definitely look into that.

Thank you for your interest in this requirement; it's a really nice project. I've also noticed that using threads in the Element client might encounter some compatibility issues. For example, The Matrix Spec v1.4 uses "m.thread" as the namespaced relationship type. However, in the Element client, "rel_type" is sometimes labeled as "io.element.thread," depending on the server's implementation.

kumitterer commented 2 months ago

Quick update: No, I didn't forget about this. However, it will have to wait until the next matrix-nio release. There is a function to get messages by thread, but it was implemented after the current v0.24.0 was released.

https://github.com/matrix-nio/matrix-nio/blame/f3c8a99684a5f7900dafde496a00ac944b5c9587/nio/client/async_client.py#L1820