Ejemplo n.º 1
0
#usr_channel=FileInputChannel('./testio.txt')

# In[9]:

from rasa_core.run import create_input_channel
from rasa_core.channels.custom_websocket import CustomInput
input_component1 = CustomInput(None)
input_component2 = CustomInput(None)
from rasa_core.channels.websocket import WebSocketInputChannel
usr_channel = WebSocketInputChannel(int(env_config.userchannelport),
                                    None,
                                    input_component1,
                                    http_ip='0.0.0.0')
ha_channel = WebSocketInputChannel(int(env_config.hachannelport),
                                   None,
                                   input_component2,
                                   http_ip='0.0.0.0')
usr_channel.output_channel = input_component1.output_channel
ha_channel.output_channel = input_component2.output_channel

# In[10]:

usr_channel

# In[11]:

logging.basicConfig()
agent.handle_dual_channels(usr_channel, ha_channel)

# In[ ]:
Ejemplo n.º 2
0
training_data = agent.load_data('./stories.md')

agent.train(training_data, epochs=50)
# In[9]:

from rasa_core.run import create_input_channel
from rasa_core.channels.file import FileInputChannel
#usr_channel=FileInputChannel('./testio.txt')

# In[9]:

from rasa_core.channels.console import ConsoleInputChannel
import numpy as np
sender_id = str(123123213 + np.random.randint(1000))
print("creating sender id" + sender_id)
usr_channel = ConsoleInputChannel(sender_id=sender_id)
ha_channel = None

# In[10]:

usr_channel

# In[11]:

logging.basicConfig(level=logging.DEBUG)
agent.handle_dual_channels([usr_channel], ha_channel)

# In[ ]:

interpreter.parse('My account is not active')