Table of Contents
This is highly scalable TalkBot that allows user to input questions or commands and bot returns back
command result.
Scalable part is because it uses plugins to add functionality to it and command execution is
interfaced with async commands, so it does not matter if command logic happens in only client
side or command needs to execute functions with remote API
This is an example of how to list things you need to use the software and how to install them.
Note: php.ini has to have extension=fileinfo enabled for project to work.
- install composer using php
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
- download and install npm from: https://nodejs.org/en/download/
- Clone the repo
git clone https://github.com/kapstahillar/TalkBot.git
- Change directory to TalkBot
cd ./TalkBot
- Install composer packages
composer install
- Install npm packages
npm install
- Run webmix
npm run watch
- Rename file .env.example to .env
- Generate new application key
php artisan key:generate
- Run development server
php artisan serve
- Open up brower and open localhost:8000
Add Talkbot to your frontend with tag:
<TalkBot/>
Usage in example:
This bot should talk, but it doesn't do it currently. This bot only know's 2 commands /calculate and /convert
/calculate
calculate takes in 1 parameters in format <number><+-*/><number> and returns result of calculation
Example:
/calculate 1*2
/calculate 4.23+1.3
/convert
calculate takes in 3 parameters. First parameters have to be <number> and other 2 two are currency tag strings like EUR or USD
Example:
/convert 23141 EUR USD
/convert 300 AUD USD
Convert request might fail on localhost because of SSL Certificate. Below is a guide how to fix this
- Go to https://curl.se/docs/caextract.html and download cacert.pem
- Put is somewhere where php can access it. I used C://xampp in my windows build
- Add those two lines to you php.ini file (Do know what PHP you are using use: php --ini)
curl.cainfo = <path_to_cert>\cacert.pem
openssl.cafile= <path_to_cert>\cacert.pem
Distributed under the MIT License. See LICENSE.txt
for more information.
Hillar Kapsta - [email protected] LinkedIn: https://www.linkedin.com/in/hillar-kapsta-908614a6/ Project Link: https://github.com/kapstahillar/TalkBot