Failed to execute custom action
Closed this issue · 0 comments
While running the model, I experienced the following error:
2019-07-04 04:31:46 ERROR flask.app - Exception on /webhook [POST]
Traceback (most recent call last):
File "/home/oscar/venv/lib/python3.7/site-packages/flask/app.py", line 2311, in wsgi_app
response = self.full_dispatch_request()
File "/home/oscar/venv/lib/python3.7/site-packages/flask/app.py", line 1834, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/oscar/venv/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/home/oscar/venv/lib/python3.7/site-packages/flask/app.py", line 1737, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/oscar/venv/lib/python3.7/site-packages/flask/_compat.py", line 36, in reraise
raise value
File "/home/oscar/venv/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
rv = self.dispatch_request()
File "/home/oscar/venv/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/oscar/venv/lib/python3.7/site-packages/flask_cors/decorator.py", line 128, in wrapped_function
resp = make_response(f(*args, **kwargs))
File "/home/oscar/venv/lib/python3.7/site-packages/rasa_sdk/endpoint.py", line 59, in webhook
response = executor.run(action_call)
File "/home/oscar/venv/lib/python3.7/site-packages/rasa_sdk/executor.py", line 237, in run
"No registered Action found for name '{}'.".format(action_name)
Exception: No registered Action found for name 'action_fallback_consume'.
127.0.0.1 - - [2019-07-04 04:31:46] "POST /webhook HTTP/1.1" 500 411 0.002637
2019-07-04 04:31:46 ERROR rasa.core.processor - Encountered an exception while running action 'action_fallback_consume'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
2019-07-04 04:31:46 DEBUG rasa.core.processor - Failed to execute custom action.
Traceback (most recent call last):
File "/home/oscar/venv/lib/python3.7/site-packages/rasa/core/actions/action.py", line 398, in run
json=json_body, method="post", timeout=DEFAULT_REQUEST_TIMEOUT
File "/home/oscar/venv/lib/python3.7/site-packages/rasa/utils/endpoints.py", line 142, in request
resp.status, resp.reason, await resp.content.read()
rasa.utils.endpoints.ClientResponseError: 500, INTERNAL SERVER ERROR, body='b'\n<title>500 Internal Server Error</title>\n
Internal Server Error
\nThe server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
\n''The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/oscar/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 439, in _run_action
events = await action.run(output_channel, nlg, tracker, self.domain)
File "/home/oscar/venv/lib/python3.7/site-packages/rasa/core/actions/action.py", line 420, in run
raise Exception("Failed to execute custom action.") from e
Exception: Failed to execute custom action.
My stories.md file is:
greet
- greet
- utter_greet
goodbye
- goodbye
- utter_goodbye
greetnbye
- greet
- utter_greet
- goodbye
- utter_goodbye
unknown
- unknown_intent
- action_fallback_consume
meaning1
- greet
- utter_greet
- request_meaning_of{"service": "Dedicated Servers"}
- slot{"service": "Dedicated Servers"}
- action_search_meaning
- goodbye
- utter_goodbye
meaning2
- greet
- utter_greet
- request_meaning_of{"service": "cPanel Dedicated Servers"}
- slot{"service": "cPanel Dedicated Servers"}
- action_search_meaning
- request_meaning_of{"service": "Microsoft Window Software"}
- slot{"service": "Microsoft Window Software"}
- action_search_meaning
- request_meaning_of{"service": "Network Firewall"}
- slot{"service": "Network Firewall"}
- action_search_meaning
- goodbye
- utter_goodbye
my config file:
- name: FallbackPolicy
fallback_action_name: 'action_fallback_consume'
nlu_threshold: 0.7
core_threshold: 0.5
my domain file:
actions:
- utter_greet
- utter_goodbye
- utter_advantage_action_one
- utter_advantage_action_two
- utter_how_action_three
- utter_ask_server_CPU
- utter_ask_morehelp
- utter_confirm
- action_search_meaning
- action_fallback_consume
- action_search_advantage
- action_search_price
- action_search_specific
my actions file:
rom future import absolute_import
from future import division
from future import print_function
from future import unicode_literals
from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet
support_search = ["Dedicated Servers", "UNIX Dedicated Servers", "Windows Dedicated Servers"]
def extract_service(service):
if service is None:
return None
for name in support_search:
if name in service:
return name
return None
class ActionSearchMeaning(Action):
def name(self):
return 'action_search_meaning'
def run(self, dispatcher, tracker, domain):
service = tracker.get_slot("service")
service = extract_service(service)
if service is None:
dispatcher.utter_message("'service' is None")
return []
dispatcher.utter_message("okay, please wait.")
return []
class ActionSearchAdvantage(Action):
def name(self):
return 'action_search_advantage'
def run(self, dispatcher, tracker, domain):
service = tracker.get_slot("service")
service = extract_service(service)
if service is None:
dispatcher.utter_message("'service' is None")
return []
return[]
class ActionSearchPrice(Action):
def name(self):
return 'action_search_price'
def run(self, dispatcher, tracker, domain):
service = tracker.get_slot("service")
service = extract_service(service)
if service is None:
dispatcher.utter_message("'service' is None")
return []
return[]
class ActionFallbackConsume(Action):
"""Executes the fallback action and goes back to the previous state
of the dialogue"""
def name(self):
return 'action_fallback_consume'
def run(self, dispatcher, tracker, domain):
from rasa_core.events import UserUtteranceReverted
text = tracker.latest_message.text
key = '***'
api = 'https://www.cleverbot.com/getreply?input={}&key={}'.format(text, key)
message = requests.get(api).json()
dispatcher.utter_message("{}".format(message['output']))
return [UserUtteranceReverted()]
I have not start writing this file but defined actions.
Can you please help me with this error>
Thanks.