Closed rameshananth closed 7 years ago
@rameshananth Check out the Contoso Flowers Bot example code and look into the section called Multi-Dialogs Approach - this shows some examples how to bundle dialogs into reusable libraries.
Dialogs can be composed with other dialogs to maximize reuse, and a dialog context maintains a stack of dialogs active in the conversation. In this sample, the main flow is implemented in the shop dialog and it is composed of several other dialogs that may also break-down into sub-dialogs.
Each of these dialogs are implemented as a BotBuilder Library (more information below). The important thing is that each library manages a small step in the flow, and the result of each is passed back to the dialog stack using session.endDialogWithResult().
For more information on the Library
class in Node SDK, see:
https://docs.botframework.com/en-us/node/builder/chat-reference/classes/_botbuilder_d_.library.html
A library of related dialogs used for routing purposes. Libraries can be chained together to enable the development of complex bots. The UniversalBot class is itself a Library that forms the root of this chain.
Libraries of reusable parts can be developed by creating a new Library instance and adding dialogs just as you would to a bot. Your library should have a unique name that corresponds to either your libraries website or NPM module name. Bots can then reuse your library by simply adding your parts Library instance to their bot using UniversalBot.library(). If your library itself depends on other libraries you should add them to your library as a dependency using Library.library(). You can easily manage multiple versions of your library by adding a version number to your library name.
System Information (Required)
Issue Description
I am currently developing a bot where the dialogs are stored as Javascript hashes and the dialog-intent maps are stored as a JSON objects, and I try and create the dialog entries for these separately, and I am trying to add the dialogs to the library dynamically through a for loop. Is this possible and is it supported?
Code Example
For e.g. in the file :
ServiceDeskLibrary.js
I have the following code:
and later on
later on in the same file
ServiceDeskHelper.js
I want to add:
And much later in
server.js
Unfortunately, when I do this and add the library to the bot with a require the intent is not recognized and the bot does not branch to this conversation at all.
Steps to Reproduce the Issue
Expected Behavior
Bot branches to the dialog
Actual Results
Bot does not branch to the dialog at all.