1 | # ConversationLearner-SDK
|
2 |
|
3 | Conversation Learner Software Development Kit
|
4 |
|
5 | [![Travis](https://travis-ci.org/Microsoft/ConversationLearner-SDK.svg?branch=master)](https://travis-ci.com/Microsoft/ConversationLearner-SDK)
|
6 | [![CircleCI](https://circleci.com/gh/Microsoft/ConversationLearner-SDK.svg?style=shield)](https://circleci.com/gh/Microsoft/ConversationLearner-SDK)
|
7 | [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/Microsoft/ConversationLearner-SDK?branch=master&svg=true)](https://ci.appveyor.com/project/conversationlearner/conversationlearner-sdk)
|
8 |
|
9 | This repo is intended to be consumed by your bot. The SDK contains 3 major components:
|
10 | 1. Administration UI - provides graphical interface to manage, train, and test your bot
|
11 | 2. [Express](https://expressjs.com/en/guide/routing.html) Router - The router is mounted to your server in development and used by the UI (above) during training
|
12 | 3. Recognizer - Similar to other [BotBuilder](https://github.com/Microsoft/botbuilder-js) recognizers like [LUIS](https://github.com/Microsoft/botbuilder-js/blob/master/samples/luis-bot-es6/app.js#L64) the CL recognizer processes the given Bot context and returns results such as messages, adaptive cards, and more.
|
13 |
|
14 | # Getting started
|
15 |
|
16 | Install @conversationlearner/sdk in consuming project:
|
17 |
|
18 | ```bash
|
19 | npm install @conversationlearner/sdk --save-exact
|
20 | ```
|
21 |
|
22 | > 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.
|
23 |
|
24 | Using the recognizer:
|
25 |
|
26 | ```typescript
|
27 | import { ConversationLearner, ICLOptions, ClientMemoryManager } from '@conversationlearner/sdk'
|
28 |
|
29 | ...
|
30 |
|
31 | const sdkRouter = ConversationLearner.Init({
|
32 | CONVERSATION_LEARNER_SERVICE_URI: process.env.CONVERSATION_LEARNER_SERVICE_URI
|
33 | })
|
34 | if (isDevelopment) {
|
35 | server.use('/sdk', sdkRouter)
|
36 | }
|
37 |
|
38 | ...
|
39 |
|
40 | const cl = new ConversationLearner(modelId);
|
41 |
|
42 | server.post('/api/messages', (req, res) => {
|
43 | adapter.processActivity(req, res, async context => {
|
44 | const result = await cl.recognize(context)
|
45 |
|
46 | if (result) {
|
47 | cl.SendResult(result);
|
48 | }
|
49 | })
|
50 | })
|
51 | ```
|
52 |
|
53 | ## Using the UI router.
|
54 | 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.
|
55 |
|
56 | ```typescript
|
57 | ...
|
58 | import { uiRouter } from '@conversationlearner/sdk'
|
59 |
|
60 | ...
|
61 |
|
62 | "Mount the router at the root `/` as it internally has the /ui paths."
|
63 | server.use(uiRouter)
|
64 |
|
65 | ...
|
66 |
|
67 | server.listen(port)
|
68 | ```
|
69 |
|
70 |
|
71 | # Contributing
|
72 |
|
73 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
74 |
|
75 | ## Semantic Release
|
76 |
|
77 | Semantic release works by analyzing all commits that have occurred since the last release, computing the next version to increment based on the most significant commit found, then tagging and publishing a new package with that version.
|
78 |
|
79 | See: https://semantic-release.gitbooks.io/semantic-release/content/#how-does-it-work
|
80 |
|
81 | In order to analyze the commit messages reliably they must be in a known format. To help writing these commits there is a tool at `npm run commit` which acts a wizard walking you through the options.
|
82 |
|
83 | For most use cases the only change required is to type a special word in front of your normal commit messages. Instead of "add function to compute X" put "feat: add function to compute X". Based on the rules "feat" is mapped to a "minor" release.
|
84 |
|
85 | Video Demo: https://youtu.be/qf7c-KxBBZc?t=37s
|
86 |
|
87 | # Release Process
|
88 |
|
89 | See: [RELEASE](/RELEASE.md) |
\ | No newline at end of file |