├── .gitignore ├── README.md ├── chatsite ├── __init__.py ├── settings.py ├── urls.py ├── views.py └── wsgi.py ├── manage.py ├── rasachat ├── actions.py ├── bot.py ├── domain.yml ├── models │ ├── current │ │ └── nlu │ │ │ ├── checkpoint │ │ │ ├── intent_classifier_tensorflow_embedding.ckpt.data-00000-of-00001 │ │ │ ├── intent_classifier_tensorflow_embedding.ckpt.index │ │ │ ├── intent_classifier_tensorflow_embedding.ckpt.meta │ │ │ ├── intent_classifier_tensorflow_embedding_encoded_all_intents.pkl │ │ │ ├── intent_classifier_tensorflow_embedding_inv_intent_dict.pkl │ │ │ ├── intent_featurizer_count_vectors.pkl │ │ │ ├── metadata.json │ │ │ └── training_data.json │ └── dialogue │ │ ├── domain.json │ │ ├── domain.yml │ │ ├── policy_0_KerasPolicy │ │ ├── featurizer.json │ │ ├── keras_model.h5 │ │ └── keras_policy.json │ │ ├── policy_1_FallbackPolicy │ │ └── fallback_policy.json │ │ ├── policy_2_MemoizationPolicy │ │ ├── featurizer.json │ │ └── memorized_turns.json │ │ ├── policy_3_FormPolicy │ │ ├── featurizer.json │ │ └── memorized_turns.json │ │ └── policy_metadata.json ├── nlu.md ├── nlu_config.yml └── stories.md ├── requirements.txt ├── static └── js │ └── script.js └── templates └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Chatbot Models are up to date with the current versions of rasa core & nlu 2 | 3 | # Usage 4 | **Replace the rasachat/models folder with your models folder and run django server and bot.py file seperately** 5 | 6 | **The data used to train the chatbot is very minimal, you should replace the rasachat/models folder or extend and improve the training data by updating `rasachat/nlu.nd` & `rasachat/stories.md` files.** 7 | 8 | Also refer to [Django-Rasa-Sockets](https://github.com/Alexmhack/Django-Rasa-Sockets) for more info on implementing Django and Rasa with Sockets. 9 | 10 | # Django-Rasa-Bot 11 | Integrating Rasa Core with Django backend and finally using Webchat for chatbot user interface 12 | 13 | In this project we will be using [rasa_core](https://rasa.com/docs/core/quickstart/) 14 | for our chatbot backend **django** for website backend and [rasa-webchat](https://github.com/mrbot-ai/rasa-webchat) for chatbot **User Interface** 15 | 16 | We have to first create a Rasa SocketIO Channel Layer 17 | 18 | Create a separate file for this layer in rasachat folder **bot.py** 19 | ``` 20 | from rasa_core.agent import Agent 21 | from rasa_core.channels.socketio import SocketIOInput 22 | from rasa_core.agent import Agent 23 | 24 | # load your trained agent 25 | agent = Agent.load('models/dialogue', interpreter='models/current/nlu') 26 | 27 | input_channel = SocketIOInput( 28 | # event name for messages sent from the user 29 | user_message_evt="user_uttered", 30 | # event name for messages sent from the bot 31 | bot_message_evt="bot_uttered", 32 | # socket.io namespace to use for the messages 33 | namespace=None 34 | ) 35 | 36 | # set serve_forever=False if you want to keep the server running 37 | s = agent.handle_channels([input_channel], 5500, serve_forever=True) 38 | ``` 39 | 40 | Above piece of code comes from Rasa [docs](https://www.rasa.com/docs/core/connectors/#id18) 41 | 42 | Then in your html template configure rasa-webchat with following code 43 | 44 | ``` 45 | 46 |
47 | 48 | 62 |
63 | 64 | ``` 65 | 66 | The ```socketUrl``` is the url endpoint that we configured with **rasa socketio layer** and the ```profileAvatar``` is the image that is displayed in bot message 67 | 68 | Now run the django server and the socketio server seperately using two terminals, 69 | 70 | ``` 71 | ../Django-Rasa-Bot> python manage.py runserver 72 | # then in another command prompt or terminal run 73 | ../Django-Rasa-Bot/rasachat> python bot.py 74 | ``` 75 | 76 | Now open the url [127.0.0.1:8000](http://127.0.0.1:8000) and click on the chat widget placed in bottom right and 77 | enter ```hi there``` and the bot will reply. 78 | -------------------------------------------------------------------------------- /chatsite/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/chatsite/__init__.py -------------------------------------------------------------------------------- /chatsite/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for chatsite project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.1. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.1/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | from decouple import config 16 | 17 | # from rasa_core.agent import Agent 18 | # from rasa_core.channels.socketio import SocketIOInput 19 | # from rasa_core.agent import Agent 20 | 21 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 22 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 23 | 24 | 25 | # Quick-start development settings - unsuitable for production 26 | # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ 27 | 28 | # SECURITY WARNING: keep the secret key used in production secret! 29 | SECRET_KEY = config("PROJECT_KEY") 30 | 31 | # SECURITY WARNING: don't run with debug turned on in production! 32 | DEBUG = True 33 | 34 | ALLOWED_HOSTS = [] 35 | 36 | 37 | # Application definition 38 | 39 | INSTALLED_APPS = [ 40 | 'django.contrib.admin', 41 | 'django.contrib.auth', 42 | 'django.contrib.contenttypes', 43 | 'django.contrib.sessions', 44 | 'django.contrib.messages', 45 | 'django.contrib.staticfiles', 46 | 47 | # django-cors-headers 48 | 'corsheaders', 49 | ] 50 | 51 | MIDDLEWARE = [ 52 | 'django.middleware.security.SecurityMiddleware', 53 | 'django.contrib.sessions.middleware.SessionMiddleware', 54 | 55 | # middleware for corsheaders 56 | 'corsheaders.middleware.CorsMiddleware', 57 | 58 | 'django.middleware.common.CommonMiddleware', 59 | 'django.middleware.csrf.CsrfViewMiddleware', 60 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 61 | 'django.contrib.messages.middleware.MessageMiddleware', 62 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 63 | ] 64 | 65 | ROOT_URLCONF = 'chatsite.urls' 66 | 67 | TEMPLATES = [ 68 | { 69 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 70 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 71 | 'APP_DIRS': True, 72 | 'OPTIONS': { 73 | 'context_processors': [ 74 | 'django.template.context_processors.debug', 75 | 'django.template.context_processors.request', 76 | 'django.contrib.auth.context_processors.auth', 77 | 'django.contrib.messages.context_processors.messages', 78 | ], 79 | }, 80 | }, 81 | ] 82 | 83 | WSGI_APPLICATION = 'chatsite.wsgi.application' 84 | 85 | 86 | # Database 87 | # https://docs.djangoproject.com/en/2.1/ref/settings/#databases 88 | 89 | DATABASES = { 90 | 'default': { 91 | 'ENGINE': 'django.db.backends.sqlite3', 92 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 93 | } 94 | } 95 | 96 | 97 | # Password validation 98 | # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators 99 | 100 | AUTH_PASSWORD_VALIDATORS = [ 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 103 | }, 104 | { 105 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 106 | }, 107 | { 108 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 109 | }, 110 | { 111 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 112 | }, 113 | ] 114 | 115 | 116 | # Internationalization 117 | # https://docs.djangoproject.com/en/2.1/topics/i18n/ 118 | 119 | LANGUAGE_CODE = 'en-us' 120 | 121 | TIME_ZONE = 'Asia/Kolkata' 122 | 123 | USE_I18N = True 124 | 125 | USE_L10N = True 126 | 127 | USE_TZ = False 128 | 129 | 130 | # Static files (CSS, JavaScript, Images) 131 | # https://docs.djangoproject.com/en/2.1/howto/static-files/ 132 | 133 | STATIC_URL = '/static/' 134 | 135 | STATICFILES_DIRS = [ 136 | os.path.join(BASE_DIR, 'static') 137 | ] 138 | 139 | 140 | # allow cors headers 141 | CORS_ORIGIN_ALLOW_ALL = True 142 | 143 | 144 | # path for rasa_core models and dialogue 145 | RASA_CORE_MODELS = os.path.join(BASE_DIR, 'rasachat', 'models', 'dialogue') 146 | 147 | RASA_CORE_NLU = os.path.join(BASE_DIR, 'rasachat', 'models', 'current', 'nlu') 148 | 149 | # RASA SOCKET CHANNEL 150 | 151 | # load your trained agent 152 | # agent = Agent.load(RASA_CORE_MODELS, interpreter=RASA_CORE_NLU) 153 | 154 | # input_channel = SocketIOInput( 155 | # # event name for messages sent from the user 156 | # user_message_evt="user_uttered", 157 | # # event name for messages sent from the bot 158 | # bot_message_evt="bot_uttered", 159 | # # socket.io namespace to use for the messages 160 | # namespace=None 161 | # ) 162 | 163 | # # set serve_forever=False if you want to keep the server running 164 | # s = agent.handle_channels([input_channel], 5500, serve_forever=True) 165 | -------------------------------------------------------------------------------- /chatsite/urls.py: -------------------------------------------------------------------------------- 1 | """chatsite URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from .views import home_view, webhook # handle_response 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | ] 24 | 25 | urlpatterns += [ 26 | path('', home_view, name='home'), 27 | path('webhook', webhook, name='webhook'), 28 | # path('chat/', handle_response, name='chat') 29 | ] 30 | -------------------------------------------------------------------------------- /chatsite/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.http import JsonResponse 3 | from django.views.decorators.csrf import csrf_exempt 4 | 5 | # from .bot import agent 6 | 7 | def home_view(request): 8 | return render(request, 'index.html') 9 | 10 | 11 | @csrf_exempt 12 | def webhook(request): 13 | print(request.POST) 14 | return JsonResponse({"status": "OK"}) 15 | 16 | 17 | # # @csrf_exempt 18 | # def handle_response(request, *args, **kwargs): 19 | # if request.method == "POST": 20 | # try: 21 | # print(request) 22 | # print(request.POST.get('user_input')) 23 | # message = request.POST.get('user_input') 24 | # responses = agent.handle_message(message) 25 | # print(responses) 26 | # bot_data = { 27 | # 'status': 'OK', 28 | # 'responses': responses[0]['text'] 29 | # } 30 | # return JsonResponse(bot_data) 31 | # except Exception as e: 32 | # return JsonResponse({'status': 'FAILED'}) 33 | -------------------------------------------------------------------------------- /chatsite/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for chatsite project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chatsite.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chatsite.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /rasachat/actions.py: -------------------------------------------------------------------------------- 1 | from rasa_core_sdk import Action 2 | from rasa_core_sdk.events import SlotSet 3 | 4 | # need to install rasa_core_sdk for using these actions 5 | 6 | class ActionSendEmail(Action): 7 | def name(self): 8 | return "action_send_email" 9 | # add this to the actions in domain.yml file 10 | # this is the name of your custom action 11 | 12 | def run(self, dispatcher, tracker, domain): 13 | # trackers gives us the stored email_id slot done by intents 14 | # change the slot name as per your requirements and get it using the below code. 15 | email_id = tracker.get_slot('email_id') 16 | # this message will be sent to the UI. 17 | return f"Confirmation email is sent to {email_id}" 18 | -------------------------------------------------------------------------------- /rasachat/bot.py: -------------------------------------------------------------------------------- 1 | from rasa_core.agent import Agent 2 | from rasa_core.channels.socketio import SocketIOInput 3 | from rasa_core.agent import Agent 4 | 5 | # load your trained agent 6 | agent = Agent.load('models/dialogue', interpreter='models/current/nlu') 7 | 8 | input_channel = SocketIOInput( 9 | # event name for messages sent from the user 10 | user_message_evt="user_uttered", 11 | # event name for messages sent from the bot 12 | bot_message_evt="bot_uttered", 13 | # socket.io namespace to use for the messages 14 | namespace=None 15 | ) 16 | 17 | # set serve_forever=False if you want to keep the server running 18 | s = agent.handle_channels([input_channel], 5500, serve_forever=True) 19 | -------------------------------------------------------------------------------- /rasachat/domain.yml: -------------------------------------------------------------------------------- 1 | intents: 2 | - greet 3 | - goodbye 4 | - mood_unhappy 5 | - mood_affirm 6 | - mood_deny 7 | - mood_great 8 | 9 | actions: 10 | - utter_greet 11 | - utter_happy 12 | - utter_cheer_up 13 | - utter_did_that_help 14 | - utter_goodbye 15 | - action_send_email # added custom action name 16 | 17 | templates: 18 | utter_greet: 19 | - text: "Hey! How are you ?" 20 | 21 | utter_happy: 22 | - text: "Great! Carry on..." 23 | 24 | utter_cheer_up: 25 | - text: "Here is something to cheer you up!" 26 | image: "https://i.imgur.com/nGF1K8f.jpg" 27 | 28 | utter_did_that_help: 29 | - text: "Did that help you ?" 30 | 31 | utter_goodbye: 32 | - text: "Bye" 33 | -------------------------------------------------------------------------------- /rasachat/models/current/nlu/checkpoint: -------------------------------------------------------------------------------- 1 | model_checkpoint_path: "F:\\coder\\Django-Rasa-Bot\\rasachat\\models\\current\\nlu\\intent_classifier_tensorflow_embedding.ckpt" 2 | all_model_checkpoint_paths: "F:\\coder\\Django-Rasa-Bot\\rasachat\\models\\current\\nlu\\intent_classifier_tensorflow_embedding.ckpt" 3 | -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.data-00000-of-00001 -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.index -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.meta -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_encoded_all_intents.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_encoded_all_intents.pkl -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_inv_intent_dict.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_inv_intent_dict.pkl -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_featurizer_count_vectors.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/rasachat/models/current/nlu/intent_featurizer_count_vectors.pkl -------------------------------------------------------------------------------- /rasachat/models/current/nlu/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "en", 3 | "pipeline": [ 4 | { 5 | "name": "tokenizer_whitespace", 6 | "class": "rasa_nlu.tokenizers.whitespace_tokenizer.WhitespaceTokenizer" 7 | }, 8 | { 9 | "BILOU_flag": true, 10 | "features": [ 11 | [ 12 | "low", 13 | "title", 14 | "upper" 15 | ], 16 | [ 17 | "bias", 18 | "low", 19 | "prefix5", 20 | "prefix2", 21 | "suffix5", 22 | "suffix3", 23 | "suffix2", 24 | "upper", 25 | "title", 26 | "digit", 27 | "pattern" 28 | ], 29 | [ 30 | "low", 31 | "title", 32 | "upper" 33 | ] 34 | ], 35 | "max_iterations": 50, 36 | "L1_c": 0.1, 37 | "L2_c": 0.1, 38 | "name": "ner_crf", 39 | "classifier_file": "crf_model.pkl", 40 | "class": "rasa_nlu.extractors.crf_entity_extractor.CRFEntityExtractor" 41 | }, 42 | { 43 | "name": "ner_synonyms", 44 | "synonyms_file": null, 45 | "class": "rasa_nlu.extractors.entity_synonyms.EntitySynonymMapper" 46 | }, 47 | { 48 | "analyzer": "word", 49 | "token_pattern": "(?u)\\b\\w\\w+\\b", 50 | "strip_accents": null, 51 | "stop_words": null, 52 | "min_df": 1, 53 | "max_df": 1.0, 54 | "min_ngram": 1, 55 | "max_ngram": 1, 56 | "max_features": null, 57 | "lowercase": true, 58 | "OOV_token": null, 59 | "OOV_words": [], 60 | "name": "intent_featurizer_count_vectors", 61 | "featurizer_file": "intent_featurizer_count_vectors.pkl", 62 | "class": "rasa_nlu.featurizers.count_vectors_featurizer.CountVectorsFeaturizer" 63 | }, 64 | { 65 | "hidden_layers_sizes_a": [ 66 | 256, 67 | 128 68 | ], 69 | "hidden_layers_sizes_b": [], 70 | "batch_size": [ 71 | 64, 72 | 256 73 | ], 74 | "epochs": 300, 75 | "embed_dim": 20, 76 | "mu_pos": 0.8, 77 | "mu_neg": -0.4, 78 | "similarity_type": "cosine", 79 | "num_neg": 20, 80 | "use_max_sim_neg": true, 81 | "random_seed": null, 82 | "C2": 0.002, 83 | "C_emb": 0.8, 84 | "droprate": 0.2, 85 | "intent_tokenization_flag": false, 86 | "intent_split_symbol": "_", 87 | "evaluate_every_num_epochs": 10, 88 | "evaluate_on_num_examples": 1000, 89 | "name": "intent_classifier_tensorflow_embedding", 90 | "classifier_file": "intent_classifier_tensorflow_embedding.ckpt", 91 | "class": "rasa_nlu.classifiers.embedding_intent_classifier.EmbeddingIntentClassifier" 92 | } 93 | ], 94 | "training_data": "training_data.json", 95 | "trained_at": "20190418-233839", 96 | "rasa_nlu_version": "0.14.6" 97 | } -------------------------------------------------------------------------------- /rasachat/models/current/nlu/training_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "rasa_nlu_data": { 3 | "common_examples": [ 4 | { 5 | "intent": "greet", 6 | "text": "hey" 7 | }, 8 | { 9 | "intent": "greet", 10 | "text": "hello" 11 | }, 12 | { 13 | "intent": "greet", 14 | "text": "hey there" 15 | }, 16 | { 17 | "intent": "greet", 18 | "text": "hi" 19 | }, 20 | { 21 | "intent": "greet", 22 | "text": "good morning" 23 | }, 24 | { 25 | "intent": "greet", 26 | "text": "good evening" 27 | }, 28 | { 29 | "intent": "greet", 30 | "text": "good afternoon" 31 | }, 32 | { 33 | "intent": "goodbye", 34 | "text": "bye" 35 | }, 36 | { 37 | "intent": "goodbye", 38 | "text": "seeya" 39 | }, 40 | { 41 | "intent": "goodbye", 42 | "text": "see ya" 43 | }, 44 | { 45 | "intent": "goodbye", 46 | "text": "goodbye" 47 | }, 48 | { 49 | "intent": "goodbye", 50 | "text": "see you later" 51 | }, 52 | { 53 | "intent": "goodbye", 54 | "text": "see you around" 55 | }, 56 | { 57 | "intent": "mood_affirm", 58 | "text": "yes" 59 | }, 60 | { 61 | "intent": "mood_affirm", 62 | "text": "indeed" 63 | }, 64 | { 65 | "intent": "mood_affirm", 66 | "text": "of course" 67 | }, 68 | { 69 | "intent": "mood_affirm", 70 | "text": "obviously" 71 | }, 72 | { 73 | "intent": "mood_affirm", 74 | "text": "that sounds good" 75 | }, 76 | { 77 | "intent": "mood_affirm", 78 | "text": "correct" 79 | }, 80 | { 81 | "intent": "mood_affirm", 82 | "text": "alright" 83 | }, 84 | { 85 | "intent": "mood_affirm", 86 | "text": "alright then" 87 | }, 88 | { 89 | "intent": "mood_affirm", 90 | "text": "sure" 91 | }, 92 | { 93 | "intent": "mood_affirm", 94 | "text": "that's nice" 95 | }, 96 | { 97 | "intent": "mood_affirm", 98 | "text": "awesome" 99 | }, 100 | { 101 | "intent": "mood_affirm", 102 | "text": "yeah" 103 | }, 104 | { 105 | "intent": "mood_affirm", 106 | "text": "yippy" 107 | }, 108 | { 109 | "intent": "mood_deny", 110 | "text": "no" 111 | }, 112 | { 113 | "intent": "mood_deny", 114 | "text": "never" 115 | }, 116 | { 117 | "intent": "mood_deny", 118 | "text": "nahhh" 119 | }, 120 | { 121 | "intent": "mood_deny", 122 | "text": "I don't think so" 123 | }, 124 | { 125 | "intent": "mood_deny", 126 | "text": "don't like that" 127 | }, 128 | { 129 | "intent": "mood_deny", 130 | "text": "no way" 131 | }, 132 | { 133 | "intent": "mood_deny", 134 | "text": "not really" 135 | }, 136 | { 137 | "intent": "mood_deny", 138 | "text": "not sure" 139 | }, 140 | { 141 | "intent": "mood_deny", 142 | "text": "nope" 143 | }, 144 | { 145 | "intent": "mood_deny", 146 | "text": "definitely not" 147 | }, 148 | { 149 | "intent": "mood_deny", 150 | "text": "wrong" 151 | }, 152 | { 153 | "intent": "mood_great", 154 | "text": "perfect" 155 | }, 156 | { 157 | "intent": "mood_great", 158 | "text": "good" 159 | }, 160 | { 161 | "intent": "mood_great", 162 | "text": "very good" 163 | }, 164 | { 165 | "intent": "mood_great", 166 | "text": "great" 167 | }, 168 | { 169 | "intent": "mood_great", 170 | "text": "amazing" 171 | }, 172 | { 173 | "intent": "mood_great", 174 | "text": "wonderful" 175 | }, 176 | { 177 | "intent": "mood_great", 178 | "text": "I'am feeling very good" 179 | }, 180 | { 181 | "intent": "mood_great", 182 | "text": "I'am great" 183 | }, 184 | { 185 | "intent": "mood_great", 186 | "text": "I'm good" 187 | }, 188 | { 189 | "intent": "mood_great", 190 | "text": "definitely" 191 | }, 192 | { 193 | "intent": "mood_great", 194 | "text": "that's perfect" 195 | }, 196 | { 197 | "intent": "mood_great", 198 | "text": "I'am feeling better" 199 | }, 200 | { 201 | "intent": "mood_unhappy", 202 | "text": "sad" 203 | }, 204 | { 205 | "intent": "mood_unhappy", 206 | "text": "very sad" 207 | }, 208 | { 209 | "intent": "mood_unhappy", 210 | "text": "unhappy" 211 | }, 212 | { 213 | "intent": "mood_unhappy", 214 | "text": "bad" 215 | }, 216 | { 217 | "intent": "mood_unhappy", 218 | "text": "very bad" 219 | }, 220 | { 221 | "intent": "mood_unhappy", 222 | "text": "awful" 223 | }, 224 | { 225 | "intent": "mood_unhappy", 226 | "text": "terrible" 227 | }, 228 | { 229 | "intent": "mood_unhappy", 230 | "text": "not very good" 231 | }, 232 | { 233 | "intent": "mood_unhappy", 234 | "text": "extremely sad" 235 | }, 236 | { 237 | "intent": "mood_unhappy", 238 | "text": "so sad" 239 | }, 240 | { 241 | "intent": "mood_unhappy", 242 | "text": "not feeling nice" 243 | }, 244 | { 245 | "intent": "mood_unhappy", 246 | "text": "feeling bad" 247 | }, 248 | { 249 | "intent": "mood_unhappy", 250 | "text": "awfully bad" 251 | }, 252 | { 253 | "intent": "mood_unhappy", 254 | "text": "I am so sad" 255 | } 256 | ], 257 | "regex_features": [], 258 | "lookup_tables": [], 259 | "entity_synonyms": [] 260 | } 261 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/domain.json: -------------------------------------------------------------------------------- 1 | { 2 | "states": [ 3 | "intent_goodbye", 4 | "intent_greet", 5 | "intent_mood_affirm", 6 | "intent_mood_deny", 7 | "intent_mood_great", 8 | "intent_mood_unhappy", 9 | "prev_action_listen", 10 | "prev_action_restart", 11 | "prev_action_default_fallback", 12 | "prev_action_deactivate_form", 13 | "prev_action_revert_fallback_events", 14 | "prev_action_default_ask_affirmation", 15 | "prev_action_default_ask_rephrase", 16 | "prev_utter_greet", 17 | "prev_utter_happy", 18 | "prev_utter_cheer_up", 19 | "prev_utter_did_that_help", 20 | "prev_utter_goodbye" 21 | ] 22 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/domain.yml: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | --- 3 | actions: 4 | - utter_greet 5 | - utter_happy 6 | - utter_cheer_up 7 | - utter_did_that_help 8 | - utter_goodbye 9 | config: 10 | store_entities_as_slots: true 11 | entities: [] 12 | forms: [] 13 | intents: 14 | - greet: 15 | use_entities: true 16 | - goodbye: 17 | use_entities: true 18 | - mood_unhappy: 19 | use_entities: true 20 | - mood_affirm: 21 | use_entities: true 22 | - mood_deny: 23 | use_entities: true 24 | - mood_great: 25 | use_entities: true 26 | slots: {} 27 | templates: 28 | utter_cheer_up: 29 | - image: https://i.imgur.com/nGF1K8f.jpg 30 | text: Here is something to cheer you up! 31 | utter_did_that_help: 32 | - text: Did that help you ? 33 | utter_goodbye: 34 | - text: Bye 35 | utter_greet: 36 | - text: Hey! How are you ? 37 | utter_happy: 38 | - text: Great! Carry on... 39 | -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_0_KerasPolicy/featurizer.json: -------------------------------------------------------------------------------- 1 | {"py/object": "rasa_core.featurizers.MaxHistoryTrackerFeaturizer", "max_history": 5, "remove_duplicates": true, "state_featurizer": {"py/object": "rasa_core.featurizers.BinarySingleStateFeaturizer", "input_state_map": {"intent_goodbye": 0, "intent_greet": 1, "intent_mood_affirm": 2, "intent_mood_deny": 3, "intent_mood_great": 4, "intent_mood_unhappy": 5, "prev_action_deactivate_form": 9, "prev_action_default_ask_affirmation": 11, "prev_action_default_ask_rephrase": 12, "prev_action_default_fallback": 8, "prev_action_listen": 6, "prev_action_restart": 7, "prev_action_revert_fallback_events": 10, "prev_utter_cheer_up": 15, "prev_utter_did_that_help": 16, "prev_utter_goodbye": 17, "prev_utter_greet": 13, "prev_utter_happy": 14}, "num_features": 18, "slot_feature_len": 0, "user_feature_len": 6}, "use_intent_probabilities": false} -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_0_KerasPolicy/keras_model.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/2f04791758c85c35f6e1a0943766b73d757e2e4a/rasachat/models/dialogue/policy_0_KerasPolicy/keras_model.h5 -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_0_KerasPolicy/keras_policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "model": "keras_model.h5", 3 | "epochs": 100 4 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_1_FallbackPolicy/fallback_policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "nlu_threshold": 0.3, 3 | "core_threshold": 0.3, 4 | "fallback_action_name": "action_default_fallback" 5 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_2_MemoizationPolicy/featurizer.json: -------------------------------------------------------------------------------- 1 | {"py/object": "rasa_core.featurizers.MaxHistoryTrackerFeaturizer", "max_history": 5, "remove_duplicates": true, "state_featurizer": {"py/object": "rasa_core.featurizers.SingleStateFeaturizer", "slot_feature_len": null, "user_feature_len": null}, "use_intent_probabilities": false} -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_2_MemoizationPolicy/memorized_turns.json: -------------------------------------------------------------------------------- 1 | { 2 | "max_history": 5, 3 | "lookup": { 4 | "eJyLzivNydFRwCSra2MBj0wJzQ==": 0, 5 | "eJyLzivNydFRQCara4E4M68kNa8kPj0/PyWpMtVKwVDPQEehoCi1LD4xuSQzPy8+J7MYqAIsURsLAG9jGIo=": 11, 6 | "eJyLzivNydFRgJDVtUCcmVeSmlcSn56fn5JUmWqlYKhnoKNQUJRaFp+YXJKZnxefk1kMVAGWwK++tKQktQhFojYWAL+yJ1c=": 0, 7 | "eJyLzivNydFRqK4F4sy8ktS8kvj0/PyUpMpUKwVDPQMdhYKi1LL4xOSSzPy8+JzMYqAKsAR+9aUlJalFKBLI6otSU0sImB4LAA6nNUI=": 7, 8 | "eJyLrq7VUajOzCtJzSuJT8/PT0mqTLVSMNQz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zc9PiU8vSk0ssVIw1DPQUSgoSi2LT0wuyczPi8/JLAYqAkvU6ijg11JaUpJaFJ+RWFBQia4hHaghqTKVaAuwqIeYjixBsvmxAJb5Vgo=": 11, 65 | "eJyLrs7MK0nNK4nPzc9PiU8vSk0ssVIw1DPQUSgoSi2LLy0pSS2Kz0gsKKgEC9fqKMA0pAM1JFWmIqtOTC7JzM+Lz8ksBqogQj3EdGQJmpsfCwB6clTi": 0 66 | } 67 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_3_FormPolicy/featurizer.json: -------------------------------------------------------------------------------- 1 | {"py/object": "rasa_core.featurizers.MaxHistoryTrackerFeaturizer", "max_history": 2, "remove_duplicates": true, "state_featurizer": {"py/object": "rasa_core.featurizers.SingleStateFeaturizer", "slot_feature_len": null, "user_feature_len": null}, "use_intent_probabilities": false} -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_3_FormPolicy/memorized_turns.json: -------------------------------------------------------------------------------- 1 | { 2 | "max_history": 2, 3 | "lookup": {} 4 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "action_fingerprints": { 3 | "action_listen": { 4 | "slots": [] 5 | }, 6 | "utter_goodbye": { 7 | "slots": [] 8 | }, 9 | "utter_happy": { 10 | "slots": [] 11 | } 12 | }, 13 | "python": "3.6.5", 14 | "max_histories": [ 15 | 5, 16 | null, 17 | 5, 18 | 2 19 | ], 20 | "ensemble_name": "rasa_core.policies.ensemble.SimplePolicyEnsemble", 21 | "policy_names": [ 22 | "rasa_core.policies.keras_policy.KerasPolicy", 23 | "rasa_core.policies.fallback.FallbackPolicy", 24 | "rasa_core.policies.memoization.MemoizationPolicy", 25 | "rasa_core.policies.form_policy.FormPolicy" 26 | ], 27 | "trained_at": "20190418-233521", 28 | "rasa_core": "0.13.8", 29 | "tensorflow": "1.12.0", 30 | "sklearn": "0.20.3" 31 | } -------------------------------------------------------------------------------- /rasachat/nlu.md: -------------------------------------------------------------------------------- 1 | ## intent:greet 2 | - hey 3 | - hello 4 | - hey there 5 | - hi 6 | - good morning 7 | - good evening 8 | - good afternoon 9 | 10 | ## intent:goodbye 11 | - bye 12 | - seeya 13 | - see ya 14 | - goodbye 15 | - see you later 16 | - see you around 17 | 18 | ## intent:mood_affirm 19 | - yes 20 | - indeed 21 | - of course 22 | - obviously 23 | - that sounds good 24 | - correct 25 | - alright 26 | - alright then 27 | - sure 28 | - that's nice 29 | - awesome 30 | - yeah 31 | - yippy 32 | 33 | ## intent:mood_deny 34 | - no 35 | - never 36 | - nahhh 37 | - I don't think so 38 | - don't like that 39 | - no way 40 | - not really 41 | - not sure 42 | - nope 43 | - definitely not 44 | - wrong 45 | 46 | ## intent:mood_great 47 | - perfect 48 | - good 49 | - very good 50 | - great 51 | - amazing 52 | - wonderful 53 | - I'am feeling very good 54 | - I'am great 55 | - I'm good 56 | - definitely 57 | - that's perfect 58 | - I'am feeling better 59 | 60 | ## intent:mood_unhappy 61 | - sad 62 | - very sad 63 | - unhappy 64 | - bad 65 | - very bad 66 | - awful 67 | - terrible 68 | - not very good 69 | - extremely sad 70 | - so sad 71 | - not feeling nice 72 | - feeling bad 73 | - awfully bad 74 | - I am so sad 75 | -------------------------------------------------------------------------------- /rasachat/nlu_config.yml: -------------------------------------------------------------------------------- 1 | language: en 2 | pipeline: tensorflow_embedding 3 | -------------------------------------------------------------------------------- /rasachat/stories.md: -------------------------------------------------------------------------------- 1 | ## happy path 2 | * greet 3 | - utter_greet 4 | * mood_great 5 | - utter_happy 6 | 7 | ## sad path 1 8 | * greet 9 | - utter_greet 10 | * mood_unhappy 11 | - utter_cheer_up 12 | - utter_did_that_help 13 | * mood_affirm 14 | - utter_happy 15 | 16 | ## sad path 2 17 | * greet 18 | - utter_greet 19 | * mood_unhappy 20 | - utter_cheer_up 21 | - utter_did_that_help 22 | * mood_deny 23 | - utter_goodbye 24 | 25 | ## say goodbye 26 | * goodbye 27 | - utter_goodbye 28 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | python-decouple 2 | greenlet 3 | django-cors-headers 4 | -------------------------------------------------------------------------------- /static/js/script.js: -------------------------------------------------------------------------------- 1 | var botui = new BotUI('my-botui-app'); 2 | 3 | $("#chatForm").submit((e) => { 4 | // e.preventDefault(); 5 | console.log('script is running...') 6 | 7 | var formData = $("#chatForm").serialize(); 8 | var userInput = $("#userInput").val(); 9 | 10 | sendMessage(formData); 11 | }) 12 | 13 | function sendMessage(message) { 14 | console.log('sendMessage is working with message: ' + message) 15 | 16 | $.ajax({ 17 | url: "/chat/", 18 | data: message, 19 | method: "POST", 20 | success: (data) => { 21 | console.log(data); 22 | $(this).find("input[type=text], textarea").val("") 23 | }, 24 | error: (err) => { 25 | console.error(err); 26 | console.error(err.status); 27 | console.error(err.statusText); 28 | } 29 | }) 30 | } 31 | 32 | // botui.message.add({ // show a message 33 | // human: true, 34 | // content: 'Hey there! I am Django Bot' 35 | // }).then(function () { // wait till its shown 36 | // return botui.action.text({ // show 'text' action 37 | // action: { 38 | // placeholder: 'Enter your message here...' 39 | // } 40 | // }); 41 | // }).then(function (res) { // get the result 42 | // botui.message.add({ 43 | // content: sendMessage(res.value)// sendMessage(message); 44 | // }); 45 | // }); 46 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | Django BotUI 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 | 25 | 33 | 34 |

Django-Rasa-BotUI

35 | 36 |
37 | 38 | 52 |
53 | 54 | 58 |
59 |
60 | 61 | 62 | 63 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | --------------------------------------------------------------------------------