├── chatsite ├── __init__.py ├── wsgi.py ├── views.py ├── urls.py └── settings.py ├── requirements.txt ├── rasachat ├── nlu_config.yml ├── models │ ├── dialogue │ │ ├── policy_3_FormPolicy │ │ │ ├── memorized_turns.json │ │ │ └── featurizer.json │ │ ├── policy_0_KerasPolicy │ │ │ ├── keras_policy.json │ │ │ ├── keras_model.h5 │ │ │ └── featurizer.json │ │ ├── policy_1_FallbackPolicy │ │ │ └── fallback_policy.json │ │ ├── policy_2_MemoizationPolicy │ │ │ ├── featurizer.json │ │ │ └── memorized_turns.json │ │ ├── domain.json │ │ ├── policy_metadata.json │ │ └── domain.yml │ └── current │ │ └── nlu │ │ ├── intent_featurizer_count_vectors.pkl │ │ ├── intent_classifier_tensorflow_embedding.ckpt.meta │ │ ├── intent_classifier_tensorflow_embedding.ckpt.index │ │ ├── intent_classifier_tensorflow_embedding_inv_intent_dict.pkl │ │ ├── intent_classifier_tensorflow_embedding.ckpt.data-00000-of-00001 │ │ ├── intent_classifier_tensorflow_embedding_encoded_all_intents.pkl │ │ ├── checkpoint │ │ ├── metadata.json │ │ └── training_data.json ├── stories.md ├── bot.py ├── actions.py ├── domain.yml └── nlu.md ├── manage.py ├── static └── js │ └── script.js ├── .gitignore ├── README.md └── templates └── index.html /chatsite/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | python-decouple 2 | greenlet 3 | django-cors-headers 4 | -------------------------------------------------------------------------------- /rasachat/nlu_config.yml: -------------------------------------------------------------------------------- 1 | language: en 2 | pipeline: tensorflow_embedding 3 | -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_3_FormPolicy/memorized_turns.json: -------------------------------------------------------------------------------- 1 | { 2 | "max_history": 2, 3 | "lookup": {} 4 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_0_KerasPolicy/keras_policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "model": "keras_model.h5", 3 | "epochs": 100 4 | } -------------------------------------------------------------------------------- /rasachat/models/dialogue/policy_0_KerasPolicy/keras_model.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/HEAD/rasachat/models/dialogue/policy_0_KerasPolicy/keras_model.h5 -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_featurizer_count_vectors.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/HEAD/rasachat/models/current/nlu/intent_featurizer_count_vectors.pkl -------------------------------------------------------------------------------- /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/current/nlu/intent_classifier_tensorflow_embedding.ckpt.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/HEAD/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.meta -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/HEAD/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.index -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_inv_intent_dict.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/HEAD/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_inv_intent_dict.pkl -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/HEAD/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding.ckpt.data-00000-of-00001 -------------------------------------------------------------------------------- /rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_encoded_all_intents.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alexmhack/Django-Rasa-Bot/HEAD/rasachat/models/current/nlu/intent_classifier_tensorflow_embedding_encoded_all_intents.pkl -------------------------------------------------------------------------------- /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/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_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} -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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/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/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/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/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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 |