Differentiating between different users


I am new at this and I had a question regarding user management. I am making my application in node js btw.

So I can send questions to the API and get back the results, but the issue arises when there are multiple users concurrently using the app. In this scenario, the AI mixes up, for example:

User 1 asks about calculus and the AI answers as expected. Then user 2 comes in and says “hello” the AI says hello back and proceeds to explain calculus.

Is there any way I can avoid this? What do I have to do? I have seen a user param in the docs, but that doesn’t seem to work when I provide it with the user ID.

How would I go about fixing this?

I would be very grateful if someone could help me.

You would need add a login to your app and store chat history for each user in backend and use it when a new a new message is sent

So for each user, the chat history would be different? Because right now I just have one main chat history. And would I store this in the db or a JSON file in a storage solution such as AWS S3?

Yes, you need to store the message history separated by user in your db to fix it