Rasa Form Action - 槽中两次填入相同的数据。

问题描述 投票:1回答:1

我正在尝试使用Rasa的FormAction。以下是我的详细资料。

MyForm

class MyForm(FormAction):
    """My form action"""
    def name(self):
        return "my_form"

    @staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        """A list of required slots that the form has to fill"""
        return ["slot_a", "slot_b", "slot_c",  "slot_d"]

    def slot_mappings(self):
        # type: () -> Dict[Text: Union[Dict, List[Dict]]]
        """A dictionary to map required slots to
            - an extracted entity
            - intent: value pairs
            - a whole message
            or a list of them, where a first match will be picked"""
        return {"slot_a":[self.from_entity(entity="slot_a", intent=["inform"])],
                "slot_b": [self.from_entity(entity="slot_b", intent=["inform"])],
                "slot_c": [self.from_entity(entity="slot_c", intent=["inform"])],
                "slot_d": [self.from_entity(entity="slot_d", intent=["inform"])]}


    def submit(self, dispatcher: CollectingDispatcher,
               tracker: Tracker,
               domain: Dict[Text, Any]) -> List[Dict]:
        """Define what the form has to do
                after all required slots are filled"""
        dispatcher.utter_template('utter_submit', tracker)
        return []

以下是我的 domain.yml 文件,由于NDA的原因,只显示槽和表格的值。我的域名

# actions, entities, intents, templates 
slots:
  slot_c:
    type: unfeaturized
    auto_fill: false
  slot_b:
    type: unfeaturized
    auto_fill: false
  slot_d:
    type: unfeaturized
    auto_fill: false
  slot_a:
    type: unfeaturized
    auto_fill: false
  slot_e:
    type: text
    auto_fill: false
  slot_f:
    type: categorical
    values:
    - val_1
    - val_2
    - val_3

forms:
    - my_form

以下是我的 stories.yml:

## Story 1
* greet
  - utter_greet
* create_slot_vals
  - my_form
  - form{"name": "my_form"}
  - form{"name": null}
  - utter_saving_slots_values
* thank_you
  - utter_thanks

在填写完表格后,我有一个显示表格所填写的所有槽值的完整动作。

Rasa Utter Action

 The form details are:
 - Slot A: Software
 - Slot B: Anderson
 - Slot C: 12
 - Slot D: ['permanent', 'permanent']

问题是,尽管用户输入的值是 slot_d 为'永久',但只用了一次,同样的槽就会被再次请求,而且同样的值会在列表中自动填充两次并保存。

有人在Rasa中遇到过这样的问题吗?

python-3.x chatbot rasa-nlu rasa-core
1个回答
0
投票

如果你在配置文件中使用了多个实体提取器,那么就会导致这个错误,所以运行 rasa shell nlu 来知道是哪种实体提取器在抓取值。

© www.soinside.com 2019 - 2024. All rights reserved.