botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Skype group chat messages do not reach LUIS

Open liiver opened this issue 10 years ago • 18 comments

There seems to be some wierd stuff going on between my Bot and LUIS framework From my 1:1 conversation with Bot, LUIS works nicely and messages reach it (I can also see it from the LUIS logs) But with My group chat that I created and also added Bot to it, from there the messages dont reach LUIS. Or atleast they dont seem to reach the correct one. I have tried to delete the whole LUIS app and create the new one but nothing. ALso I have tried resetting various PrivateConversationData, ConversationData and UserData variables but nothing. If I post the exact same message to the 1:1 chat of Bot or via the groupChat, on both occasion I get back the first Intent as "None" from LUIS, but the Intent Scores are different. For me it seems that the groupChat still reaches some old LUIS App I used and got stuck Is it somehow possible to check that?

liiver avatar Sep 13 '16 19:09 liiver

Is there a a way that this LUIS AppId I specify in my dialog header gets "stuck" somewhere and it uses the old one?

liiver avatar Sep 13 '16 20:09 liiver

I presume you're using the Node SDK?

@Stevenic is the LUIS AppId serialized as part of the dialog state in Node?

willportnoy avatar Sep 13 '16 20:09 willportnoy

no, I'm using C#. But something is totally weird with it. When I type my question into 1:1 chat, it returns with the intent I created in Luis and all is ok. But when I type exact same question to my groupchat, where the bot also is (with the @botname prefix) then it still ends up in Luis None flow somehow

liiver avatar Sep 13 '16 20:09 liiver

The LuisDialog has a reference to a LuisService which stores a LuisModelAttribute, and I believe these are all serialized with the dialog stack state, so if you changed LUIS AppIds, it's possible it's pointing to the old one. Retraining and republishing a LUIS model should not change the AppId though.

In a group conversation, the dialog stack state would be stored in the per user in conversation data store: https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Dialogs/DialogModule.cs#L155

which if you changed the code that selected the LUIS model while adding members to the group, I suspect that different users could get different models.

Each user could reset their own state with " /deleteprofile" though.

willportnoy avatar Sep 13 '16 20:09 willportnoy

The problem is that I wanst able to send the " /deleteprofile" command properly into the Skype groupchat. In 1:1 the /deleteprofile works nicely. Is there some other way to clear out this dialog stack state programmatically?

liiver avatar Sep 14 '16 06:09 liiver

It seems that "stuck" somewhere else than user in coversation state. If I add a new participant to the conversation, then indeed it WORKS for the new participant (duh). But for me it is not, pointing to some other LUIS probably. But this is also weird, that even If I create a totally new chat with the Bot, It still fails for my user. I would expect the new chat Id is totally different and everything is recreated.

liiver avatar Sep 14 '16 07:09 liiver

👍 Same issue. I am using Node SDK.

chinchang avatar Sep 14 '16 08:09 chinchang

@liiver, you need a space before the slash in the " /deleteprofile" so it's not interpreted natively by the channel.

This is how "/deleteprofile" is implemented, which shows you how to clear the state programmatically: https://github.com/Microsoft/BotBuilder/blob/aaf86d7b0542c8e2758bf14baa6b7cc67291e390/CSharp/Library/Dialogs/DeleteProfileScorable.cs#L57

willportnoy avatar Sep 14 '16 21:09 willportnoy

@liiver could you log the url being called for the LUIS service and compare them between group and individual chat? You can register a proxy ILuisService that logs the url before making the call, for example.

willportnoy avatar Sep 14 '16 21:09 willportnoy

The problem is that " /deleteprofile" only seems to work for me in 1:1 skype conversation In group chat I am unable to make the command work. Sending command like "@Botname /deleteprofile" ends up just in a regular LUIS "None" intent and not an actual deletion.

Unfortunately I am unable to get data from ILuisService. I am not so familiar with interfaces in C# so I dont really know how to implement this stuff. Any code examples in this case would be appreciated.

liiver avatar Sep 15 '16 13:09 liiver

any ideas on sending " /deleteprofile" to Skype group chat?

liiver avatar Sep 19 '16 12:09 liiver

Is https://github.com/Microsoft/BotBuilder/issues/1276 a more specific description of this issue?

willportnoy avatar Sep 20 '16 21:09 willportnoy

Basically yes, that the main issue of it. Secondary issue of "on switching LUIS app, group messages still go to old one" also exists, but I overcame it for now with registering a new bot

liiver avatar Sep 21 '16 06:09 liiver

@liiver In group conversation cases on Skype, you have @botid in the text of the incoming activity when your bot is getting the message. As a result the DeleteProfileScorable regex might not match depending on how the bot is mentioned.

I recommend removing the @botid mention from the message using the following helper: https://github.com/Microsoft/BotBuilder/blob/5cf71c742f27d89e9dbc4076f850122bd6edac11/CSharp/Library/Microsoft.Bot.Connector/ActivityEx.cs#L131 before posting it to the bot. For example, you can write a IPostToBot and register it as the most outer one with the DialogModule that removes the bot`s mentions from the activity.Text before positing it to the bot.

msft-shahins avatar Oct 06 '16 18:10 msft-shahins

I created a middleware to preprocess the messages and remove all the mentions for the time being.

However, I think a bot will be useful if it is able to receive messages without mention. This will allow the bot to jump into the conversation whenever the intent is within the scope of the bot.

e.g. If a group of people try to figure out where to go for dinner, it will be nice if the bot can jump in and provide recommendations.

euanlau avatar Oct 14 '16 21:10 euanlau

@liiver sorry for the offtopic, but how to add the bot to the group chat? When I click to the "Add People" button I see only regular accounts, not bots. (ps my bot is not published, but 1:1 conversation works well, also with private chat with Bot I can add people to conversation)

maks-rafalko avatar Jan 06 '17 15:01 maks-rafalko

I think its not enabled by default. In botframework.com, you have to edit your Skype Channel. And from there enable Group messaging. Then it should appear in the list when you click Add people. I think I had the same issue in the beginning.

liiver avatar Jan 06 '17 15:01 liiver

@liiver I have already enabled this setting but nothing helps. PS my bot is not published

maks-rafalko avatar Jan 06 '17 15:01 maks-rafalko