I’m trying to access my database. Bot shows the timeout error in rasa shell but expected output shows in rasa run actions. Can anyone help me and thanks in advance.
This error from rasa shell
2021-06-30 22:22:18 ERROR asyncio - Task exception was never retrieved future: <Task finished name=‘Task-2’ coro=<configure_app…run_cmdline_io() done, defined at c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packa ges\rasa\core\run.py:131> exception=TimeoutError()> Traceback (most recent call last): File “c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packages\rasa\core\run.py”, line 135, in run_cmdline_io await console.record_messages( File “c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packages\rasa\core\channels\console.py”, line 182, in record_messages async for response in bot_responses: File “c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packages\rasa\core\channels\console.py”, line 137, in send_message_receive_stream async for line in resp.content: File “c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packages\aiohttp\streams.py”, line 39, in anext rv = await self.read_func() File “c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packages\aiohttp\streams.py”, line 338, in readline await self._wait(“readline”) File “c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packages\aiohttp\streams.py”, line 306, in _wait await waiter File “c:\users\shanvij\anaconda3\envs\rasacb\lib\site-packages\aiohttp\helpers.py”, line 656, in exit raise asyncio.TimeoutError from None asyncio.exceptions.TimeoutError
Excpected output shows in rasa run actions
(rasacb) C:\Users\shan\rasacb>rasa run actions 2021-06-30 22:21:12 INFO rasa_sdk.endpoint - Starting action endpoint server… 2021-06-30 22:21:12 INFO rasa_sdk.executor - Registered function for ‘user_details_form’. 2021-06-30 22:21:12 INFO rasa_sdk.executor - Registered function for ‘action_submit’. 2021-06-30 22:21:12 INFO rasa_sdk.executor - Registered function for ‘action_time’. 2021-06-30 22:21:12 INFO rasa_sdk.executor - Registered function for ‘action_query’. 2021-06-30 22:21:12 INFO rasa_sdk.endpoint - Action endpoint is up and running on http://0.0.0.0:5055
your ticket id 423179 is in progress
class QueryResourceType(Action):
def name(self) -> Text:
return "action_query"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
conn = create_connection("C:/Users/SHAN/rasacb/actions/eng.db")
slot_value = tracker.get_slot("tno")
slot_name = "TicketId"
get_query_results = select_by_slot( conn=conn,
slot_name=slot_name,slot_value=slot_value)
dispatcher.utter_message(get_query_results)
return []
def create_connection(db_file):
conn = None
try:
conn = sqlite3.connect(db_file)
except Error as e:
print(e)
return conn
def select_by_slot(conn, slot_name, slot_value):
cur = conn.cursor()
cur.execute(f"""SELECT * FROM englishdata WHERE {slot_name}='{slot_value}'""")
rows = cur.fetchall()
if len(list(rows)) < 1:
return[("There are no resources matching your query.")]
else:
for row in random.sample(rows, 1):
return[print(f'your ticket id is {row[0]}')]