{"id":13800499,"url":"https://github.com/watson-developer-cloud/food-coach","last_synced_at":"2026-01-14T16:42:24.789Z","repository":{"id":57117310,"uuid":"70281872","full_name":"watson-developer-cloud/food-coach","owner":"watson-developer-cloud","description":"DEPRECATED: this repo is no longer actively maintained","archived":true,"fork":false,"pushed_at":"2019-07-15T13:29:24.000Z","size":3787,"stargazers_count":39,"open_issues_count":0,"forks_count":106,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-06T23:13:56.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/watson-developer-cloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-07T20:49:22.000Z","updated_at":"2023-01-28T17:48:58.000Z","dependencies_parsed_at":"2022-08-23T04:40:38.185Z","dependency_job_id":null,"html_url":"https://github.com/watson-developer-cloud/food-coach","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/watson-developer-cloud/food-coach","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Ffood-coach","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Ffood-coach/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Ffood-coach/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Ffood-coach/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/watson-developer-cloud","download_url":"https://codeload.github.com/watson-developer-cloud/food-coach/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Ffood-coach/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28426192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:01:13.159Z","updated_at":"2026-01-14T16:42:24.774Z","avatar_url":"https://github.com/watson-developer-cloud.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Data \u0026 AI"],"sub_categories":[],"readme":"\u003ch1 align=\"center\" style=\"border-bottom: none;\"\u003e🚀 Food Coach Demo\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003eDEPRECATED: this repo is no longer actively maintained. It can still be used as reference, but may contain outdated or unpatched code.\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://travis-ci.org/watson-developer-cloud/food-coach\"\u003e\n    \u003cimg alt=\"Travis\" src=\"https://travis-ci.org/watson-developer-cloud/food-coach.svg?branch=master\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#badge\"\u003e\n    \u003cimg alt=\"semantic-release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003c/p\u003e\n\n![Demo GIF](readme_images/demo.gif?raw=true)\n\nFor more information on the Assistant service, see the [detailed documentation](https://console.bluemix.net/docs/services/conversation/index.html#about).\nFor more information on the Tone Analyzer Service, see the [detailed documentation](http://www.ibm.com/watson/developercloud/tone-analyzer.html).\n\n## Deploying the application\n\nIf you want to experiment with the application or use it as a basis for building your own application, you need to deploy it in your own environment. You can then explore the files, make changes, and see how those changes affect the running application. After making modifications, you can deploy your modified version of the application to IBM Cloud.\n\n## Prerequisites\n\n1. Sign up for an [IBM Cloud account](https://console.bluemix.net/registration/).\n1. Download the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview).\n1. Create an instance of the Watson Assistant service and get your credentials:\n    - Go to the [Watson Assistant](https://console.bluemix.net/catalog/services/conversation) page in the IBM Cloud Catalog.\n    - Log in to your IBM Cloud account.\n    - Click **Create**.\n    - Click **Show** to view the service credentials.\n    - Copy the `apikey` value, or copy the `username` and `password` values if your service instance doesn't provide an `apikey`.\n    - Copy the `url` value.\n1. Create an instance of the Tone Analyzer service and get your credentials:\n    - Go to the [Tone Analyzer](https://console.bluemix.net/catalog/services/tone-analyzer) page in the IBM Cloud Catalog.\n    - Log in to your IBM Cloud account.\n    - Click **Create**.\n    - Click **Show** to view the service credentials.\n    - Copy the `apikey` value, or copy the `username` and `password` values if your service instance doesn't provide an `apikey`.\n    - Copy the `url` value.\n\n## Configuring the application\n\n1. In your IBM Cloud console, open the Watson Assistant service instance\n\n2. Click the **Import workspace** icon in the Watson Assistant service tool. Specify the location of the workspace JSON file in your local copy of the app project:\n\n   `\u003cproject_root\u003e/food-coach/training/food-coach-workspace.json`\n\n3. Select **Everything (Intents, Entities, and Dialog)** and then click **Import**. The car dashboard workspace is created.\n\n4. Click the menu icon in the upper-right corner of the workspace tile, and then select **View details**.\n\n5. Click the ![Copy](readme_images/copy.png) icon to copy the workspace ID to the clipboard.\n\n    ![Steps to get credentials](https://github.com/watson-developer-cloud/assistant-simple/raw/master/readme_images/assistant-simple.gif)\n\n6. In the application folder, copy the *.env.example* file and create a file called *.env*\n\n    ```\n    cp .env.example .env\n    ```\n\n7. Open the *.env* file and add the service credentials that you obtained in the previous step.\n\n    Example *.env* file that configures the `apikey` and `url` for a Watson Assistant service instance hosted in the US East region:\n\n    ```\n    ASSISTANT_IAM_APIKEY=X4rbi8vwZmKpXfowaS3GAsA7vdy17Qh7km5D6EzKLHL2\n    ASSISTANT_URL=https://gateway-wdc.watsonplatform.net/assistant/api\n    ```\n\n    If your service instance uses `username` and `password` credentials, add the `ASSISTANT_USERNAME` and `ASSISTANT_PASSWORD` variables to the *.env* file.\n\n    Example *.env* file that configures the `username`, `password`, and `url` for a Watson Assistant service instance hosted in the US South region:\n\n    ```\n    ASSISTANT_USERNAME=522be-7b41-ab44-dec3-g1eab2ha73c6\n    ASSISTANT_PASSWORD=A4Z5BdGENrwu8\n    ASSISTANT_URL=https://gateway.watsonplatform.net/assistant/api\n    ```\n\n8. Add the `WORKSPACE_ID` to the previous properties\n\n    ```\n    WORKSPACE_ID=522be-7b41-ab44-dec3-g1eab2ha73c6\n    ```\n\n\n9. Your `.env` file  should looks like:\n\n    ```\n    # Environment variables\n    WORKSPACE_ID=1c464fa0-2b2f-4464-b2fb-af0ffebc3aab\n    ASSISTANT_IAM_APIKEY=_5iLGHasd86t9NddddrbJPOFDdxrixnOJYvAATKi1\n    ASSISTANT_URL=https://gateway-syd.watsonplatform.net/assistant/api\n\n    TONE_ANALYZER_IAM_APIKEY=UdHqOFLzoOCFD2M50AbsasdYhOnLV6sd_C3ua5zah\n    TONE_ANALYZER_URL=https://gateway-syd.watsonplatform.net/tone-analyzer/api\n    ```\n\n## Running locally\n\n1. Install the dependencies\n\n    ```\n    npm install\n    ```\n\n1. Run the application\n\n    ```\n    npm start\n    ```\n\n1. View the application in a browser at `localhost:3000`\n\n## Deploying to IBM Cloud as a Cloud Foundry Application\n\n1. Login to IBM Cloud with the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview)\n\n    ```\n    ibmcloud login\n    ```\n\n1. Target a Cloud Foundry organization and space.\n\n    ```\n    ibmcloud target --cf\n    ```\n\n1. Edit the *manifest.yml* file. Change the **name** field to something unique.  \n  For example, `- name: my-app-name`.\n1. Deploy the application\n\n    ```\n    ibmcloud app push\n    ```\n\n1. View the application online at the app URL.  \nFor example: https://my-app-name.mybluemix.net\n\n\n# What to do next\n\nAfter you have the application installed and running, experiment with it to see how it responds to your input.\n\n## Modifying the application\n\nAfter you have the application deployed and running, you can explore the source files and make changes. Try the following:\n\n   * Modify the .js files to change the application logic.\n\n   * Modify the .html file to change the appearance of the application page.\n\n   * Use the Assistant tool to train the service for new intents, or to modify the dialog flow. For more information, see the [Assistant service documentation](https://console.bluemix.net/docs/services/conversation/index.html#about).\n\n# What does the Food Coach application do?\n\nThe application interface is designed for chatting with a coaching bot. Based on the time of day, it asks you if you've had a particular meal (breakfast, lunch, or dinner) and what you ate for that meal.\n\nThe chat interface is in the left panel of the UI, and the JSON response object returned by the Assistant service in the right panel. Your input is run against a small set of sample data trained with the following intents:\n\n    yes: acknowledgment that the specified meal was eaten\n    no: the specified meal was not eaten\n    help\n    exit\n\nThe dialog is also trained on two types of entities:\n\n    food items\n    unhealthy food items\n\nThese intents and entities help the bot understand variations your input.\n\nAfter asking you what you ate (if a meal was consumed), the bot asks you how you feel about it. Depending on your emotional tone, the bot provides different feedback.\n\nBelow you can find some sample interactions:\n\n![Alt text](readme_images/examples.jpeg?raw=true)\n\nIn order to integrate the Tone Analyzer with the Assistant service, the following approach was taken:\n   * Intercept the user's message. Before sending it to the Assistant service, invoke the Tone Analyzer Service. See the call to `toneDetection.invokeToneAsync` in the `invokeToneConversation` function in [app.js](./app.js).\n   * Parse the JSON response object from the Tone Analyzer Service, and add appropriate variables to the context object of the JSON payload to be sent to the Assistant service. See the `updateUserTone` function in [tone_detection.js](./addons/tone_detection.js).\n   * Send the user input, along with the updated context object in the payload to the Assistant service. See the call to `assistant.message` in the `invokeToneConversation` function in [app.js](./app.js).\n\n\nYou can see the JSON response object from the Assistant service in the right hand panel.\n\n![Alt text](readme_images/tone_context.jpeg?raw=true)\n\nIn the conversation template, alternative bot responses were encoded based on the user's emotional tone. For example:\n\n![Alt text](readme_images/rule.png?raw=true)\n\n\n# License\n\n  This sample code is licensed under Apache 2.0.\n  Full license text is available in [LICENSE](LICENSE).\n\n# Contributing\n\n  See [CONTRIBUTING](CONTRIBUTING.md).\n\n## Open Source @ IBM\n\n  Find more open source projects on the\n  [IBM Github Page](http://ibm.github.io/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson-developer-cloud%2Ffood-coach","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwatson-developer-cloud%2Ffood-coach","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson-developer-cloud%2Ffood-coach/lists"}