Skip to content

🤖 Build your own chatbot on the Innovation Day

License

Notifications You must be signed in to change notification settings

yanglsgithub/Chatbot

Repository files navigation

Chatbot

Build your own chatbot on the Innovation Day

Watson: ConversationWatson: Speech-to-TextWatson: Text-to-SpeechGitHub license

#Prerequisite

#Getting started

  • Create application of Liberty for Java on Bluemix

    Create applicationLiberty For JavaLiberty for Java
  • Connect Liberty for Java with Watson Conversation, Speech to Text and Text to Speech services

    Connect servicesWatson ConversationWatson ConversationCancel RestageConnect newSpeech to TextSpeech to TextCancel RestageConnect newText to SpeechText to SpeechCancel RestageConnected services
  • Click on Conversation from the Connections tab and click on Launch tool to open the website of IBM Watson Conversation, then click on Login with IBM ID to signin

    Conversation launch toolSign in conversation
  • Setup a Workspace of Watson Conversation and define dialogs (We will do it together on the Innovation Day)

#Bluemix DevOps guide

  • Register your Github account

  • Fork this repository and https://github.com/ChristiaL/IOTCar and deploy the nodejs web application

  • Go to Overview of the Liberty for Java application, find Continuous Delivery panel, and click on Enable button

    Enable Continous DeliveryGetting startedEnable toolchains
  • Click on Create Toolchain from Template for the first time you enable the Toolchains, and click on Simple Cloud Foundry toolchain

    Toolchains are enabledChoose ToolchainToolchain template
  • Click on GitHub button to Authorize the access to the GitHub, then you'll be navigated to GitHub website

    Authorize GitHub
  • On the GitHub, click on Authorize application button to grant the access from Bluemix DevOps service

    GitHub - Authroizing
  • Type Github password to confirm the operation

    GitHub - Authorizing
  • After authorization, select Existing as Repository type, and forked Github URL as Source repository URL, then click on Create button

    Create ToolchainChecking
  • Verify configurations to ensure the Pipeline deploys on right runtime with the correct application name

    Verify Pipeline ConfigurationVerify Pipeline ConfigurationVerify Pipeline Configuration
  • On this step, assuming you have already created one Watson Conversation, so switch back to Watson Conversation website, copy Workspace ID from the created Workspace by clicking on the menu on the top right of the Workspace panel, then click on View details and copy the Workspace ID

    Conversation WorkplaceConversation Workplace ID
  • Switch back to DevOps service and click on Eclipse Orion Web IDE, and select manifest.yml for editing. Change name to your app name then update CONVERSATION_WORKSPACE_ID to copied Workspace ID

    Edit manifest.yml
  • Click File menu and select Save

    Save yml file
  • Click on Git tab on the left, add commit comments and click on Commit button, after that click on Push button to update changes on the GitHub

    GitHub menuGitHub commitGitHub push
  • Go back to toolchain then click on Delivery Pipeline, if it does not automatically start, click Run Stage icon and wait for the build and deployment process

    Pipeline interfacePipeline interfacepipeline deployed

Start chatting using text or microphone with your personal Chatbot and Enjoy!

#Setup local environment (Optional) Installation

Run Chatbot application locally

 git clone git@github.com:CognitiveBuild/Chatbot.git
  • Import Chatbot into your Eclipse workspace
  • Add credentials into the file: /Chatbot/src/com/ibm/cto/Consts.java
/** * TODO: If you're testing this application locally, please get the credentials from Bluemix */publicStringTEXT_TO_SPEECH_USERNAME = "9a5bfa13-624f-436e-8af1-fc677a59a123"; publicStringTEXT_TO_SPEECH_PASSWORD = "berqyZXJ2J7f"; publicStringSPEECH_TO_TEXT_USERNAME = "af3a6ecc-2f35-4672-2595-35e15bcd758a"; publicStringSPEECH_TO_TEXT_PASSWORD = "KQ3itZUslHsc"; publicStringCONVERSATION_USERNAME = "134f9b10-7d4a-4e4f-92a0-7372f67331f7"; publicStringCONVERSATION_PASSWORD = "ijMoZB1vCVW6"; /** * TODO: Get Workspace ID from IBM Watson Conversation: https://ibmwatsonconversation.com */publicStringCONVERSATION_WORKSPACE_ID = "1e28d5ef-7506-4e76-814e-e83f3cbe6816"; /** * TODO: After deploy your nodejs service for controlling robot car, fill in the host name here */publicStringCAR_SERVICE_HOST = "your_car_host_name.mybluemix.net";
  • Right click on the Chatbot project, choose Run As > Run on Server, then choose Tomcat v9.0 Server at localhost to open http://localhost:8080/Chatbot/ and see the running application

Deploy your Chatbot on the Bluemix

  • Right click on the Chatbot project, choose Export > WAR file, then save the WAR file into Destination
  • Run bluemix and cf command to deploy the WAR file on the Bluemix, please refer Getting Started section of the Liberty for Java. And this is an example of the shell command
cd your_new_directory
 bluemix api https://api.ng.bluemix.net
 bluemix login -u your_name -o your_organization -s your_space
 cf push your_app_name -p your_war_file_directory/your_war_file.war

#Dependencies

  • Apache Common Codec
  • Apache HTTP Client
  • FastJSON
  • Watson Java SDK
  • Watson Speech JavaScript SDK

#Issues

  • Watson JavaScript Speech SDK does not support Safari
  • The way of obtaining token is not secured, do not use it on Production

#Sample data for Conversation City entities and company locations

  • Shenzhen: Technology Building II, No.1057, Nanhai Avenue
  • Shanghai: KIC Technology Center
  • Dalian: Hi-Tech Zone District, TianDi Software Park
  • Wuhan: Donghu HiTech Development Zone
  • Chengdu: Tianfu Software Park
  • Beijing: Pangudaguan Building

Direction entities

  • forward
  • backward
  • left
  • right

#License Copyright 2016 GCG GBS CTO Office under the Apache 2.0 license.

About

🤖 Build your own chatbot on the Innovation Day

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript92.4%
  • CSS4.5%
  • Java3.1%