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
125 stars 65 forks source link

I Retrofitted Intermediator code in my ChatBot. HandoffMiddleware.OnTurnAsync(..) not getting triggered when I type utterance. is it because my code has BotController : ControllerBase class #59

Open gauravanandwhiz opened 3 years ago

gauravanandwhiz commented 3 years ago

Hi @tompaana ,

Problem Statement

I retrofitted the intermediator bot code to my existing MS Bot Framework V4(c#) based chat bot but, agent handoff is not working:

Observation-> BotController Class:

// Licensed under the MIT License.
//
// Generated with Bot Builder V4 SDK Template for Visual Studio EchoBot v4.6.2

using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.Integration.AspNet.Core;

namespace Neo.Controllers
{
    // This ASP Controller is created to handle a request. Dependency Injection will provide the Adapter and IBot
    // implementation at runtime. Multiple different IBot implementations running at different endpoints can be
    // achieved by specifying a more specific type for the bot constructor argument.
    [Route("api/messages")]
    [ApiController]
    public class BotController : ControllerBase
    {
        private readonly IBotFrameworkHttpAdapter Adapter;
        private readonly IBot Bot;

        public BotController(IBotFrameworkHttpAdapter adapter, IBot bot)
        {
            Adapter = adapter;
            Bot = bot;
        }

        [HttpPost, HttpGet]
        public async Task PostAsync()
        {
            // Delegate the processing of the HTTP POST to the adapter.
            // The adapter will invoke the bot.
            await Adapter.ProcessAsync(Request, Response, Bot);
        }
    }
}

Query

Could you please suggest How I can fix this issue? As the HandoffMiddleware.OnTurnAsync(..) works fine when I execute your code but, doesn't get triggered from My Code after retrofitting IntermediateBot code on it.

gauravanandwhiz commented 3 years ago

Hi @tompaana , How are you doing :) A humble request if, you could have a view at this issue and suggest if, we can have a way around and have the Intermediate Bot code running in conjunction wit my existing Chat Bot :)

Thanks & Regards, Gaurav

gauravanandwhiz commented 3 years ago

@tompaana , This is wonderful piece of code which works with older version of Microsoft.Bot.Builder (4.2.2) i.e. without using Microsoft.Bot.Builder.Dialogs

The Intermediator-Bot code stops working on upgrading Microsoft.Bot.Builder to version 4.10.3

As we need to use Dialogs, for which we needed to add Microsoft.Bot.Builder.Dialogs (4.10.3), this required upgrading the complete Microsoft.Bot.Builder to version 4.10.3

I want to keep my hopes alive

I want to keep my hopes alive as, there hasn't been any response from you could you please confirm if, it would be possible to make this code with with Microsoft.Bot.Builder to version 4.10.3 as it has introduces the concept of APIController. I had made effort estimations based on presence of this accellerator but, now my project plan seems to be in Jeopardy.

Could you please acknowledge and honestly mention if, it needs to be rewritten to support higher version of Microsoft.Bot.Builder(4.10.3) and related packages. Eagerly Looking forward for your for an acknowledgement from your end :)

tompaana commented 3 years ago

Hello and sorry for such a late reply. Unfortunately, I simply have no time to support this project right now. Perhaps the bot community has the answers.

Best regards, Tomi

gauravanandwhiz commented 3 years ago

@tompaana thanks for your honest response :) 👍

I would be grateful if , you could point me to some place where an upgraded implementation of your code exists :) as, it would help me come out of the difficult situation I am in regarding my project plan and client commitment :)