How can i clear the chat input-box after sending the message(from suggestion) in botframework webchat?

前端 未结 1 1283
南方客
南方客 2021-01-17 05:15

i\'m working on a bot application using react js and botframework webchat. The thing is that i want to clear the text input box (from where msgs are sent) after sending the

相关标签:
1条回答
  • 2021-01-17 05:19

    The chat input box is called the send box in Web Chat. Clearing the send box is just setting the send box with an empty string. This is done automatically when you click on the send button normally. You can see in the submit send box saga that submitting the send box means performing two actions: sending the message and setting the send box.

    if (sendBoxValue) {
      yield put(sendMessage(sendBoxValue.trim(), method, { channelData }));
      yield put(setSendBox(''));
    }
    

    This means that if you use the SUBMIT_SEND_BOX action then the send box will be cleared automatically. Of course, if you want that to work with your autocomplete component then you'll need to set the send box with the autocompleted text before you submit it. Your other option is to just use the SET_SEND_BOX action with an empty string after you send the message.

    0 讨论(0)
提交回复
热议问题