Hi, I’m trying to get value from user input and pass it to my custom actions. How can I check the value is passed wrong or right?. This is my code nlu.yml :
- intent: confirm
examples: |
- [cosplay](hashtag) nha
- Hashtag là [cosplay](hashtag)
- Từ khóa là [cosplay](hashtag)
- hashtag anh muốn tìm là [cosplay](hashtag)
- Từ khóa cần tìm kiếm là [cosplay](hashtag)
- Anh muốn tìm về [cosplay](hashtag)
domain.yml :
entities:
- hashtag
slots:
hashtag:
type: text
influence_conversation: true
mappings:
- type: from_entity
entity: hashtag
stories.yml :
- story: ask trending by hashtag
steps:
- intent: ask_for_tiktok_trending_by_hashtag
- action: utter_confirm
- intent: confirm
entities:
- hashtag
- slot_was_set:
- hashtag: hashtag
- action: action_trending_by_hashtag
and my action:
class ActionTrendingByHashTag(Action):
def name(self) -> Text:
return "action_trending_by_hashtag"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
hashtag = tracker.get_slot("hashtag")
result = get_tiktok_trending_by_hashtag(hashtag)
for video in result:
dispatcher.utter_message(text=video['title'], image=video['cover'])
return []
I pass the value to other function (get_tiktok_trending_by_hashtag) to get data. But the received data is not like what I expect. Did I make something wrong? Thanks for you help.