abnerfcastro / watson-chatbot-boilerplate

Simple but complete boilerplate for a chat bot app using IBM Watson Conversation API.
4 stars 5 forks source link

Multiple chatbots instances #2

Open vrcrush opened 6 years ago

vrcrush commented 6 years ago

hi, If I have more than one chatbot instance running the conversation jumps between chatbot windows. For example I am asking the user name in chatbot window 1, and it already knows the user name in chatbot window 2. I understand why is happening, but not sure how to solve. is there a way to make this multi-user? some type of session variable? thank you so much!

abnerfcastro commented 6 years ago

Hi @vrcrush ,

I'm not sure I understand. I am going out on a limb here and say that it might have to do with how the back-end is instantiating the conversation service. It's using the same one for every request. I don't know if express-session would solve that issue. It might be worth trying.

Regards, Abner

vrcrush commented 6 years ago

Hi @abnerfcastro. I contacted IBM Watson support to see if they could help me. I am new in programming and still learning. This is what they suggested. If you have time and if you would like to "tweak" it. . thanks!

IBM Please make sure your app is able to create a "new conversation_id" for each session. You may find this tutorial helpful "Building a client application" :

https://console.bluemix.net/docs/services/conversation/develop-app.html#setting-up-the-watson-assistant-service

https://developer.ibm.com/answers/questions/287623/how-do-you-maintain-the-conversation-context-when/

abnerfcastro commented 6 years ago

I think I know what the issue is. I'm going to try something out later on tonight. I'll let you know if it works and update the repository.

vrcrush commented 6 years ago

hi @abnerfcastro any luck? I started creating the code from scratch using node, and it seems that the context part is the key. I was able to have multiple bots in the console and the conversation doesnt get mixed up. I am not sure where this similar code will be in your angular project. could you advise_? thanks

// Prompt for the next round of input. var newMessageFromUser = prompt('>> '); // Send back the context to maintain state. service.message({ workspace_id: workspaceid, input: { text: newMessageFromUser }, context : response.context,_ }, processResponse)