2

我使用插槽创建了一个自定义操作,并且在运行机器人时,插槽值没有被填充。我的动作文件如下:

from typing import Any, Text, Dict, List

from rasa_sdk import Action from rasa_sdk.events import SlotSet

类 ActionCheckRestaurants(Action): def name(self) -> Text: return "action_check_restaurants"

def run(self, dispatcher, tracker, domain):

  entity_name = tracker.get_slot('entity_name')
  response= """the name is {}""".format(entity_name)
  dispatcher.utter_message(response)
  return [SlotSet("entity_name", entity_name)]

我的域文件是;

intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- ask_landing
- ask_raw
- ask_entity
- inform
entities:
- entity_name
slots:
  entity_name:
    type: categorical
    values: []
responses:
  utter_greet:
  - text: Hey! How are you?
  utter_cheer_up:
  - text: 'Here is something to cheer you up:'
    image: httpd://i.imgur.com/nGF1K8f.jpg
  utter_did_that_help:
  - text: Did that help you?
  utter_happy:
  - text: Great, carry on!
  utter_goodbye:
  - text: Bye
  utter_data:
  - text: what data you are looking for?
  utter_entity_name:
  - text: which entity you need data
actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_data
- utter_raw
- utter_landing
- action_check_restaurants
- fetch_profile
- utter_entity_name

不知道是什么问题。

4

1 回答 1

1

在您的域中,我可以看到一个没有定义值的分类插槽(插槽:实体名称:类型:分类值:[])。
改用文本(或定义可能的值)。

于 2020-04-17T16:03:05.177 回答