chore(docs): Refactoring of .md.

This commit is contained in:
Rodrigo Rodriguez 2019-03-01 15:34:29 -03:00
parent 14045d9578
commit 770fbe1caf
20 changed files with 466 additions and 199 deletions

View file

@ -1,187 +0,0 @@
Package Quick Reference
------------
|Whatsapp|Web|Core|KB|
|----|-----|----|----|
|[whatsapp.gblib](https://github.com/pragmatismo-io/BotServer/tree/master/packages/whatsapp.gblib)|[default.gbui](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbui)|[core.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/core.gbapp)|[kb.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/kb.gbapp)|
### The bot development stack
![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-stack.png)
### The Bot Factory
![General Bots Block Architecture](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-block-architecture.png)
GeneralBots aims to delivery bots in azure in a very easy and fast fashion. Use Office tools like Word or Excel to edit your Bot - using code (JavaScript or TypeScript) just to empower custom requirements.
#### Use Excel for (Hierarchical) Knowledge Base Editing
![General Bots Inside Excel can enable bot production the masses](https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/general-bots-composing-subjects-json-and-excel.gif)
#### Use Visual Studio for a complete .gbai package building system
![General Bots Inside Visual Studio Code provides a complete artificial intelligence based conversational platform](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-inside-visual-studio-code-provides-a-complete-artificial-intelligence-based-conversational-platform.png)
How To
------
### Run the server locally
1. Install [Node.js](https://www.npmjs.com/get-npm) the current generation General Bot code execution platform;
2. Open a **Terminal** on Linux and Mac or a **Command Prompt** window on Windows;
3. Type `npm install -g botserver` and press *ENTER*;
4. Type `gbot` to run the server core.
Notes:
* [*nodejs.install* Chocolatey Package](https://chocolatey.org/packages/nodejs.install) is also available.
* The zip source code of General Bot is also available for [Download](https://codeload.github.com/pragmatismo-io/BotServer/zip/master);
### Configure the server to deploy specific directory
1. Create/Edit the .env file and add the ADDITIONAL_DEPLOY_PATH key pointing to the .gbai local parent folder of .gbapp, .gbot, .gbtheme, .gbkb package directories.
2. Specify STORAGE_SYNC to TRUE so database sync is run when the server is run.
3. In case of Microsoft SQL Server add the following keys: STORAGE_SERVER, STORAGE_NAME, STORAGE_USERNAME, STORAGE_PASSWORD, STORAGE_DIALECT to `mssql`.
Note:
* You can specify several bots separated by semicolon, the BotServer will serve all of them at once.
## Setup development environment (Windows)
1. [Optional] Install [Chocolatey](https://chocolatey.org/install), a Windows Package Manager;
2. Install [git](`https://git-scm.com/`), a Software Configuration Management (SCM).;
3. Install [Node.js](npmjs.com/get-npm), a [Runtime system](https://en.wikipedia.org/wiki/Runtime_system).
(https://www.npmjs.com/get-npm) (suggested: LTS 8.x.x);
4. Install [Visual Studio Code](https://chocolatey.org/packages/nodejs.install), Brackets or Atom as an editor of your choice;
5. [Fork](https://en.wikipedia.org/wiki/Fork_(software_development)) by visiting https://github.com/pragmatismo-io/BotServer/fork
6. Clone the just forked repository by running `git clone <your-forked-repository-url>/BotServer.git` ;
7. Run `npm install -g typescript`;
8. Run `npm install` on Command Prompt or PowerShell on the General Bot source-code folder;
9. Enter './packages/default.gbui' folder;
10. Run `npm install` folled by `npm run build` (To build default Bot UI);
11. Enter the On the downloaded folder (../..);
12. Compile the bot server by `tsc`.
13. Run the bot server by `npm start`.
Note:
* Whenever you are ready to turn your open-source bot ideas in form of .gbapp (source-code) and artifacts like .gbkb, .gbtheme, .gbot or the .gbai full package read [CONTRIBUTING.md](https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md) about performing Pull Requests (PR) and creating other public custom packages repositories of your own personal or organization General Bot Community Edition powered packages.
### Running unit tests
1. Enter the BotServer root folder.
2. Run tests by `npm test`.
### Just copy the source code to your machine
1. [Download] the Zip file of (https://codeload.github.com/pragmatismo-io/BotServer/zip/master)
### Updating the Bot Knoledge Base (.gbkb folder)
The subjects.json file contains all information related to the subject tree and can be used to build the menu carrousel as well give a set of words to be used as subject catcher in the conversation. A hierarchy can be specified.
### Creating a new Theme folder (.gbtheme folder)
A theme is composed of some CSS files and images. That set of files can change
everything in the General Bot UI. Use them extensively before going to change
the UI application itself (HTML & JS).
Package Types
-------------
### .gbai
Embraces all packages types (content, logic & conversation) into a pluggable bot
directory. [A sample .gbai is available](https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai).
### .gbapp
The artificial intelligence extensions in form of pluggable apps. Dialogs,
Services and all model related to data. A set of interactions, use cases,
integrations in form of conversationals dialogs.
The .gbapp adds the General Bot base library (botlib) for building Node.js TypeScript Apps packages.
Four components builds up a General Bot App:
* dialogs
* models
* services
* tests
#### Dialogs
All code contained in a dialog builds the flow to custom conversations in
built-in and additional packages .
#### Models
Models builds the foundation of data relationships in form of entities.
#### Services
Services are a façade for bot back-end logic and other custom processing.
#### Tests
Tests try to automate code execution validation before crashing in production.
### .gbot
An expression of an artificial inteligence entity. A .gbot file defines
all bots dependencies related to services and other resources.
### .gbtheme
A theme of a bot at a given time. CSS files & images that can compose all UI
presentation and using it a branding can be done. [A sample .gbtheme is available](https://github.com/pragmatismo-io/Office365.gbtheme)
### .gbkb
A set of subjects that bot knows in a form of hierarchical menu-based QnA. [A sample .gbkb is available](https://github.com/pragmatismo-io/ProjectOnline.gbkb).
### .gblib
Shared code that can be used across bot apps.
Reference
---------
### GeneralBots admin commands
General Bot can be controlled by the same chat window people talk to, so
here is a list of admin commands related to deploying .gb* files.
| Command | Description |
|-----------------|-----------------------------------------------------------------------------------------------------------------|
| deployPackage | Deploy a KB package. Usage **deployPackage** [package-name]. Then, you need to run rebuildIndex. |
| undeployPackage | Undeploy a KB. Usage **undeployPackage** [package-name]. |
| redeployPackage | Undeploy and then deploys the KB. Usage **redeployPackage** [package-name]. Then, you need to run rebuildIndex. |
| setupSecurity | Setup connection to user directories. |
Discontinued commands:
| Command | Description |Reason |
|-----------------| -----------------------------------------------------------------------------------------------------------------|------|
| rebuildIndex | Rebuild Azure Search indexes, must be run after **deployPackage** or **redeployPackage**. | Now it is called automatically |
### Credits & Inspiration
* Rodrigo Rodriguez (me@rodrigorodriguez.com) - Coding, Docs & Architecture
* David Lerner (david.lerner@hotmail.com) - UI, UX & Theming
* Eduardo Romeiro (eromeirosp@outlook.com) - Content & UX.
* Jorge Ramos (jramos@pobox.com) - Coding, Docs & Architecture
* PH Nascimento (ph.an@outlook.com) - Product Manager
Powered by Microsoft [BOT Framework](https://dev.botframework.com/) and [Azure](http://www.azure.com).
General Bot Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brasil, state of Piaui.
[Roberto Mangabeira Unger](http://www.robertounger.com/en/): "No one should have to do work that can be done by a machine".

View file

@ -1,12 +0,0 @@
General Bots BASIC reference
| Instruction | Description |
|--------------------------------|------------------------------------------------------------------|
| HEAR variable | Hears something from the person into a variable for later use. |
| TALK message | Talk the specified text to the person. |
| GENERATE A PASSWORD | Creates a new password into the variable password for later use. |
| CREATE A BOT FARM USING params | Deploys a new bot farm to the cloud. |
| WAIT seconds | Wait a number of seconds before continuing the conversation. |

15
book/acknowledgments.md Normal file
View file

@ -0,0 +1,15 @@
# Acknowledgments
### Credits & Inspiration
* Rodrigo Rodriguez (me@rodrigorodriguez.com) - Coding, Docs & Architecture
* David Lerner (david.lerner@hotmail.com) - UI, UX & Theming
* Eduardo Romeiro (eromeirosp@outlook.com) - Content & UX.
* Jorge Ramos (jramos@pobox.com) - Coding, Docs & Architecture
* PH Nascimento (ph.an@outlook.com) - Product Manager
Powered by Microsoft [BOT Framework](https://dev.botframework.com/) and [Azure](http://www.azure.com).
General Bot Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brasil, state of Piaui.
[Roberto Mangabeira Unger](http://www.robertounger.com/en/): "No one should have to do work that can be done by a machine".

62
book/chapter-01-Index.md Normal file
View file

@ -0,0 +1,62 @@
# General Bots Book
## Package Quick Reference
|Whatsapp|Web|Core|KB|
|----|-----|----|----|
|[whatsapp.gblib](https://github.com/pragmatismo-io/BotServer/tree/master/packages/whatsapp.gblib)|[default.gbui](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbui)|[core.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/core.gbapp)|[kb.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/kb.gbapp)|
### The bot development stack
![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-stack.png)
### The Bot Factory
![General Bots Block Architecture](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-block-architecture.png)
GeneralBots aims to delivery bots in azure in a very easy and fast fashion. Use Office tools like Word or Excel to edit your Bot - using code (JavaScript or TypeScript) just to empower custom requirements.
## How To
### Run the server locally
1. Install [Node.js](https://www.npmjs.com/get-npm) the current generation General Bot code execution platform;
2. Open a **Terminal** on Linux and Mac or a **Command Prompt** window on Windows;
3. Type `npm install -g botserver` and press *ENTER*;
4. Type `gbot` to run the server core.
Notes:
* [*nodejs.install* Chocolatey Package](https://chocolatey.org/packages/nodejs.install) is also available.
* The zip source code of General Bot is also available for [Download](https://codeload.github.com/pragmatismo-io/BotServer/zip/master);
### Running unit tests
1. Enter the BotServer root folder.
2. Run tests by `npm test`.
### Just copy the source code to your machine
1. [Download](https://codeload.github.com/pragmatismo-io/BotServer/zip/master) the Zip file.
## Trainning Topics
* Clone BotServer, BotLib repository
* Keyboard centric
* WIN: micro.exe
* Launcher
* dir/ls/ll, cd, mkdir, move
* Npm run build
* npm update -g
* node -v
* SHIFT+PAGE DOWN/UP on Terminal Window
* ncu -a Update all packages in package.json
* npm update -g All NPM package on the system
* Introduction to General Bo
* Environment setup and get the server runni
* KB loading
* NLP and toolin
* Find a NPM package to create a .gbapp that asks for data and output the result
* Visual Studio Code Insiders and plugins
* Run Build Task tsc:watch

View file

@ -0,0 +1,69 @@
# General Bots Packages Reference
## How To
### Configure the server to deploy specific directory
1. Create/Edit the .env file and add the ADDITIONAL_DEPLOY_PATH key pointing to the .gbai local parent folder of .gbapp, .gbot, .gbtheme, .gbkb package directories.
2. Specify STORAGE_SYNC to TRUE so database sync is run when the server is run.
3. In case of Microsoft SQL Server add the following keys: STORAGE_SERVER, STORAGE_NAME, STORAGE_USERNAME, STORAGE_PASSWORD, STORAGE_DIALECT to `mssql`.
Note:
- You can specify several bots separated by semicolon, the BotServer will serve all of them at once.
## Package Types
### .gbai
Embraces all packages types (content, logic & conversation) into a pluggable bot
directory. [A sample .gbai is available](https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai).
### .gbapp
The artificial intelligence extensions in form of pluggable apps. Dialogs,
Services and all model related to data. A set of interactions, use cases,
integrations in form of conversationals dialogs.
The .gbapp adds the General Bot base library (botlib) for building Node.js TypeScript Apps packages.
Four components builds up a General Bot App:
- dialogs
- models
- services
- tests
#### Dialogs
All code contained in a dialog builds the flow to custom conversations in
built-in and additional packages .
#### Models
Models builds the foundation of data relationships in form of entities.
#### Services
Services are a façade for bot back-end logic and other custom processing.
#### Tests
Tests try to automate code execution validation before crashing in production.
### .gbot
An expression of an artificial inteligence entity. A .gbot file defines
all bots dependencies related to services and other resources.
### .gbtheme
A theme of a bot at a given time. CSS files & images that can compose all UI
presentation and using it a branding can be done. [A sample .gbtheme is available](https://github.com/pragmatismo-io/Office365.gbtheme)
### .gbkb
A set of subjects that bot knows in a form of hierarchical menu-based QnA. [A sample .gbkb is available](https://github.com/pragmatismo-io/ProjectOnline.gbkb).
### .gblib
Shared code that can be used across bot apps.

View file

@ -0,0 +1,13 @@
# .gbkb Reference
## How To
### Updating the Bot Knoledge Base (.gbkb folder)
The subjects.json file contains all information related to the subject tree and can be used to build the menu carrousel as well give a set of words to be used as subject catcher in the conversation. A hierarchy can be specified.
### Use Excel for (Hierarchical) Knowledge Base Editing
![General Bots Inside Excel can enable bot production the masses](https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/general-bots-composing-subjects-json-and-excel.gif)

View file

@ -0,0 +1,9 @@
# .gbtheme Reference
## How To
### Creating a new Theme folder (.gbtheme folder)
A theme is composed of some CSS files and images. That set of files can change
everything in the General Bot UI. Use them extensively before going to change
the UI application itself (HTML & JS).

View file

@ -0,0 +1,37 @@
# .gbdialog Reference
## Using Conversational BASIC
## General Bots BASIC reference
| Instruction | Description |
|----------------------------------|-----------------------------------------------------------------------------|
| hear *variable* | Hears something from the person into a *variable* for later use. |
| talk *message* | Talk the specified *message* to the person. |
| generate a password | Creates a new password into the system variable **password** for later use. |
| create a bot farm using *params* | Deploys a new bot farm to the cloud. |
| wait *seconds* | Wait a number of seconds before continuing the conversation. |
## How To
### Generate a password for the person
```vb
talk "Let's generate a very dificult to guess password for the new bot:"
generate a password
talk "Your password is *" + password + "*. Keep it on a safe place only acessible to you."
```
### Get the list of cloud subscriptions
```vb
hear one of subscriptions with email, password into subscriptionId
talk "The subscription selected was: " + subscriptionId
```

View file

@ -0,0 +1,125 @@
# .gbapp Guide
## Introduction
.gbapp is the folder extension for the General Bots Application package type.
Anything inside a folder considered a .gbapp will be consumed by the server
like a TypeScript application. This conversational application will contain
the source code for custom dialogs and behaviour for any .gbot that associate
this deployed .gbapp.
## Preparing Environment
### Windows
1. [Optional] Install [Chocolatey](https://chocolatey.org/install), a Windows Package Manager;
2. Install [git](`https://git-scm.com/`), a Software Configuration Management (SCM).;
3. Install [Node.js](npmjs.com/get-npm), a [Runtime system](https://en.wikipedia.org/wiki/Runtime_system);
4. Install Visual Studio Code Insiders, Brackets or Atom as an editor of your choice;
5. Fork the repository by visiting https://github.com/pragmatismo-io/BotServer/fork;
6. Clone the just forked repository by running `git clone <your-forked-repository-url>/BotServer.git`;
7. Run `npm install -g typescript`;
8. Run the bot server by `gbot.cmd`.
* Recomended Chocolatey packages
```cmd
choco feature enable -n allowGlobalConfirmation
cinst git --confirm
cinst nodejs --confirm
npm install -g npm-check-updates
cinst 7zip.install --confirm
cinst tortoisegit --confirm
cinst winscp --confirm
cinst sysinternals --confirm
cinst putty --confirm
cinst pandoc --confirm
cinst curl --confirm
cinst micro --confirm
cinst ccleaner --confirm
cinst notepadplusplus --confirm
cinst sql-server-management-studio --confirm
```
![General Bots Inside Visual Studio Code provides a complete artificial intelligence based conversational platform](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-inside-visual-studio-code-provides-a-complete-artificial-intelligence-based-conversational-platform.png)
## Specifications
## Dialogs
The dialog is built by specifing series of methods, disposed as an array as seen
on Figure 1. Each dialog has also an identifier that can be called by several
engines like kb.gbapp, which handles cloud based search for documents and other
knowledge base information and also routes for the natural language processing
(NLP) engine.
```typescript
static getDialogs(bot: BotAdapter, min: GBMinInstance) {
return [{name:"/convertTemperature", waterfall: [
async step => {
},
async step => {
},
async step => {
}]
},{name:"/convertCurrency", waterfall: [
async step => {
},
async step => {
},
async step => {
}]
}
]
```
*Figure 1 - How to build dialogs in General Bots using TypeScript*
## How To...
### Debugging .gbapp deployed on Azure
1. Visit https://<SITENAME>.scm.azurewebsites.net/api/vfs/LogFiles/Application/index.html
## Tooling
### JavaScript
| Título | Endereço |
|--------|---------------------------------------------------------------------|
| | https://deeplearnjs.org/ |
| | Oimo.js http://lo-th.github.io/Oimo.js/\#stacking |
| | js-sequence-diagrams: https://bramp.github.io/js-sequence-diagrams/ |
| | http://blog.avenuecode.com/a-library-for-data-visualization-d3.js |
| Chrome inside Node.js | https://github.com/GoogleChrome/puppeteer|
| XLSX loader | https://github.com/mgcrea/node-xlsx |
| Node.js bindings for CNTK | https://github.com/nadavbar/node-cntk |
| API Repository | https://any-api.com/|
| ORM | http://docs.sequelizejs.com/manual/tutorial/associations.html
| Migração de .NET para JavaScript (Node.js) | https://www.reddit.com/r/webdev/comments/2val7s/as_a_net_developer_do_i_need_to_care_about_nodejs |
| Simplified JavaScript Jargon | http://jargon.js.org |
### Packages
| Título | Descrição | URL |
|--------|---------------------------------------------------------------------|-----------------|
| MSAL | Microsoft Authentication Library | https://www.npmjs.com/package/msal|
### Visual Studio Code Extensions
| Title | Description |
| ------|-------------|
| mbinic.tgit-cmds | Set of commands for launching TortoiseGit dialogs |
| tomashubelbauer.vscode-markdown-table-format | Formats MarkDown tables so that all columns have the same width |
| esbenp.prettier-vscode | VS Code plugin for prettier/prettier (wraps at column 80) |
| mikestead.dotenv | .env support |

View file

@ -0,0 +1,25 @@
# General Bots Administration
## Commands
General Bot can be controlled by the same chat window people talk to, so
here is a list of admin commands related to deploying .gb* files.
| Command | Description |
|-----------------|-----------------------------------------------------------------------------------------------------------------|
| deployPackage | Deploy a KB package. Usage **deployPackage** [package-name]. Then, you need to run rebuildIndex. |
| undeployPackage | Undeploy a KB. Usage **undeployPackage** [package-name]. |
| redeployPackage | Undeploy and then deploys the KB. Usage **redeployPackage** [package-name]. Then, you need to run rebuildIndex. |
| setupSecurity | Setup connection to user directories. |
Discontinued commands:
| Command | Description | Reason |
|--------------|-------------------------------------------------------------------------------------------|--------------------------------|
| rebuildIndex | Rebuild Azure Search indexes, must be run after **deployPackage** or **redeployPackage**. | Now it is called automatically |
## How to
### Move to production (Azure)
* Update bot endpoint;

View file

@ -0,0 +1,5 @@
## Quality Assurance
https://codecept.io/nightmare

View file

View file

@ -0,0 +1,10 @@
# Contributing to the General Bots open-core
## How To
### Make commit
See these guides:
* [1](https://seesparkbox.com/foundry/semantic_commit_messages)
* [2](http://karma-runner.github.io/0.10/dev/git-commit-msg.html)

22
book/copyright.md Normal file
View file

@ -0,0 +1,22 @@
#
{<} Published by %publisher%
{<} Copyright © %copyright-year% %copyright-owner%
{<} License & Warranty
General Bot Copyright (c) Pragmatismo.io. All rights reserved. Licensed under the AGPL-3.0.
According to our dual licensing model, this program can be used either under the terms of
the GNU Affero General Public License, version 3, or under a proprietary license.
The texts of the GNU Affero General Public License with an additional permission and of our proprietary license can be found at and in the LICENSE file you have received along with this program.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
"General Bots" is a registered trademark of Pragmatismo.io. The licensing of the program under the AGPLv3 does not imply a trademark license. Therefore any rights, title and interest in our trademarks remain entirely with us.
{<} www.pragmatismo.io

BIN
book/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

3
book/foreward.md Normal file
View file

@ -0,0 +1,3 @@
# Foreward

3
book/glossary.md Normal file
View file

@ -0,0 +1,3 @@
# Glossary

43
book/metadata.yaml Normal file
View file

@ -0,0 +1,43 @@
copyright:
owner: Pragmatismo.io
year: 2019
title: "General Bots Book"
subtitle: "Building virtual assistants"
publisher: Pragmatismo.io
# Whether or not to enable PlantUML. You must install PlantUML, and the
# "plantuml" command must be in your path, if you enable this feature.
#
# Default, if not specified: false
use_plantuml: false
# Whether PDF generation uses Weasy Print (true) or LaTeX (false). Defaults to
# false (LaTeX).
use_weasyprint: true
# Set to the language in which the book is written. This is especially
# useful when generating PDF with weasyprint, because it affects how
# hyphenation is handled. (When using weasyprint, automatic hyphenation is
# supported for any language that Pyphen supports.)
# Multiple authors are permitted.
author:
- Rodrigo Rodriguez
# Book identifier is optional.
#identifier:
# scheme: ISBN # or DOI
# text: 123456789X
# The language and variant in which the book is written.
language: en-US
# See https://wiki.mobileread.com/wiki/Genre
genre: reference
# Set this option if you need to change the paper size. Default is "letter".
# "A4" is also valid.
papersize: A4

3
book/preface.md Normal file
View file

@ -0,0 +1,3 @@
# Preface
Probably not necessary.

22
book/references.yaml Normal file
View file

@ -0,0 +1,22 @@
# Bibiographic references
references:
- type: book
id: GeneralBots
author:
- family: Rodriguez
given: Rodrigo
- family:
given:
issued:
date-parts:
- - 2019
- 3
- 1
title: 'General Bots Reference'
title-short: General Bots Reference
container-title: Nature
volume: 0
issue: 0
page: 300
URL: https://github.com/GeneralBots
language: en-US