Exemplo n.º 1
0
def test_webexteams_channel():
    from rasa_core.channels.webexteams import WebexTeamsInput
    from rasa_core.agent import Agent
    from rasa_core.interpreter import RegexInterpreter

    # load your trained agent
    agent = Agent.load(MODEL_PATH, interpreter=RegexInterpreter())

    input_channel = WebexTeamsInput(
        access_token="YOUR_ACCESS_TOKEN",
        # this is the `bot access token`
        room="YOUR_WEBEX_ROOM"
        # the name of your channel to which the bot posts (optional)
    )

    # set serve_forever=True if you want to keep the server running
    s = agent.handle_channels([input_channel], 5004, serve_forever=False)
    # END DOC INCLUDE
    # the above marker marks the end of the code snipped included
    # in the docs
    try:
        assert s.started
        routes_list = utils.list_routes(s.application)
        assert routes_list.get("/webhooks/webexteams/").startswith(
            'webexteams_webhook.health')
        assert routes_list.get("/webhooks/webexteams/webhook").startswith(
            'webexteams_webhook.webhook')
    finally:
        s.stop()
Exemplo n.º 2
0
from rasa_core.channels.webexteams import WebexTeamsInput
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
import yaml
from rasa_core.utils import EndpointConfig


# load your trained agent
nlu_interpreter = RasaNLUInterpreter('./models/current/nlu')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent.load('./models/current/dialogue', interpreter = nlu_interpreter, action_endpoint = action_endpoint)

input_channel = WebexTeamsInput(
    access_token=# this is the `bot access token`
    room=# the name of your channel to which the bot posts (optional)
)

# set serve_forever=True if you want to keep the server running
agent.handle_channels([input_channel], 5004, serve_forever=True)