PHP Laravel, MySQL and AIML chatbot engine and admin portal

Overview

Lemur Engine

The Lemur Engine is a PHP/MySQL/AIML Chatbot. Written using the Laravel Framework.

Demo

You can demo the bot at the website:

https://lemurengine.com

Quick Start

The Lemur Engine is written in Laravel so you can just bring her up as you would any Laravel project.

If you would prefer to use the included Vagrant method then follow the instructions below.

Prerequisites

You will need the following installed on your machine to run the Lemur Engine locally.

  • Virtual Box
  • Vagrant

Follow the steps below to set this up on your machine.

Step One
Copy .env.sample to .env and fill in the details.

The .env.sample file has already has the default vagrant DB settings.

You may need to change these to match your settings.

DB_CONNECTION=lemurengine
DB_HOST=127.0.0.1
DB_PORT=3306    
DB_DATABASE=testing
DB_USERNAME=root
DB_PASSWORD=secret
Step Two

Create an entry in your /etc/hosts file

192.168.10.10 lemurengine.local
Step Three

Start the server, login and go to the root directory

vagrant up
vagrant ssh
cd /vagrant
Step Four

Create the database - the login details below are the default vagrant mysql settings. In this example the database is called 'lemurengine'.

mysql -uroot -psecret
create database lemurengine;
Step Five

On the VM inside the /vagrant directory run composer to install the dependencies.

cd /vagrant
COMPOSER_MEMORY_LIMIT=-1 composer install
Step Six

On the VM inside the /vagrant directory and run the following commands to set up Laravel

cd /vagrant
php artisan key:generate
php artisan migrate:fresh --seed
php artisan storage:link

If you encounter a symlink() error when running the last command then exit the vm and try to run the same command from the project root in the host machine.

You should now be able to access Lemur Engine locally on http://lemurengine.local

Access

The default local url is http://lemurengine.local

You should be able to log in as an admin the following:

User: [email protected]
Password: password

Change this password either directly using tinker. Or using the forgotten email feature at the front of the site.

Full Documentation

Read the Lemur Docs here:

https://docs.lemurengine.com

Testing

To run the tests on the VM type

cd /vagrant
php artisan test --testsuite=All    

Development

If you would like to contribute to this project please read the guidelines set out in CONTRIBUTING.md

Comments
  • [BotBug] using accented letter give weird result

    [BotBug] using accented letter give weird result

    Describe the bug When user input has accented chars, these chars gets deleted. This generally seem to happen to every char that is converted to an entity.

    To Reproduce A simple template like the following You said:

    User Says: 'I say èff fìfo àge' Bot Responds With Error: 'You said: ff f fo ge '

    Expected behavior I expect to see the exact user input 'èff fìfo àge'

    Something more: I made a custom tag to display a html button and in this case the result is even weird. The accented letter is displayed, but a space is added before, so "perché" became "perch è". This happen only to the first entity. When I use the tag inside a <li></li> the buttton tag get divided at first entity Here follow a screenshot of same template outside and inside <li> immagine

    Template code is as follow

    <set name="interesse">acquisto</set>
            Prima di Acquistare devi vendere?
            <btn value="prima vendere si valutazione">Sì, vorrei una valùtazione gratuita</btn>
            <btn value="prima vendere si autonomia">Sì, ma lo farò in autoàomia</btn>
            <btn value="prima vendere no">No</btn>
    <condition name="interesse">
        <li value="acquisto">
            Prima di Acquistare devi vendere?
            <btn value="prima vendere si valutazione">Sì, vorrei una valùtazione gratuita</btn>
            <btn value="prima vendere si autonomia">Sì, ma lo farò in autoàomia</btn>
            <btn value="prima vendere no">No</btn>
        </li>
    </condition>
    

    I add also the custom tag. BtnTag.php.txt

    bug 
    opened by bobonov 4
  • [BotBug] category, problem saving accented letters

    [BotBug] category, problem saving accented letters

    Describe the bug When saving a Category, accented letter are removed from the following category fields topic, pattern, that due to the string normalization

    To Reproduce Save a category putting accented letters in these fields

    Expected behavior It should be possible to save accented letters (and non latin character) in these fields

    While saving accented letters in topic is not strictly necessary (the only case that came to my mind is to write the topic in your own language using non basic latin [a-z] character), it is mandatory to use them in pattern and that fields otherwise user input could not match

    Looking at the code in \app\Classes\LemurStr.php in function normalizeForCategoryTable() row 198 the following regex is responsible for the clean: preg_match_all("~<[^/|^>]+>(.*?)</[^>]+>|<[^/>]+/>|[a-z0-9\^\*#\$_]+~i",$str, $m);

    To have it working as required, the regex should be as follows preg_match_all("~<[^/|^>]+>(.*?)</[^>]+>|<[^/>]+/>|[\pL0-9\^\*#\$_]+~ui",$str, $m);

    instead of a-z there is \pL which matches any kind of letter from any language and add u at the end ~ui which enable unicode support

    In this way it should be able to handle any character from any language

    bug 
    opened by bobonov 2
  • [FeatureRequest]

    [FeatureRequest]

    Is your feature request related to a problem? Please describe. When saving categories you are redirected to the list, while in most cases would be better to stay in editing. When implementing a bot very often you save a "step" test it and then make correction

    Describe the solution you'd like Two different buttons, "save" that redirect you to the list "update and continue" that keep you on the category form

    enhancement 
    opened by bobonov 2
  • [BotBug] table field turns.input should be text

    [BotBug] table field turns.input should be text

    Describe the bug When a user writes a message longer than 256 we get an insert error. It is very unlike to receive in input a so long message, but it can happen that a user just to try (or for real need) write so much. changing turns.input from varchar to text "solve" (postpone to a longer text) the error and make it in line with turns.output field, which is text Maybe is also worth to truncate the string before saving it to db even if this means to partially loose the message

    To Reproduce Just write a long message

    User Says: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit Bot Responds With Error: QueryException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'input' at row 1 (SQL: insert into turns (conversation_id, parent_turn_id, input, status, source, slug, updated_at, created_at) .....

    Expected behavior No error and the message being saved and bot continue to process

    AIML Categories General error

    bug enhancement 
    opened by bobonov 2
  • php AIML interpreter framework independent

    php AIML interpreter framework independent

    Hi, I usually work with zend/laminas framework and I need to implement an AIML builder/interpreter in my application. Do exist a PHP AIML interpreter library independent by the framework?

    opened by domenico-renna 1
  • Pulling latest changes into master to get ready for a release

    Pulling latest changes into master to get ready for a release

    Statistic changes - previously stats and counts were including none-human turns from the turns table. This has been fixed now so it will only count human (actual turns)

    opened by elizaibeth 0
  • Merging develop into master for the next release

    Merging develop into master for the next release

    Slug fixes - Usability and fixes Category Form 'Save and Continue' Hard Delete Bots Restore Soft Deleted Bots Hard Delete Users Restore Soft Users Alter Input DB Field Consolidated And Improved Feedback Additional config for max_user_char_input and show_detailed_error_messages

    opened by elizaibeth 0
  • changes relating to the spelling plugin enabled, css changes to widge…

    changes relating to the spelling plugin enabled, css changes to widge…

    Added the ability to gitignore the custom tag files Added example custom tag files Fixed a bug with deleting the empty response when creating a response Typos in AIML Added a new spelling set and spellings

    opened by elizaibeth 0
  • [FeatureRequest] Add default values to the widget to allow the initial setting of a topic and a user input

    [FeatureRequest] Add default values to the widget to allow the initial setting of a topic and a user input

    Some botmasters want to be able to set an initial topic on bot load. This should be added as parameters to the front end widget and set using the bot/meta endpoint

    enhancement 
    opened by elizaibeth 0
Releases(v1.7.0)
  • v1.7.0(Jan 14, 2022)

    Summary

    UPGRADING If you are upgrading your system please pull the changes and do the following to install the new custom_docs table and update the sections table

    Run DB Migrations

    php artisan migrate

    ##General Changes

    Admin Page Bot Properties

    This release fixes a bug with the bot properties which meant that bot properties were not assigned a section on save

    Custom Documentation Area

    The ability to create and view custom documentation for the app

    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Dec 1, 2021)

    SUMMARY

    A number of changes to make the administration of the bots and it's linked data simpler. And the addition of a new "avatar" tag to allow the botmaster to specify facial expression that will be read by a Lemurtar bot.

    UPGRADING

    If you are upgrading your system please pull the changes and do the following

    1. Update the class paths...

    composer dump-autoload -o

    1. Run DB Migrations

    php artisan migrate

    1. Run DB Seeder for the new table

    php artisan db:seed --class=SectionTableSeeder

    CHANGELOG

    Admin Page Sections

    This release improves the bot knowledge and bot properties administration pages by creating a new table called sections. This will allow the user to assign sections to knowledge groups and properties so that they are grouped together on those admin pages.

    Allowed Sites Setting

    A setting to prevent access based upon the referring host. This does not replace the CORS update that happened a few releases back. But actually adds a layer on top of that to disallow access to a bot based upon the referring host. If left blank then only the CORS rule will be applied. The setting is on a bot by bot basis and can be accessed via a tab in the bot admin area.

    Critical File Setting

    To prevent unintended deselection of the critical AIML file you can now specify it on the main bot admin page. This was previously a setting in the .env file but now that has been removed and you can define the file here.

    Lemurtar facial express tag

    A new tag called Avatar has been created. This tag allows you to assign facial expressions to the avatars. You can read more about its usage here: https://docs.lemurengine.com/aiml.html#avatar You can download an example AIML file here: https://github.com/theramenrobotdiscocode/lemur-aiml/blob/master/aiml/TestAvatarActions.aiml

    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Oct 27, 2021)

    General bug fix release and added a few new features to make life a bit easier.

    • Added a feature to auto check the suggested set of AIML files in the bot admin area
    • Added a feature to prevent the unlinking of critical AIML files in the bot admin area
    • Added a feature to enabled CORS configuration from the .env file
    • Added an extra mime type to the category upload
    • Added better error messages when uploading files
    • Correct all the 'CVS' typo
    • Fixed a bug which was preventing the normalisation of accented letters
    • Fixed a bug which was preventing CSV from uploading when they had quotes and newlines in the fields
    • Fixed a bug that was prevent the chat window from displaying in the portal when the conversation returned blank
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Sep 10, 2021)

    • Statistic changes - previously stats and counts were including none-human turns from the turns table. This has been fixed now so it will only count human (actual turns)
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Aug 4, 2021)

    • Fixed the foreign chars not displaying correctly
    • Created and commented out a dummy author user for testing (see UserTableDataSeeder.php)
    • If user is an 'author' they can no longer see other users categories in the categories table - they can only see their categories and master categories
    • If user is an 'author' they can no longer see other users category groups in the category_groups table - they can only see their category groups and master categories
    • Removed the unique key for the name column on the category_groups table and created a new unique key for the name and the user_id instead
    • Added the author details to the bot > category page so that users can see who created the category group
    • Added a new color coding to make this super clear on the bot > category page
    • Added the ability to download conversations in a CVS format
    • Added the ability to view conversations in a plain text format
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jul 9, 2021)

    SUMMARY

    This release addressed a number of usability issues relating to restoring and hard deleting users and bots. UX changes to improve the updating of bot, client, conversation, language and user slugs. And quick buttons to allow users to return to a category they are updating. Update of the input size rules to allow larger messages from the user and config to limit this to a defined limit to ensure backward compatibility.

    UPGRADING

    If you are upgrading your system please pull the changes and do the following

    1. Run DB Migrations

    php artisan migrate

    1. Update Config And add the following config settings to your .env file

    SHOW_DETAILED_ADMIN_ERRORS=false MAX_USER_INPUT_CHARS=255

    CHANGELOG

    Slug fixes

    Removed the ability to update a slug for all models except from

    • Bots
    • Clients
    • Conversations
    • Languages
    • Users

    Updated the method (UI/backend) to edit slugs to simplify the whole experience

    Category Form

    Added an option to 'Save and Continue' to allow users to return to the category when they have saved it to continue editing

    Hard Delete Bots

    Allow the hard deletion of a bot and all its related entities First you must soft delete the bot then you will presented with an option to hard delete it in the datatable A new migration script has been created to alter the foreign key relationships to ON DELETE CASCADE for the bot related tables.

    Restore Soft Deleted Bots

    Allow the restoring of bots which have been soft deleted First you must soft delete the bot then you will presented with an option to restore it in the datatable

    Hard Delete Users

    Allow the hard deletion of a user. Hard deletion is prevented if they have related entities - you must hard delete the users bots first. First you must soft delete the user then you will presented with an option to hard delete it in the datatable

    Restore Soft Users

    Allow the restoring of users which have been soft deleted First you must soft delete the user then you will presented with an option to restore it in the datatable

    Alter Input DB Field

    The turns.input has been updated from a varchar(255) to a text field. And additional config has been added to the lemur.php config field. Set 'max_user_char_input' to set the allowed max client message length. A validation method has been written and a lengthException will be thrown if over this limit.

    Consolidated And Improved Feedback

    Consolidated the two form submit feedback message mechanisms into one single file And added ability to show extra details where available to admins when form submit operations fail Set 'show_detailed_error_messages' to true or false to show a more detailed message to admins. This should be used wisely as it might leak more information about your system than you would like. Messages are only displayed to ADMIN users and only if set to true.

    Additional Config

    Override default settings for max_user_char_input and show_detailed_error_messages in .env by setting SHOW_DETAILED_ADMIN_ERRORS MAX_USER_INPUT_CHARS

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(May 20, 2021)

  • 1.0.0(Apr 25, 2021)

    This release is dedicated to my friend and Program O dev - Dave Morton. We always wanted to rewrite Program O. It took a global pandemic for me to find the time to actually be able do it. I wish you were here to see this day - this one is for you mr!

    For the rest of the world this is the first release of the Lemur Engine. A new chatbot engine written in Laravel and using AIML. It's a fun non complicated bot with lots of power. Create chatbots, text based games and virtual assistants.

    Source code(tar.gz)
    Source code(zip)
Owner
The Ramen Robot Disco Code
The Ramen Robot Disco Code
Gestor de Contraseñas basado en Laravel 8 + PHP 8 + MySQL 8. Self-hosted Password Manager based on Laravel 8 + PHP 8 + MySQL 8.

English Gestor de Contraseñas Esta aplicación permite una gestión completa de contraseñas para múltiples tipos de servicios (web, ssh, teléfonos, wifi

Lito 134 Jan 2, 2023
LaraAdmin is a Open source Laravel Admin Panel / CMS which can be used as Admin Backend, Data Management Tool or CRM boilerplate for Laravel with features like Advanced CRUD Generation, Module Manager, Backups and many more.

LaraAdmin 1.0 LaraAdmin is a Open source CRM for quick-start Admin based applications with features like Advanced CRUD Generation, Schema Manager and

Dwij IT Solutions 1.5k Dec 29, 2022
Admin One is simple, beautiful and free Laravel admin dashboard (built with Vue.js, Bulma & Buefy).

Admin One — Free Laravel Vue Bulma Dashboard Admin One is simple, beautiful and free Laravel admin dashboard (built with Vue.js, Bulma & Buefy). Built

Viktor Kuzhelny 136 Dec 27, 2022
Admin Columns allows you to manage and organize columns in the posts, users, comments, and media lists tables in the WordPress admin panel.

Admin Columns allows you to manage and organize columns in the posts, users, comments, and media lists tables in the WordPress admin panel. Transform the WordPress admin screens into beautiful, clear overviews.

Codepress 67 Dec 14, 2022
Until 2018, Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE. Backpack v4 no longer uses this package, they're now built-in - use Backpack/CRUD instead.

Note: This package is only used by Backpack v3. Starting with Backpack v4, everything this package does is included in Backpack/CRUD - one package to

Backpack for Laravel 845 Nov 29, 2022
Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE

Until 2018, Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE. Backpack v4 no longer uses this package, they're now built-in - use Backpack/CRUD instead.

Backpack for Laravel 845 Nov 29, 2022
Littlelink admin is an admin panel for littlelink that provides you a website similar linktree.

⚙️ LittleLink Admin LittleLink Admin is an admin panel for littlelink that provides you a website similar linktree. ?? Features creating a link page w

Khashayar Zavosh 70 Oct 29, 2022
Littlelink admin is an admin panel for littlelink that provides you a website similar linktree.

LittleLink Admin is an admin panel for littlelink that provides you a website similar linktree.

Khashayar Zavosh 70 Oct 29, 2022
PHP template engine that uses data-attributes and keeps HTML templates valid and clean

Dataplater PHP template engine that uses data-attributes and keeps HTML templates valid and clean. Scroll down to see a usage example. Install compose

Leon 7 Oct 23, 2022
A Laravel Admin Panel (Laravel Version : 6.0)

Laravel Admin Panel (Current: Laravel 7.*) Introduction Laravel Admin Panel provides you with a massive head start on any size web application. It com

ftxinfotech 903 Dec 31, 2022
Laravel Vue SPA, Bulma themed. For demo login use `[email protected]` & `password` -

Laravel Enso Hit the ground running when building your new Laravel SPA project with boilerplate and extra functionality out of the box! click on the p

Laravel Enso 1k Jan 3, 2023
Laravel Vue SPA, Bulma themed. For demo login use `[email protected]` & `password` -

Laravel Enso Hit the ground running when building your new Laravel SPA project with boilerplate and extra functionality out of the box! click on the p

Laravel Enso 1k Jan 3, 2023
🔥 基于 Laravel 的后台系统构建工具 (Laravel Admin),使用很少的代码快速构建一个功能完善的高颜值后台系统,内置丰富的后台常用组件,开箱即用,让开发者告别冗杂的HTML代码

Dcat Admin是一个基于laravel-admin二次开发而成的后台系统构建工具,只需很少的代码即可快速构建出一个功能完善的高颜值后台系统。内置丰富的后台常用组件,开箱即用,让开发者告别冗杂的HTML代码,对后端开发者非常友好。 官方网站 中文文档 English documentions D

Jiang Qinghua 3.3k Dec 22, 2022
A @laravel based RAD platform for back-office applications, admin/user panels, and dashboards.

For the full documentation, visit orchid.software. Introduction Orchid is a free Laravel package that abstracts standard business logic and allows cod

Laravel Orchid 3.4k Jan 1, 2023
EasyPanel is a beautiful, customizable and flexible admin panel based on Livewire for Laravel.

EasyPanel EasyPanel is a beautiful, customizable and flexible admin panel based on Livewire for Laravel. Features : Easy to install Multi Language RTL

Reza Amini 529 Dec 29, 2022
This is a laravel Auth Starter Kit, with full user/admin authentication with both session and token auth

About Auth Starter It's a Laravel 8 authentication markdown that will help you to understand and grasp all the underlying functionality for Session an

Sami Alateya 10 Aug 3, 2022
Voyager - The Missing Laravel Admin

Voyager - The Missing Laravel Admin Made with ❤️ by The Control Group Website & Documentation: https://voyager.devdojo.com/ Video Tutorial Here: https

The Control Group 11.3k Jan 2, 2023
A Laravel admin panel which is creating CRUD for your application automatically.

Adds a zero configuration Admin Panel to your Laravel Application Installation You can install the package via composer: composer require max-hutschen

42coders 10 Aug 24, 2022
Laravel Admin Panel

Laravel Admin Panel An admin panel for managing users, roles, permissions & crud. Requirements Laravel >=5.5 PHP >= 7.0 Features User, Role & Permiss

AppzCoder 668 Dec 18, 2022