Contains all packages for running ConversationLearner bots.
Перейти к файлу
Matt Mazzola e6f8978687
fix: remove references to old registry dialearn.pkgs from webchat (#55)
2021-05-20 13:34:21 -07:00
.circleci Fix Test Bug Plus test runner scripts (#23) 2019-12-30 19:10:22 -08:00
.github build: exclude webchat from tests (#9) 2019-12-18 11:27:27 -08:00
.vscode fix: hide action types (#46) 2020-02-20 16:36:51 -08:00
packages fix: remove references to old registry dialearn.pkgs from webchat (#55) 2021-05-20 13:34:21 -07:00
.coveralls.yml fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
.editorconfig fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
.gitignore Fix CircleCI Exposed Token Issue in Test Code (#17) 2019-12-22 17:57:52 -08:00
.travis.yml fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
CHANGELOG.md chore(release): publish v0.505.2 [skip ci] 2020-05-27 16:47:04 +00:00
CODE_OF_CONDUCT.md Initial CODE_OF_CONDUCT.md commit 2019-12-16 09:07:01 -08:00
CONTRIBUTING.md fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
LICENSE Initial LICENSE commit 2019-12-16 09:07:03 -08:00
README.md fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
RELEASE.md fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
SECURITY.md Initial SECURITY.md commit 2019-12-16 09:07:04 -08:00
appveyor.yml fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
azure-pipelines.yml feat: change Init() to Factory patterns to avoid temporal coupling (Migrated branch) (#8) 2019-12-18 11:27:02 -08:00
code-of-conduct.md fix: get CircleCI build running (#1) 2019-12-16 13:16:51 -08:00
lerna.json chore(release): publish v0.505.2 [skip ci] 2020-05-27 16:47:04 +00:00
package-lock.json chore: update root to be same as working version 2019-12-16 14:58:11 -08:00
package.json Test Result Reporting Tool (#15) 2019-12-19 18:59:39 -08:00

README.md

ConversationLearner

CircleCI\

This repo contains 5 major components:

  1. Samples - Fully working bots using express, botbuilder, and the ConversationLearner SDK which demonstrate different use cases in code.
  2. SDK - Conversation Learner Software Development Kit. This acts as entry point and is intended to be included in your own bots.
  3. Administration UI - Provides graphical interface to manage, train, and test your bot.
  4. WebChat - Custom fork of standard WebChat which adds ability to load existing activities and show editing controls.
  5. Models - Contains shared code between the SDK and UI such as types and utilities.

Getting started

  1. Clone and build the repo
git clone https://github.com/Microsoft/ConversationLearner cl
cd cl
npm i
npx lerna bootstrap
npx lerna run build
  1. Start the bot

Create new .env file in the samples directory with your LUIS keys.

cd ./packages/samples
cp .env.example .env
<Add LUIS_AUTHORING_KEY and save>
npm start

You should see output similar to below (PORT may be different):

Adding /sdk routes
Adding /ui routes
Adding /directline routes
Server listening at: http://localhost:3978

Note the /ui /sdk and /directline routes are printed because we're running in development. These routes are not mounted in production.

  1. Run the UI

(Might need new terminal)

cd ./packages/ui
npm start

More Details about the SDK (Software Development Kit) package

The SDK includes contains 2 notable components:

  1. Express Router - The router is mounted to your server in development and used by the UI (above) during training
  2. Recognizer - Similar to other BotBuilder recognizers like LUIS the CL recognizer processes the given Bot context and returns results such as messages, adaptive cards, and more.

Using the SDK

Install @conversationlearner/sdk in consuming project:

npm install @conversationlearner/sdk --save-exact

Note: We recommend using --save-exact to lock the version since we are NOT following SemVer at this time. This can help prevent accidental package updates which may contain breaking changes if you are not using package-lock.json. We will move to following SemVer soon as we improve our release process.

Using the recognizer:

import { ConversationLearner, ICLOptions, ClientMemoryManager } from '@conversationlearner/sdk'

...

const sdkRouter = ConversationLearner.Init({
    CONVERSATION_LEARNER_SERVICE_URI: process.env.CONVERSATION_LEARNER_SERVICE_URI
})
if (isDevelopment) {
    server.use('/sdk', sdkRouter)
}

...

const cl = new ConversationLearner(modelId);

server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async context => {
        const result = await cl.recognize(context)
        
        if (result) {
            cl.SendResult(result);
        }
    })
})

Using the UI router.

Previously the UI was served separately and required to be run on a different port than your bot. Now the UI is included with your bot! The ui is availble at the /ui path of your bot url. The leaves the root / available for you to add a Bot landing page. There you can summarize your bot's purpose and capabilities to the user.

...
import { uiRouter } from '@conversationlearner/sdk'

...

"Mount the router at the root `/` as it internally has the /ui paths."
server.use(uiRouter)

...

server.listen(port)