Hi, I have installed rasa_core, then i did pip install rasa x. I have the latest versions of both rasa core and rasa x. I have connected my bot to the database and I am fetching the data from there.Here is the code. I do rasa run actions and then rasa shell
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_hello_world"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
# Getting slot values
insert_date=tracker.get_slot('insert_date')
receiver_email=tracker.get_slot('email')
entity_name=tracker.get_slot('entity_name')
print("entity_name",entity_name)
print("email",receiver_email)
print("insert_date",insert_date)
user = "postgres"
password = "postgres"
host = "localhost"
port = 5432
database = "mydatabase"
db_conn = psycopg2.connect(host=host, user=user, password=password, database=database)
db_cursor = db_conn.cursor()
sql_query = "SELECT * FROM operational_metadata WHERE entity_name = %s and insert_date = %s ;"
print("i am good")
result = db_cursor.execute(sql_query,(entity_name,insert_date,))
results1 = db_cursor.fetchall()
for r in results1:
response={"entity_name :{r[0]} insert date :{r[1]} label :{r[2]}"}
print("------------------------",response)
dispatcher.utter_message(response)
return [SlotSet('email', receiver_email), SlotSet('entity_name', entity_name), SlotSet('insert_date', insert_date)]
I got this in the terminal running rasa shell:
uture: <Task finished coro=<configure_app..run_cmdline_io() done, defined at /Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/run.py:128> exception=TimeoutError()> Traceback (most recent call last): File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/run.py”, line 134, in run_cmdline_io sender_id=conversation_id, File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/console.py”, line 151, in record_messages async for response in bot_responses: File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/console.py”, line 107, in send_message_receive_stream async for line in resp.content: File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/streams.py”, line 39, in anext rv = await self.read_func() File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/streams.py”, line 328, in readline await self._wait(‘readline’) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/streams.py”, line 296, in _wait await waiter File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/helpers.py”, line 596, in exit raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError Transport closed @ (‘127.0.0.1’, 52636) and exception experienced during error handling 2020-05-23 00:02:37 ERROR asyncio - Task exception was never retrieved future: <Task finished coro=<RestInput.on_message_wrapper() done, defined at /Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/channel.py:393> exception=AttributeError("‘list’ object has no attribute ‘strip’",)> Traceback (most recent call last): File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 407, in on_message_wrapper await on_new_message(message) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 83, in handler await app.agent.handle_message(*args, **kwargs) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/agent.py”, line 486, in handle_message return await processor.handle_message(message) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/processor.py”, line 108, in handle_message await self._predict_and_execute_next_action(message.output_channel, tracker) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/processor.py”, line 552, in _predict_and_execute_next_action action, tracker, output_channel, self.nlg, policy, confidence File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/processor.py”, line 665, in _run_action await self._send_bot_messages(events, tracker, output_channel) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/processor.py”, line 594, in _send_bot_messages await output_channel.send_response(tracker.sender_id, e.message()) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 186, in send_response await self.send_text_message(recipient_id, message.pop(“text”), **message) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 327, in send_text_message for message_part in text.strip().split("\n\n"): AttributeError: ‘list’ object has no attribute ‘strip’
I get no error in the terminal that runs rasa run actions