It’s work if story settings like this
stories.yml (successful)
version: "3.1"
stories:
- story: start path
steps:
- intent: start_kmamiz_bot
- action: utter_start_kmamiz_bot
- story: insights path
steps:
- intent: chose_insights
- action: utter_chose_insights
- intent: chose_type_of_insights
- action: action_chose_type_of_insights
- intent: chose_type_of_display
- action: action_hello_world
# - action: action_display_insight
And it isn’t work if story settings like this
stories.yml (failed)
version: "3.1"
stories:
- story: start path
steps:
- intent: start_kmamiz_bot
- action: utter_start_kmamiz_bot
- story: insights path
steps:
- intent: chose_insights
- action: utter_chose_insights
- intent: chose_type_of_insights
- action: action_chose_type_of_insights
- intent: chose_type_of_display
# - action: action_hello_world
- action: action_display_insight
My action.py is setting like this action.py
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
import requests
import json
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]]:
if display == "text":
dispatcher.utter_message(text=f"show in text")
elif display == "image":
dispatcher.utter_message(text=f"show in image")
elif display == "url":
dispatcher.utter_message(text=f"show in url")
else:
dispatcher.utter_message(text=f"the way you chose is not exist.")
return []
class ActionDisplayInsight(Action):
def name(self) -> Text:
return "action_display_insight"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
display = tracker.get_slot('display')
if display == "text":
dispatcher.utter_message(text=f"show in text")
elif display == "image":
dispatcher.utter_message(text=f"show in image")
elif display == "url":
dispatcher.utter_message(text=f"show in url")
else:
dispatcher.utter_message(text=f"the way you chose is not exist.")
return []
@nik202 I have no idea what’s going on!!!
The difference between them is the action name!!
One can trigger intent and can response, another can’t.
Maybe I miss something???
The whole project is in click me , and you need to open two terminal to run.
One input
rasa run -m models --enable-api --cors "*" --debug
Another input
rasa run actions
Then open
index.html
.Thank you very much