Python 3.x Rasa表单操作-插槽被相同数据填充两次
我试着用拉萨的形式。以下是我的详细资料: MyFormPython 3.x Rasa表单操作-插槽被相同数据填充两次,python-3.x,chatbot,rasa-nlu,rasa-core,Python 3.x,Chatbot,Rasa Nlu,Rasa Core,我试着用拉萨的形式。以下是我的详细资料: 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 for
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。
MyDomain
# 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
The form details are:
- Slot A: Software
- Slot B: Anderson
- Slot C: 12
- Slot D: ['permanent', 'permanent']
下面是我的故事。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绝对行动
# 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
The form details are:
- Slot A: Software
- Slot B: Anderson
- Slot C: 12
- Slot D: ['permanent', 'permanent']
问题是,即使用户只将slot\u d
的值作为“永久”输入一次,相同的slot会再次被请求,并且相同的值会在列表中自动填充两次并保存
有人在Rasa中遇到过这样的问题吗?如果在配置文件中使用多实体提取器,则会导致此错误,因此请运行
Rasa shell nlu
以了解哪种实体提取器正在获取该值