最近想做一款对话机器人。使用RASA的框架 刚开始训练和访问数据库还好,但是到了从用户的提问中获取数据就变得异常了。
请求: 请帮我查查张三
要么是无法触发意图 回复到别的responses,要么就是不能将[ ]代替的值赋值到slot中去 slot永远是nlu这个默认值,修改了很多地方,是我的训练方式有问题吗?
以下是配置文件
nlu.yml:
- intent: info_input_name
examples: |
- 请帮我查查[nlu](user_input_name)
- 帮我查查[nlu](user_input_name)
domain.yml:
forms:
name_form:
required_slots:
- user_input_name
responses:
utter_output_name:
- text: "好的,我知道您叫{user_input_name}了"
entities:
- user_input_name
slots:
user_input_name:
type: text
influence_conversation: false
mappings:
- type: from_entity
entity: user_input_name
rules.yml:
rules:
- rule: avtivate user_input_name form
steps:
- intent: info_input_name
- action: name_form
- active_loop: name_form
- rule: stop user_input_name form
condition:
# 条件是:表单处于活跃状态
- active_loop: name_form
steps:
# 表单停用
- action: name_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# 一旦槽填满后,提交表单时要运行的动作
- action: action_getSexByName
- action: utter_output_name
action:
class ActionGetSexByName(Action):
def name(self):
return 'action_getSexByName'
def run(self, dispatcher, tracker, domain):
content = tracker.latest_message
# .intent.entities.value
# content[0]
vall = tracker.get_slot("user_input_name")
print("content:")
print(content)
print("slot:")
print(vall)
return []
这里是没有设置返回值,因为通过tracker.latest_message打印出来的值都没有将实体类的值改变 slot也是没有变化