Hi there so in my previous version of my code I was trying to run a bot with console input channel but then I found out that it was removed from the new rasa core versions, and could not complete my code. Thus I customized it to the new version where i call rasa_core.run.serve_application(agent, channel=‘cmdline’) however, i am struggling to understand how this works and am getting a lot of errors will appreciate if anyone could help to resolve this issue. thanx)
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import logging
import agent as agent
import rasa_core
from rasa_core.agent import Agent
#from rasa_core.channels.console import ConsoleInputChannel
from rasa_core.interpreter import RegexInterpreter
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.train import interactive
from rasa_core.utils import EndpointConfig
from rasa_core import config as policy_config
from rasa_core.interpreter import RasaNLUInterpreter
logger = logging.getLogger('__name__')
def run_hovo( interpreter, domain_file='chat_domain.yml'):
policies = policy_config.load("./policies.yml")
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent(domain_file, policies=policies, interpreter = interpreter,
action_endpoint=action_endpoint)
training_data_file = agent.load_data('./stories.md')
rasa_core.run.serve_application(agent, channel='cmdline')
agent.train_online(training_data_file, augmentation_factor = 50)
return agent
if __name__ == '__main__':
logging.basicConfig(level='INFO')
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/MyNLU')
run_hovo(nlu_interpreter)
ERROR:
C:\Users\ferar\Desktop\FYP\V2\venv\Scripts\python.exe C:/Users/ferar/Desktop/FYP/V2/train_online.py
INFO:rasa_nlu.components:Added 'nlp_spacy' to component cache. Key 'nlp_spacy-en'.
Processed Story Blocks: 100%|██████████| 1/1 [00:00<?, ?it/s, # trackers=1]
Processed Story Blocks: 100%|██████████| 1/1 [00:00<00:00, 1001.74it/s, # trackers=1]
Processed Story Blocks: 100%|██████████| 1/1 [00:00<00:00, 1145.67it/s, # trackers=1]
Processed Story Blocks: 100%|██████████| 1/1 [00:00<00:00, 960.01it/s, # trackers=1]
INFO:root:Rasa Core server is up and running on http://localhost:5005
Bot loaded. Type a message and press enter (use '/stop' to exit):
Exception in thread Thread-5:
Traceback (most recent call last):
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\eventloop\context.py", line 88, in get
return self._storage[ctx]
KeyError: 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\output\defaults.py", line 52, in get_default_output
value = _default_output.get()
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\eventloop\context.py", line 90, in get
raise TaskLocalNotSetError
prompt_toolkit.eventloop.context.TaskLocalNotSetError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\rasa_core\channels\console.py", line 101, in record_messages
text = get_cmd_input()
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\rasa_core\channels\console.py", line 42, in get_cmd_input
('', '#b373d6')])).ask()
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\questionary\prompts\text.py", line 62, in text
**kwargs)
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\shortcuts\prompt.py", line 285, in __init__
output = output or get_default_output()
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\output\defaults.py", line 61, in get_default_output
return create_output()
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\output\defaults.py", line 35, in create_output
return Win32Output(stdout)
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\output\win32.py", line 83, in __init__
info = self.get_win32_screen_buffer_info()
File "C:\Users\ferar\Desktop\FYP\V2\venv\lib\site-packages\prompt_toolkit\output\win32.py", line 178, in get_win32_screen_buffer_info
raise NoConsoleScreenBufferError
prompt_toolkit.output.win32.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?