From 321426b86885a3d94a836116255010754c122fd7 Mon Sep 17 00:00:00 2001 From: TCS-Watson-Demo Date: Tue, 20 Dec 2016 10:16:35 +0530 Subject: [PATCH 1/4] Update README.md Customise the app --- README.md | 216 +----------------------------------------------------- 1 file changed, 2 insertions(+), 214 deletions(-) diff --git a/README.md b/README.md index 36b99341..d07e6e75 100644 --- a/README.md +++ b/README.md @@ -1,214 +1,2 @@ -# Conversation Sample Application [![Build Status](https://travis-ci.org/watson-developer-cloud/conversation-simple.svg?branch=master)](http://travis-ci.org/watson-developer-cloud/conversation-simple) [![codecov.io](https://codecov.io/github/watson-developer-cloud/conversation-simple/coverage.svg?branch=master)](https://codecov.io/github/watson-developer-cloud/conversation-simple?branch=master) - -This Node.js app demonstrates the Conversation service in a simple chat interface simulating a cognitive car dashboard. - -![Demo](readme_images/demo.gif) - -You can view a [demo][demo_url] of this app. - -## Before you begin - -* Create a Bluemix account - * [Sign up][sign_up] in Bluemix, or use an existing account. Your account must have available space for at least 1 app and 1 service. -* Make sure that you have the following prerequisites installed: - * The [Node.js][node_link] runtime (including the [npm][npm_link] package manager) - * The [Cloud Foundry][cloud_foundry] command-line client - -## Installing locally - -If you want to modify the app or use it as a basis for building your own app, install it locally. You can then deploy your modified version of the app to the Bluemix cloud. - -### Getting the files - -Use GitHub to clone the repository locally, or [download the .zip file](https://github.com/watson-developer-cloud/conversation-simple/archive/master.zip) of the repository and extract the files. - -### Setting up the Conversation service - -1. At the command line, go to the local project directory (`conversation-simple`). - -1. Connect to Bluemix with the Cloud Foundry command-line tool. For more information, see the Watson Developer Cloud [documentation][cf_docs]. - -1. Create an instance of the Conversation service in Bluemix. For example: - - ```bash - cf create-service conversation free my-conversation-service - ``` - -### Importing the Conversation workspace - -1. In your browser, navigate to your Bluemix console. - -1. From the **All Items** tab, click the newly created Conversation service in the **Services** list. - - ![Screen capture of Services list](readme_images/conversation_service.png) - -1. On the Service Details page, click **Launch tool**. - -1. Click **Import** in the Conversation service tool. Specify the location of the workspace JSON file in your local copy of the app project: - - `/training/car_workspace.json` - -1. Select **Everything (Intents, Entities, and Dialog)** and then click **Import**. The car dashboard workspace is created. - -### Configuring the app environment - -1. Copy the `.env.example` file to a new `.env` file. - -1. Create a service key in the format `cf create-service-key `. For example: - - ```bash - cf create-service-key my-conversation-service myKey - ``` - -1. Retrieve the credentials from the service key using the command `cf service-key `. For example: - - ```bash - cf service-key my-conversation-service myKey - ``` - - The output from this command is a JSON object, as in this example: - - ```JSON - { - "password": "87iT7aqpvU7l", - "url": "https://gateway.watsonplatform.net/conversation/api", - "username": "ca2905e6-7b5d-4408-9192-e4d54d83e604" - } - ``` - -1. Paste the `password` and `username` values (without quotation marks) from the JSON into the `CONVERSATION_PASSWORD` and `CONVERSATION_USERNAME` variables in the `.env` file. For example: - - ``` - CONVERSATION_USERNAME=ca2905e6-7b5d-4408-9192-e4d54d83e604 - CONVERSATION_PASSWORD=87iT7aqpvU7l - ``` - -1. In your Bluemix console, open the Conversation service instance where you imported the workspace. - -1. Click the menu icon in the upper-right corner of the workspace tile, and then select **View details**. - - ![Screen capture of workspace tile menu](readme_images/workspace_details.png) - -1. Click the ![Copy](readme_images/copy_icon.png) icon to copy the workspace ID to the clipboard. - -1. On the local system, paste the workspace ID into the WORKSPACE_ID variable in the `.env` file. Save and close the file. - -### Installing and starting the app - -1. Install the demo app package into the local Node.js runtime environment: - - ```bash - npm install - ``` - -1. Start the app: - - ```bash - npm start - ``` - -1. Point your browser to http://localhost:3000 to try out the app. - -## Testing the app - -After your app is installed and running, experiment with it to see how it responds. - -The chat interface is on the left, and the JSON that the JavaScript code receives from the Conversation service is on the right. Your questions and commands are interpreted using a small set of sample data trained with the following intents: - - turn_on - turn_off - turn_up - turn_down - traffic_update - locate_amenity - weather - phone - capabilities - greetings - goodbyes - -Type a request, such as `music on` or `I want to turn on the windshield wipers`. The system understands your intent and responds. You can see the details of how your input was understood by examining the JSON data in the `Watson understands` section on the right side. - -For example, if you type `Turn on some music`, the JSON data shows that the system understood the `turn_on` intent with a high level of confidence, along with the `appliance` entity with a value of `music`. - -For more information about intents, see the [Conversation service documentation][doc_intents]. - -To see details of how these intents are defined, including sample input for each intent, launch the Conversation tool. - -## Modifying the app - -After you have the app deployed and running, you can explore the source files and make changes. Try the following: - -* Modify the .js files to change the app logic. -* Modify the .html file to change the appearance of the app page. -* Use the Conversation tool to train the service for new intents, or to modify the dialog flow. For more information, see the [Conversation service documentation][docs_landing]. - -## Deploying to Bluemix - -You can use Cloud Foundry to deploy your local version of the app to Bluemix. - -1. In the project root directory, open the `manifest.yml` file: - - * In the `applications` section of the `manifest.yml` file, change the `name` value to a unique name for your version of the demo app. - * In the `services` section, specify the name of the Conversation service instance you created for the demo app. If you do not remember the service name, use the `cf services` command to list all services you have created. - - The following example shows a modified `manifest.yml` file: - - ```yml - --- - declared-services: - conversation-service: - label: conversation - plan: free - applications: - - name: conversation-simple-app-test1 - command: npm start - path: . - memory: 256M - instances: 1 - services: - - my-conversation-service - env: - NPM_CONFIG_PRODUCTION: false - ``` - -1. Push the app to Bluemix: - - ```bash - cf push - ``` - - Access your app on Bluemix at the URL specified in the command output. - -## Troubleshooting - -If you encounter a problem, you can check the logs for more information. To see the logs, run the `cf logs` command: - -```none -cf logs --recent -``` - -## License - -This sample code is licensed under Apache 2.0. -Full license text is available in [LICENSE](LICENSE). - -## Contributing - -See [CONTRIBUTING](CONTRIBUTING.md). - -## Open Source @ IBM - -Find more open source projects on the -[IBM Github Page](http://ibm.github.io/). - - -[cf_docs]: (https://www.ibm.com/watson/developercloud/doc/getting_started/gs-cf.shtml) -[cloud_foundry]: https://github.com/cloudfoundry/cli#downloads -[demo_url]: http://conversation-simple.mybluemix.net/ -[doc_intents]: (http://www.ibm.com/watson/developercloud/doc/conversation/intent_ovw.shtml) -[docs]: http://www.ibm.com/watson/developercloud/doc/conversation/overview.shtml -[docs_landing]: (http://www.ibm.com/watson/developercloud/doc/conversation/index.shtml) -[node_link]: (http://nodejs.org/) -[npm_link]: (https://www.npmjs.com/) -[sign_up]: bluemix.net/registration +This Node.js app demonstrates the Conversation service in a simple chat interface. +developed for the TCS Waston Training. From 4315cd5c8d2232ec7800deca0b0059e917ca2f75 Mon Sep 17 00:00:00 2001 From: TCS-Watson-Demo Date: Tue, 20 Dec 2016 10:18:18 +0530 Subject: [PATCH 2/4] Update README.md Customize --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d07e6e75..1171afac 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ This Node.js app demonstrates the Conversation service in a simple chat interface. -developed for the TCS Waston Training. +developed for the TCS Waston training. From 346a0285d44327357d86dfce1e9dba8b4e4cf58d Mon Sep 17 00:00:00 2001 From: guptaatul78 Date: Wed, 21 Dec 2016 15:45:28 +0530 Subject: [PATCH 3/4] Update and rename .env.example to .env added workspace id --- .env | 4 ++++ .env.example | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 .env delete mode 100644 .env.example diff --git a/.env b/.env new file mode 100644 index 00000000..b558ed68 --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +# Environment variables +WORKSPACE_ID=58f9f9cb-3a21-47e5-b158-2da5398db7be +CONVERSATION_USERNAME=ed43465a-b3da-44ea-884c-5fad50b0ade2 +CONVERSATION_PASSWORD=rRymuRDzTWZR diff --git a/.env.example b/.env.example deleted file mode 100644 index 4e13e6c9..00000000 --- a/.env.example +++ /dev/null @@ -1,4 +0,0 @@ -# Environment variables -WORKSPACE_ID= -CONVERSATION_USERNAME= -CONVERSATION_PASSWORD= From b8cc357437fceac8050f2a32d9e5f1ac0df77859 Mon Sep 17 00:00:00 2001 From: guptaatul78 Date: Wed, 21 Dec 2016 15:51:42 +0530 Subject: [PATCH 4/4] Update manifest.yml added service name --- manifest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.yml b/manifest.yml index fdb05a54..a72992a2 100755 --- a/manifest.yml +++ b/manifest.yml @@ -10,6 +10,6 @@ applications: memory: 256M instances: 1 services: - - my-conversation-service + - Conversation-29 env: NPM_CONFIG_PRODUCTION: false