tompaana / intermediator-bot-sample

A sample bot, built with the Microsoft Bot Framework (v4), that routes messages between two users on different channels.
https://tompaana.github.io/content/chatbots_as_middlemen.html
MIT License
124 stars 66 forks source link

Identify conversation end and clean it automatically #8

Open justinvan0603 opened 7 years ago

justinvan0603 commented 7 years ago

Hello @tompaana ,I've taken more time to research your sample. And I've found that the bot seem doesn't know when the conversation is end. I'm thinking of the issue when we are going to make it in long running (the memory may run-off) even though we store it in table such as Azure Table but it still reduncdant to store something we won't use it again. So is there any idea to handle this situation? P/s: It took me lots of time to read your document and your code but it seems to be hard to understand it clearly. Should you write the document more focusing on the behaviour of the bot when the method Post is invoked. Thanks for attention my post.

tompaana commented 7 years ago

At the moment you should think of MessageRouterManager as the main API you use in your bot. You can end the conversation by calling EndEngagementAsync method. RemoveParty will have the same effect.

For demonstrative purposes the DefaultBotCommandHandler can be used; command end ends the conversation. Needless to say this should not be the case in production env.

Can you please point to places that are difficult to understand? I'd be happy to revise the documentation based on your feedback.

justinvan0603 commented 7 years ago

Hi @tompaana, right now, i'm trying to make an Agent UI project that connect with the Bot by that way:

  1. The customer ask the bot to meet Agent
  2. The bot using SignalR to notify the Agent to Create a Chat control
  3. Now the Bot will work as a middle men between Agent and Customer till it recognize the conversation is ended. In my point of view, if we build an Agent UI that connect by looping request to the AgentController Action seems painful if we want the Bot to work in long-term to serve lots of Client so that I use SignalR with the Bot to reduce it. However, after I've read your code, testing it by running each line, each method, I still didn't find the best method to intergrate my SignalR well. P/s: I knew that MessageRouterManager have method to end conversation but how can the bot identify the conversation is end and remove it automatically without we command it (like using command end as you've mentioned). P/s: i've surfed many page write about the Bot Framework. It seem nobody has a new solution to communicate between Agent and the Bot so I plan to make a Agent UI using via SignalR and publish it with the monumental support of your Bot Framework core. i'm glad to seeing your advice to me. We can make the Bot framework more popularity to developer!
tompaana commented 7 years ago

I think we should add a backchannel interface similar to command handling. This would enable things like agent UI to directly control the bot i.e. you could have buttons like "disconnect" in the agent UI to end an engagement etc.