This is the guide for preparing Bluemix and Docker environments
-
Click here to download the
shell branch
-
After downloading, unzip file
Chatbot-shell.zip
-
Go to
/Chatbot-shell
folder under the Chatbot project root folder from theTerminal
orcmd
-
Find your
Terminal
frommacOS
-
Find your
cmd
fromWindows
-
Find your project folder, e.g.
/path/to/Chatbot-shell
, then run the command:cd /path/to/Chatbot-shell
docker pull cognitivecoe/webchatbot:latest
- Update
/Chatbot-shell/Docker.env
with credentials
- Please be aware of the variables of the values DO NOT HAVE quotes and between key and value there is a
=
, e.g.key
=value
-
Good example:
VISUAL_RECOGNITION_API_KEY=abcdefghijklmnopqrstuvwxyz12345678901234
-
Bad example
VISUAL_RECOGNITION_API_KEY="abcdefghijklmnopqrstuvwxyz12345678901234"
-
Create Watson services
-
After register the Bluemix account, then sign in
-
Go to Bluemix catalog, search
Visual Recognition
-
Click
Create
button after selecting theFree plan
-
Click on
Service credentials
tab, then select credential dropdown button, copyapi_key
-
Update
/Chatbot-shell/Docker.env
, paste copiedapi_key
toDocker.env
Train Visual Recognition
API with the training files, get new trained classifier ID then apply it in /Chatbot-shell/Docker.env
-
Go back to Bluemix console, go back to
Manage
tab then click onVisual Recognition Tool (Beta)
button to launch theVisual Recognition Tool
-
Due to the GFW blocked the unsecured connection of Bluemix as below, use https://visual-recognition-tooling.mybluemix.net/
-
For the first time visit of this tool, the API key is needed for authentication
-
Then click on
Create
button to get started -
You will see this page, go to next step refer to following step
-
Choose training zip files from
/Chatbot-training
folder, then chooseALL
of them according to the class names including the negative sample -
Name each of the classes
-
Copy the
classifier ID
-
Paste
classifier ID
in/Chatbot-shell/Docker.env
-
Go to Bluemix catalog, search
Conversation
-
Name service as you want, and make sure there is a
Credential name
available then click onCreate
button -
Then you will see this page, and click on
Service credentials
, then copy username and password -
Paste
username
andpassword
in/Chatbot-shell/Docker.env
-
Start creating a new
Conversation
, click onManage
menu on the left then click onLaunch tool
-
For the first time visit of this tool, the IBM ID is needed for authentication, but as long as you've authenticated by Bluemix, it will treat you as a authorized user after clicking on the
Log in with IBM ID
by default. Otherwise you can try to sign in again with your Bluemix credentials -
Click on
Upload
icon to upload the training file, to locate the training file, go to/Chatbot-training/conversation
folder, findinnovation-day.json
file -
There will be one more panel named
iChat
, click on the menu on the top right, then selectView details
in order to copy workspace ID -
Paste
workspace ID
in/Chatbot-shell/Docker.env
-
Go to Bluemix catalog, search
Speech to Text
-
Name service as you want, and make sure there is a
Credential name
available then click onCreate
button -
Then you will see this page below, go to next step refer to following step
-
Copy
username
andpassword
, paste them to/Chatbot-shell/Docker.env
and save the file -
Go to Bluemix catalog, search
Text to Speech
-
Then you will see this page below, go to next step refer to following step, then copy username and password
-
Paste
username
andpassword
in/Chatbot-shell/Docker.env
-
Update
/Chatbot-shell/Docker.env
with your Blockchain service UR, replace it with actual one if you're hosting the Blockchain service on the Bluemix (refer to Blockchain practice)APPLICATION_API_URL=https://your_block_chain_service.mybluemix.net
If you are hosting the Blockchain service locally, obtain IP address first:
-
macOS: Go to
System Preferences
->Network
, then copy your IP address -
Windows: Refer this guide to get the IP address
-
Replace the URL with service URL (with your
IP
address)ENV APPLICATION_API_URL http://xxx.xxx.xxx.xxx:3000
Now you're ready for building the Docker
image.
docker run -p 8888:9080 --env-file Docker.env cognitivecoe/webchatbot
Now after getting this message The server defaultServer is ready to run a smarter planet.
, you can visit your Chatbot web application via:
- macOS: http://localhost:8888/
- Windows: Refer to
Install docker on Windows 10 (5, 6)
section of the doc, so the format of the URL would be likehttp://xxx.xxx.x.x:8888/