Giter VIP home page Giter VIP logo

basicbot's Introduction

basic-bot

This bot has been created using Microsoft Bot Framework,

    • Use LUIS to implement core AI capabilities
  • Implement a multi-turn conversation using Dialogs
  • Handle user interruptions for such things as Help or Cancel
  • Prompt for and validate requests for information from the user

To try this sample

  • Clone the samples repository
git clone https://github.com/Microsoft/botbuilder-samples.git
  1. Install the Bot CLI Tools
npm install -g chatdown msbot ludown luis-apis qnamaker botdispatch luisgen
  1. Setup Azure Powershell (If you have never done so before)
    • To login, run:
Connect-AzureRmAccount
- To select your Azure subscription, run:
Select-AzureRmSubscription -Subscription "subscription-name"
  1. Collect your Luis Authoring Key from the the LUIS portal by selecting your name in the top right corner. Save this key for the next step.

  2. Run the following command from the project directory:

msbot clone services --name "<NAME>" --luisAuthoringKey "<YOUR AUTHORING KEY>" --folder "DeploymentScripts/MsbotClone" --location "westus" --verbose

NOTE: By default your Luis Applications will be deployed to your free starter endpoint. An Azure LUIS service will be deployed along with your bot but you must manually add and publish to it from the luis.ai portal and update your key in the .bot file.

  1. Note the generated secret generated by msbot.
  • The secret key is used later for appsettings.json.
The secret used to decrypt <NAME>.bot is:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
NOTE: This secret is not recoverable and you should store this secret in a secure place according to best security practices.
Your project may be configured to rely on this secret and you should update it as appropriate.
  1. Inspect Bot configuration file.
  • The msbot clone command above generates a bot configuration file.
  • The name of the bot configuration file is .bot, where is the name of your bot used in the msbot clone step.
  • The configuration file can be loaded by the Microsoft Bot Framework Emulator.
  1. Update in `Startup.cs'.
        public void ConfigureServices(IServiceCollection services)
        {
            ...

            var botConfig = BotConfiguration.Load(botFilePath ??  @".\<YOUR BOT CONFIGURATION>.bot"..);
            ...
  1. Update "YOUR_LUIS_SERVICE_NAME" in `BasicBot.cs'.
    public class BasicBot : IBot
   {
      ...
       public static readonly string LuisConfiguration = "YOUR_LUIS_SERVICE_NAME";
  1. Right click on the generated bot configuration file, click "Properties".
  • Ensure "Copy to Output Directory" is set to "Copy always".
  1. Update your appsettings.json with your .bot file path and .bot file secret.
  • Update the botFilePath with the name of your generated bot configuration file.
  • Update the botFileSecret with the secret that the msbot tool generated from step 5 above.
{
    "botFilePath": "<YOUR BOT CONFIG>.bot",
    "botFileSecret": "<YOUR BOT SECRET>"
}

[Alternate to CLI] Set up LUIS via Portal

  • Navigate to LUIS portal.
  • Click the Sign in button.
  • Click on the Choose File and select basic-bot.json from the botbuilder-samples/csharp_dotnetcore/13.basic-bot/CognitiveModels folder.
  • Update BotConfiguration.bot file with your AppId, SubscriptionKey, Region and Version. You can find this information under "Manage" tab for your LUIS application at LUIS portal.
    • The AppID can be found in "Application Information"
    • The SubscriptionKey can be found in "Keys and Endpoints", under the Key 1 column
    • The region can be found in "Keys and Endpoints", under the Region column
  • Update BotConfiguration.bot file with your Authoring Key.
    You can find this under your user settings at luis.ai. Click on your name in the upper right hand corner of the portal, and click on the "Settings" menu option. NOTE: Once you publish your app on LUIS portal for the first time, it takes some time for the endpoint to become available, about 5 minutes of wait should be sufficient.
  • Update BotConfiguration.bot file to ensure the Id property on the luis service type is set to basic-bot-LUIS.

Visual Studio

  • Navigate to the samples folder (botbuilder-samples/samples/csharp_dotnetcore/13.basic-bot) and open BasicBot.csproj in Visual Studio.
  • Run the project (press F5 key)

Visual Studio Code

  • Open botbuilder-samples/samples/csharp_dotnetcore/13.basic-bot sample folder.
  • Bring up a terminal, navigate to botbuilder-samples/samples/csharp_dotnetcore/13.basic-bot folder.
  • Type dotnet run.

Testing the bot using Bot Framework Emulator

Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the Bot Framework Emulator from here.

Connect to bot using Bot Framework Emulator

  • Launch the Bot Framework Emulator
  • File -> Open bot and navigate to botbuilder-samples/samples/csharp_dotnetcore/13.basic-bot folder
  • Select BotConfiguration.bot file

Deploy this bot to Azure

You can use the MSBot Bot Builder CLI tool to clone and configure any services this sample depends on. In order to install this and other tools, you can read Installing CLI Tools.

To clone this bot, run

msbot clone services -f deploymentScripts/msbotClone -n <BOT-NAME> -l <Azure-location> --subscriptionId <Azure-subscription-id>

Further reading

basicbot's People

Contributors

st2092 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.