Build a chat bot to answer questions.
This repository contains code for the QnABot, described in the AWS AI blog post “Creating a Question and Answer Bot with Amazon Lex and Amazon Alexa”. To launch the QnABot follow the instructions in the blog post.
To customize the QnABot use the following instructions to set up a local dev environment.
- Run Linux. (tested on Amazon Linux)
- Install npm >3 and node >6. (instructions)
- Clone this repo.
- Set up an AWS account. (instructions)
- Configure AWS CLI and local credentials. (instructions)
Note: Lex is currently only supported in the us-east-1 region.
First, install all prerequisites:
npm install
Next, use the following command to launch a CloudFormation template to create the S3 bucket to be used for lambda code and CloudFormation templates. Wait for this template to complete (you can watch progress from the AWS CloudFormation console)
npm run stack dev/bootstrap up
After the template has launched, use the following command to build all assets and upload to the S3 bucket created in the previous step:
npm run upload
Finally, use the following command to launch template to deploy the QnA bot in your AWS account. When the stack has completed you will be able to log into the Designer UI (The URL is an output of the template) with the password set in "templates/test/master.json":
npm run stack test/master up
All script descriptions are found in /docs/scripts.md
The templates are found in the /templates directory. The template master-base.json is the entry point and the other templates are nested in master-base.json.
Lambda functions are found in the /lambda directory.
The Designer UI and client UI code is in the /website/admin directory.
Answers to questions may include links to other websites. To efficiently support URLs as part of an answer, Markdown syntax should be used to represent these links. For example, a reference to www.amazon.com should be formatted as [Amazon](http://www.amazon.com\). http, https, and ftp are supported protocols.
The following will launch a CloudFormation template to create AWS resources in your account that are used in the Lambda, CloudFormation, and WebUI tests.
npm run dev-up
Once the template has completed you can run the tests in the following sections.
The CloudFormation test templates are in the templates/test folder. Run a template test with:
npm run stack test/{template-name}
For example, if you want to launch a template with filename "es.json" run the following command:
npm run check test/es
You also can check a template's syntax with:
npm run check {template's directory relative to /templates}/{template-name}
Each lambda directory has its own tests that can be run by executing the following command in that directory:
npm run test
The Test for the website are in the /website/admin/test. A development server can be setup by calling:
npm run server
You can view this local Designer UI at http://localhost:8000
Currently the only browsers supported are:
Chrome
FireFox
We are currently working on adding Microsoft Edge support.
See the LICENSE.md file for details