flows-network / telegram-llm

A Telegram LLM bot written in Rust
https://flows.network/
GNU General Public License v3.0
66 stars 21 forks source link

Increasing response speed and checking membership #1

Open RoozbehSh opened 1 year ago

RoozbehSh commented 1 year ago

Hi! thanks for your great work, I've been trying its functionality for a few days. I have 2 questions, or probably one question and one feature request. 1- My question is how to improve the response rate of the robot? is open ai premium going to be useful? and also how many users can use flows.network simultaneously? I want to know the safe margin for the bot to work smoothly 2- I wanted to add a section to the code so it checks if a user has joined a specific private channel to respond or not. I want to use this method so I can control who is using the bot to limit its load. I've tried teloxide and tg-botapi but I keep getting errors over tokio inconsistency with wasm. I would really appreciate your help as I'm not a rust developer.

thanks for your time and response in advance

juntao commented 1 year ago

Re Response time: I think the main limiting factor is on the OpenAI side as it takes almost a minute to respond to a GPT4 request, which results in time out. Flows.network is mostly waiting for OpenAI to respond.

For now, I think using GPT35Turbo model will give you a consistent response time within 30 seconds.

Re Checking telegram APIs: We would love to help. Can you tel us know which telegram API you would like to call? We are likely able to do that in the flows telegram SDK instead of making direct calls from inside Rust / Wasm. Thanks.

RoozbehSh commented 1 year ago

Thanks for your response. Based on what you said, the premium account and GPT4 would cause more delay. For the telegram feature, as I said I wanted to include this ability in the bot that checks whether it should provide service to a user before responding to limit the load. My first thought was to ask those users to join a private channel so the bot could check if they were a member or not. I haven't worked with telegram SDK so I'm completely open to new ideas, how do you think this problem should be approached? I appreciate your help. I think this feature would also be nice in other branches such as the discord bot. thanks for your time and response in advance

alabulei1 commented 1 year ago

Hi @RoozbehSh,

Based on what you've shared with us, here is my understanding of the scenario you want to implement:

  1. chatting with this telegram bot via DM is open to all telegram users, but only some of the users have been tagged as members by you like joining your channel.
  2. When a user asks the bot a question via DM, the bot will check whether or not the user has been tagged as a member before answering.
  3. If the user is a member, the bot will proceed to answer their question. If the user is not a member, the bot will respond with a message indicating that they are not a member and encouraging them to join your channel.

Please correct me if I'm wrong. Thanks. By the way, the quickest way to offer your members a ChatGPT service is to add the bot to a private/public channel where only your members can access it.

RoozbehSh commented 1 year ago

Hi @alabulei1 , thanks for your response Yes, that was my intention. I thought having a private channel would be easier to manage the people who have access to the bot.