Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
merged master2
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbo committed Aug 6, 2018
2 parents fa3d6f6 + 78b347f commit d405ec2
Show file tree
Hide file tree
Showing 24 changed files with 205 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- pip install sphinx==1.7.5 sphinx-autobuild==0.6.0 sphinxcontrib-httpdomain==1.5.0 sphinxcontrib-programoutput==0.11
nbsphinx==0.3.2 sphinxcontrib-websupport==1.1.0
- pip install git+https://${GITHUB_TOKEN}:x-oauth-basic@github.com/RasaHQ/sphinxcontrib-versioning.git@version_list
- pip install https://storage.googleapis.com/docs-theme/rasabaster-0.7.10.tar.gz
- pip install --no-cache-dir https://storage.googleapis.com/docs-theme/rasabaster-0.7.12.tar.gz
- pip install -e git://github.com/RasaHQ/sphinx_rtd_theme.git#egg=sphinx_rtd_theme
- pip install -e .
- pip list
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This project adheres to `Semantic Versioning`_ starting with version 0.2.0.

Added
-----
- intent confidence support in RegexInterpreter

Changed
-------
Expand All @@ -21,6 +22,20 @@ Removed
Fixed
-------

[0.10.3] - 2018-08-03
^^^^^^^^^^^^^^^^^^^^^

Changed
-------
- updated to Rasa NLU 0.13
- improved documentation quickstart

Fixed
-----
- server request argument handling on python 3
- creation of training data story graph - removes more nodes and speeds up
the training

[0.10.2] - 2018-07-24
^^^^^^^^^^^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ sphinx-autobuild==0.7.1
sphinxcontrib-versioning==2.2.1
sphinxcontrib-httpdomain==1.6.1
sphinxcontrib-programoutput==0.11
https://storage.googleapis.com/docs-theme/rasabaster-0.7.10.tar.gz
https://storage.googleapis.com/docs-theme/rasabaster-0.7.12.tar.gz
pygments==2.2.0
13 changes: 13 additions & 0 deletions docs/api/interpreter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,16 @@ the same type you can use
/add_to_shopping_list{"item": ["milk", "salt"]}
Which corresponds to a message ``"I want to add milk and salt to my list"``.

If you want to specify the intent confidence you can use

.. code-block:: bash
/deny@0.825
Which feeds the intent ``greet`` with confidence ``0.825``. Combining confidence
and entities

.. code-block:: bash
/add_to_shopping_list@0.825{"item": ["milk", "salt"]}
4 changes: 3 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.. include:: ../CHANGELOG.rst
:desc: Rasa Core Changelog

.. include:: ../CHANGELOG.rst
8 changes: 5 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
'rasabaster.button',
'rasabaster.card',
'rasabaster.chatbubble',
'rasabaster.runnable'
'rasabaster.runnable',
'rasabaster.copyable'
# 'numpydoc',
]

Expand Down Expand Up @@ -136,14 +137,15 @@
'github_user': 'RasaHQ',
'github_repo': 'rasa_core',
'fixed_sidebar': True,
'product': "Core"
'product': "Core",
'base_url': 'https://rasa.com/docs/core/'
}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#html_title = u'rasa v0.1'
html_title = u''

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
Expand Down
2 changes: 2 additions & 0 deletions docs/debugging.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: Tips for Debugging a Rasa bot

.. _debugging:

Debugging
Expand Down
1 change: 1 addition & 0 deletions docs/domains.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:desc: Understanding Rasa Core Domains
.. _domain:

Domain Format
Expand Down
2 changes: 2 additions & 0 deletions docs/evaluation.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: How to evaluate a Rasa Core model

.. _evaluation:

Evaluating and Testing
Expand Down
2 changes: 2 additions & 0 deletions docs/fallbacks.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: Fallback and Default Actions in Rasa Core

.. _fallbacks:

Fallback Actions
Expand Down
2 changes: 2 additions & 0 deletions docs/http.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: The Rasa Core REST API

.. _section_http:

HTTP API
Expand Down
10 changes: 4 additions & 6 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@ Installation
Install Rasa Core to get started with the Rasa stack.

.. note::
You can also get started without installing anything by using this
You can also get started without installing anything by going to the :ref:`quickstart`

.. button::
:text: colab notebook
:link: https://colab.research.google.com/github/RasaHQ/rasa_core/blob/master/getting_started.ipynb

Install Rasa Core
-----------------
The recommended way to install Rasa Core is using pip:

.. code-block:: bash
.. copyable::

pip install rasa_core


If you alredy have `rasa_core` installed and want to update it run:

.. code-block:: bash
.. copyable::

pip install -U rasa_core

Expand Down
2 changes: 2 additions & 0 deletions docs/interactive_learning.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: Interactive Learning with Rasa Core

.. _interactive_learning:

Interactive Learning
Expand Down
2 changes: 2 additions & 0 deletions docs/migrations.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: Upgrading your Rasa Core Project

.. _migration:

Migration Guide
Expand Down
2 changes: 2 additions & 0 deletions docs/policies.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: Understanding Rasa Core Policies

.. _policies:

Training and Policies
Expand Down
37 changes: 35 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ If you are running locally, copy the text between the triple quotes (``"""``)
and save it in a file called ``stories.md``.

.. runnable::
:description: core-write-stories

stories_md = """
## happy path
Expand Down Expand Up @@ -103,6 +104,8 @@ The domain defines the universe your bot lives in.
Here is an example domain for our bot which we'll write to a file called ``domain.yml``:

.. runnable::
:description: core-write-domain

domain_yml = """
intents:
- greet
Expand Down Expand Up @@ -181,6 +184,7 @@ leave out the ``!`` at the start. This will train the dialogue model and store i
into ``models/dialogue``.

.. runnable::
:description: core-train-core

!python -m rasa_core.train -d domain.yml -s stories.md -o models/dialogue

Expand All @@ -205,12 +209,36 @@ If you are running these commands locally, run:
If you are running the cells here in the docs, run this cell:


.. runnable::
:description: core-chat-without-nlu

import IPython
from IPython.display import clear_output
from rasa_core.agent import Agent
from rasa_core.channels.console import ConsoleInputChannel
import time

messages = ["Hi! you can chat in this window. Type 'stop' to end the conversation."]
agent = Agent.load('models/dialogue')
agent.handle_channel(ConsoleInputChannel())

def chatlogs_html(messages):
messages_html = "".join(["&lt;p&gt;{}&lt;/p&gt;".format(m) for m in messages])
chatbot_html = """&lt;div class="chat-window" {}&lt;/div&gt;""".format(messages_html)
return chatbot_html


while True:
clear_output()
display(IPython.display.HTML(chatlogs_html(messages)))
time.sleep(0.3)
a = input()
messages.append(a)
if a == 'stop':
break
responses = agent.handle_message(a)
for r in responses:
messages.append(r.get("text"))



5. Add NLU
Expand All @@ -228,6 +256,7 @@ In this tutorial we are going to use Markdown Format for NLU training data.
Let's create some intent examples in a file called ``nlu.md``:

.. runnable::
:description: core-write-nlu-data

nlu_md = """
## intent:greet
Expand Down Expand Up @@ -287,6 +316,8 @@ Furthermore, we need a configuration file, ``nlu_config.yml``, for the
NLU model:

.. runnable::
:description: core-write-nlu-config

nlu_config = """
language: en
pipeline: tensorflow_embedding
Expand All @@ -301,6 +332,7 @@ first).
Let's run

.. runnable::
:description: core-train-nlu

!python -m rasa_nlu.train -c nlu_config.yml --data nlu.md -o models --fixed_model_name nlu --project current --verbose

Expand Down Expand Up @@ -330,6 +362,7 @@ If you are running these commands locally, run:
If you are running the cells here in the docs, run this cell:

.. runnable::
:description: core-chat-with-nlu

from rasa_core.agent import Agent
from rasa_core.channels.console import ConsoleInputChannel
Expand Down
2 changes: 2 additions & 0 deletions docs/server.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: How to Customize Your Rasa Core Configuration

.. _section_server:

Server Configuration
Expand Down
2 changes: 2 additions & 0 deletions docs/stories.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:desc: Understanding Rasa Core Stories

.. _stories:

Story Data Format
Expand Down
21 changes: 14 additions & 7 deletions rasa_core/channels/rasa_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
class RasaChatInput(HttpInputComponent):
"""Chat input channel for Rasa Platform"""

def __init__(self, host):
def __init__(self, host, admin_token=None):
self.host = host
self.admin_token = admin_token

def _check_token(self, token):
url = "{}/users/me".format(self.host)
Expand Down Expand Up @@ -52,18 +53,24 @@ def blueprint(self, on_new_message):
rasa_chat = Blueprint('rasa_chat', __name__)
CORS(rasa_chat)

@rasa_chat.route("/", methods=['GET'])
@rasa_chat.route("/", methods=['GET', 'HEAD'])
def health():
return jsonify({"status": "ok"})

@rasa_chat.route("/send", methods=['GET', 'POST'])
@rasa_chat.route("/send", methods=['GET', 'POST', 'HEAD'])
@cross_origin()
def receive():
user = self.fetch_user(request)
if (self.admin_token and
request.args.get("token") == self.admin_token):
user_name = request.json["user"]
else:
user_name = self.fetch_user(request)["username"]

msg = request.json["message"]
on_new_message(UserMessage(msg, CollectingOutputChannel(),
sender_id=user["username"]))
out = CollectingOutputChannel()
on_new_message(UserMessage(msg, out,
sender_id=user_name))

return jsonify({"status": "ok"})
return jsonify(out.messages)

return rasa_chat
Loading

0 comments on commit d405ec2

Please sign in to comment.