KI-Campus / chatbot-kim

Source code for the AI Campus Chatbot
https://ki-campus.org
MIT License
4 stars 1 forks source link

[26.07.2023]: [Disable Text Input for Buttons] #36

Open theresazobel opened 1 year ago

theresazobel commented 1 year ago

Hello,

I am now planning to disable the text input when buttons are available.

@TabeaOt @russaa Please comment on special cases, when you do not want the text input to be disabled on the button showing.

TabeaOt commented 1 year ago

Buttons with text input enabled:

Recommender Form:

theresazobel commented 1 year ago

das versteh ich jetzt nicht ganz. Das sind doch alles Buttons - warum braucht man da noch den text input?

TabeaOt commented 1 year ago

Das sind die Label/ Titel der Buttons. Text input bezogen auf deine vorherige Formulierung, also dort soll eine freie Texteingabe möglich sein, damit der User beispielsweise die Befragung abbrechen kann oder FAQs/ Zwischenfragen stellen kann, etc.

theresazobel commented 1 year ago

Ich überlege gerade, ob das denn so sinnvoll ist. Das haben wir beispielsweise in anderen Forms nicht. Würde nicht ein Button "Zurück" oder ähnlich mehr Sinn machen um die Konversation zu unterbrechen?

Edit: vielleicht auch einen "Etwas anderes"-Button?

russaa commented 1 year ago

I would prefer a solution that would allow to enable/disable the input-field based on additional (i.e. custom) data that is sent by Rasa:

E.g. generally disable input when (active) buttons are displayed, but when buttons are sent to the frontend with custom data like {"on_buttons": {"disable_input": false}}, the text input stays enabled.

E.g. in yaml something like

responses:
  utter_greet:
  - text: "Hey! How are you?"
    buttons:
    - title: "great"
      payload: "/mood_great"
    - title: "super sad"
      payload: "/mood_sad"
  - custom:
      on_buttons:
        disable_input: false

(disclaimer: I haven't tested the yaml solution, but I am 95% sure that it should work that way)

or in a custom action implementation something like

buttons = [{"title": "great", "payload": "/mood_great"}, {"title": "sad", "payload": "/mood_sad"}]
custom = [{"on_buttons": {"disable_input": False}}]
dispatcher.utter_message(text="Hey! How are you?", buttons=buttons, custom=custom)

which (in both cases) would result in JSON message (from the Rasa REST API) like

[
  {"recipient_id": "...",
    "text": "Hey! How are you?",
    "buttons": [
      {"title": "great", "payload": "/mood_great"},
      {"title": "sad", "payload": "/mood_sad"}
  ]},
  {"recipient_id": "...", 
    "custom": [
      {"on_buttons": {"disable_input": false}}
  ]}
]

... which the frontend would then interpret, that is, it should process it so that it "disables the input-field-disabling", i.e. leave the input-field enabled in this case (when custom data {"on_buttons": {"disable_input": false}} is sent), even though active buttons are displayed.

theresazobel commented 1 year ago

The custom signals make sense. However, as suggested in the meeting I would add an "Ich habe ein andere Anliegen" button to the recommender form with a custom signal ( disable_input: true). When clicked, the user input is enabled again and the user can type out a message. We can additionally send a message from the frontend after clicking saying "Alles klar, wie kann ich dir helfen" so the user sees that something changed.

Should we do it like that?

russaa commented 1 year ago

We can additionally send a message from the frontend after clicking saying "Alles klar, wie kann ich dir helfen" so the user sees that something changed.

I would prefer, not sending anything back to rasa when the user clicks this button:
we would need to adjust all stories & retrain for this special case (otherwise rasa would predict wrong user-/system-turns on receiving such a message as user interaction).

(messages such as "Alles klar, wie kann ich dir helfen" could be automatically be inserted by the web interface without sending anything to rasa)

So I would prefer either no message at all to rasa, or --if there really must be such a message sent to rasa-- only for logging i.e. not as a user interaction (although I don't know if there is such an endpoint at the rasa API or message format that would allow only logging without triggering an interaction).

theresazobel commented 1 year ago

@russaa okay ich think we are telking about the same thing :) I will show a message just from the frontend when this button is clicked + enabling the input field and will nit send anything back to rasa.