Skip to content
This repository was archived by the owner on Aug 10, 2023. It is now read-only.
This repository was archived by the owner on Aug 10, 2023. It is now read-only.

[Feature Request]: Run concurrently with different accounts #770

Description

@Nanfacius

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

This feature will allow different users to access the API simultaneously.
In this way, developers can develop apps such as a Wechat or QQ bot. More common people will be able to easily access ChatGPT without opening a browser or using command line. Sending a message to a bot on their most familiar social media app will be the most efficient way to use ChatGPT.
Actually, I have tried to use you codes as a module of my QQ bot (which is based on go-cqhttp). However, now it only allows 1 session. If more than 1 users send message to my QQ bot at the same time, they have to wait for their sessions being processed one by one.
My idea is:

  1. Configure the Chatbot with a list of config files (or a list of OpenAI accounts) rather than only 1.
  2. Rewrite the main function as an instance function of class Chatbot with asyncio.
  3. Automatically distribute available OpenAI accounts to different users.

Proposed workflow

The new feature can be used with the codes below as an example

from revChatGPT.V1 import Chatbot, configure
chatbot_dict={}
async def respond(QQbot, user_id, prompt):
if user_id not in chatbot_dict:
chatbot = Chatbot(user_id, configure)
chatbot_dict[user_id] = chatbot
else:
chatbot = chatbot_dict[user_id]
res = await chatbot.get_res(prompt)
#Here chatbot.get_res is the function rewritten from main as I mentioned above
QQbot.send(user_id,res)

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions