如何处理来自 actions.py 的 rasa 表单确认或拒绝

how to handle rasa form confirmation or denying from actions.py

基于以下故事:

## certif deny_repeat_affirm_stop
* greet
  - utter_greet
* request_certificate
  - certificate_form
  - form{"name": "certificate_form"}
  - form{"name": null}
  - utter_did_that_help
* deny
  - utter_ask_again
* request_certificate
  - certificate_form
  - form{"name": "certificate_form"}
  - form{"name": null}
  - utter_did_that_help
* affirm
  - utter_noworries
* goodbye
  - utter_goodbye
  - action_restart

我需要 post(休息 api)表格到服务,当用户确认时,我如何从 actions.py 开始:

*affirm

我正在寻找技巧或其他东西可以帮助我阅读 actions.py

中的 *affirm

您可以为此使用自定义 actions

您的 domain.yml 文件应如下所示:

intents:
    - affirm

actions:
    - action_affirm

您的 stories.md 文件应如下所示:

* affirm
    - action_affirm

您的 actions.py 文件应如下所示:

from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet

class ActionAffirm(Action):
    def name(self):
        return 'action_affirm'

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

            #Do Something you want


        ...