Beispiel #1
0
def run_remote():
    from rasa_core.remote import RemoteAgent
    from rasa_core.utils import EndpointConfig

    logging.basicConfig(level="DEBUG")

    from rasa_core.channels.rasa_chat import RasaChatInput
    from rasa_addons.webchat import WebChatInput, SocketInputChannel

    # definte the input channels for the platform and the chat widget
    rasa_in = RasaChatInput(config.platform_api)
    widget_in = WebChatInput(static_assets_path=os.path.join(
        os.path.dirname(os.path.realpath(__file__)), 'static'))
    input_channel = SocketInputChannel(config.self_port, "/", rasa_in,
                                       widget_in)

    # define the core endpoint
    core_endpoint_config = EndpointConfig(url=config.remote_core_endpoint,
                                          token=config.rasa_core_token)

    # define the nlg endpoint
    nlg_endpoint_config = EndpointConfig(url=config.rasa_nlg_endpoint,
                                         token=config.rasa_platform_token)

    # start the remote agent
    agent = RemoteAgent.load(config.core_model_dir,
                             core_endpoint=core_endpoint_config,
                             nlg_endpoint=nlg_endpoint_config)

    agent.handle_channel(input_channel)
Beispiel #2
0
def run_widget():
    import os
    from rasa_core.agent import Agent
    from rasa_addons.webchat import WebChatInput, SocketInputChannel

    agent = Agent.load('models/dialogue/', interpreter='models/nlu/current/')
    input_channel = WebChatInput(static_assets_path=os.path.join(
        os.path.dirname(os.path.realpath(__file__)), 'static'))
    agent.handle_channel(SocketInputChannel(5500, "/", input_channel))
Beispiel #3
0
def run_remote():
    from rasa_core.remote import RemoteAgent

    logging.basicConfig(level="DEBUG")

    from rasa_extensions.core.channels.rasa_chat import RasaChatInput
    from rasa_addons.webchat import WebChatInput, SocketInputChannel

    rasa_in = RasaChatInput(config.platform_api)
    widget_in = WebChatInput(static_assets_path=os.path.join(
        os.path.dirname(os.path.realpath(__file__)), 'static'))
    input_channel = SocketInputChannel(config.self_port, "/", rasa_in,
                                       widget_in)

    agent = RemoteAgent.load(config.core_model_dir,
                             config.remote_core_endpoint,
                             config.rasa_core_token)

    agent.handle_channel(input_channel)
Beispiel #4
0
#!/usr/bin/env python
import os

from rasa_addons.webchat import WebChatInput, SocketInputChannel
from rasa_core.agent import Agent

current_path = os.path.dirname(os.path.realpath(__file__))

agent = Agent.load("./models/dialogue/demo", "./models/nlu/demo/current")
input_channel = WebChatInput(static_assets_path=os.path.join(current_path, 'static'))
agent.handle_channel(SocketInputChannel(5500, "/", input_channel))
Beispiel #5
0
from rasa_addons.webchat import WebChatInput, SocketInputChannel
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.agent import Agent
import os

interpreter = RasaNLUInterpreter("models/current/nlu/")
agent = Agent.load("models/current/dialogue", interpreter=interpreter)
input_channel = WebChatInput(static_assets_path=os.path.join(
    os.path.dirname(os.path.realpath(__file__)), 'index.html'))
agent.handle_channel(SocketInputChannel(5500, "/bot", input_channel))
Beispiel #6
0
#!/usr/bin/env python

#SENIVERSE_KEY=hjne3bys5ilki7yw python ./webchat.py
import os

from rasa_addons.webchat import WebChatInput, SocketInputChannel
from rasa_core.agent import Agent

#current_path = os.path.dirname(os.path.realpath(__file__))

current_path = os.getcwd()
agent = Agent.load("models/dialogue", "models/nlu/longbi")
input_channel = WebChatInput(static_assets_path=os.path.join(
    current_path, 'static'),
                             index='mychat.html')
agent.handle_channel(SocketInputChannel(5500, "/", input_channel))