본문 바로가기

챗봇 (Rasa)

[Rasa] domain (+ 업데이트 중)

 

[ domain 파일 구성 ]

- intents

- entities

- forms 

- slots

- response   

  슬롯요청 utter_ask_{slot_name}

  일반응답 utter_{intent_name}_message

  기타응답 utter_{custom_name})

- actions

- session_config

 


 

[ response ]

 

1. 슬롯요청 utter_ask_{slot_name}

  (기본 text로 응답)

responses:
  utter_ask_email:
    - text: "What is your email address?"
  utter_ask_phone_number:
    - text: "What is your phone number?"

 

  (버튼으로 응답) _ custom

responses:
  utter_ask_preference:
    - custom:
        text: "choose the option"
        buttons:
          - title: "Option 1"
            payload: "/option_1"
          - title: "Option 2"
            payload: "/option_2"

 

( 그외 옵션들 ) _ custom

responses:
  utter_ask_picture:
    - custom:
        text: "Can you provide a picture?"
        image: "https://example.com/image.png"

=> image, video, audio, attachment 가능

 

 

(카드형)

responses:
  utter_show_options:
    - custom:
        type: "carousel"  # 또는 "list"
        elements:
          - title: "Option 1"
            image_url: "https://example.com/image1.png"
            subtitle: "This is option 1"
            buttons:
              - title: "Select Option 1"
                payload: "/select_option_1"
          - title: "Option 2"
            image_url: "https://example.com/image2.png"
            subtitle: "This is option 2"
            buttons:
              - title: "Select Option 2"
                payload: "/select_option_2"

=> 한 번의 응답에 text, button, image 등 여러개를 포함시키는 경우.

 

( list 형태 )

responses:
  utter_custom_json:
    - custom:
        data:
          type: "custom_type"
          content:
            - item1
            - item2
            - item3

=> content 는 list / item들은 이 list의 개별요소들

 

( json 형태 )

responses:
  utter_custom_json:
    - custom:
        data:
          type: "custom_type"
          content:
            key1: "value1"
            key2: "value2"

=> content 는 JSON객체

 


 

2. 일반응답 utter_{intent_name}_message

responses:
  utter_greet:
    - text: "Hello! How can I assist you today?"
  utter_goodbye:
    - text: "Goodbye! Have a great day!"

=> 'greet' , 'goodbye' 라는 intent가 있는 경우 

 


 

3. 기타응답 utter_{custom_name})

responses:
  utter_welcome:
    - text: "Welcome to our service!"

=> custom_name에 대한 응답 조건은 action에서 지정.