BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

DRAFT: Add like/dislike button

Open compulim opened this issue 10 months ago • 2 comments

Fixes #

Changelog Entry

Description

Design

Ideas

  • We could simply look at the originating activity, and it would tell which button is actually pressed
  • We need some infrastructure to "modify the originating activity when we are processing more activities."
    • Somehow, a client-side "edit activity" feature
  • We will use the entities field and the LikeAction and DislikeAction
  • We will use W3C Hydra and URL Template to create the content body
    • We could build a form, or allow bot/web devs to build an AC-in-Markdown that would fulfill the form based on PropertyValueSpecification or HTML Content Validation
    • I believe PropertyValueSpecification and HTML Content Validation can be converged rather easily
  • We will have a special protocol handler for ms-directline://postback
    • In this PR or future, we could enable <form action="ms-directline://postback"> in Markdown too

To-do

(This is draft.)

  • [ ] Supports <form action="ms-directline://postback"> in Markdown as the container of activities
    • In future, we may consider this for container of Adaptive Cards
    • (Optional) If the activity content is non-interactive, we may not add <form>
  • [ ] Improves usePerformCardAction et al. to handle <form> submissions
    • May also need upgrade suggested actions and other existing card action containers
  • [ ] Uses use-schema-org-action for implementing the actions
  • [ ] Implements UI in Fluent, already done in white-label
    • Need links to Figma
  • [ ] Implements a facility to edit previous activities
    • Goal: useActivities() should return edited result
    • For example, modify the bot activity with PotentialActionStatus -> CompletedActionStatus

Specific Changes

-

  • [ ] I have added tests and executed them locally
  • [ ] I have updated CHANGELOG.md
  • [ ] I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • [ ] Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • [ ] Browser and platform compatibilities reviewed
  • [ ] CSS styles reviewed (minimal rules, no z-index)
  • [ ] Documents reviewed (docs, samples, live demo)
  • [ ] Internationalization reviewed (strings, unit formatting)
  • [ ] package.json and package-lock.json reviewed
  • [ ] Security reviewed (no data URIs, check for nonce leak)
  • [ ] Tests reviewed (coverage, legitimacy)

compulim avatar Jan 03 '25 21:01 compulim

@compulim are you aware of the feature that Teams includes? Where you can set 'feedbackLoopEnabled' in channelData?See https://github.com/microsoft/teams-ai/blob/main/getting-started/CONCEPTS/POWERED-BY-AI.md#feedback-loop. This will render a dialog in Teams, which will return a { name: "message/submitAction", type: "invoke" } with the feedback in the value property.

Would be great if these like/dislike buttons could be standardized across the channels supported by the Bot Service (or a way to map 'feedbackLoopEnabled' to way of working in BotFramework-Webchat).

iMicknl avatar Jan 06 '25 09:01 iMicknl

@compulim are you aware of the feature that Teams includes? Where you can set 'feedbackLoopEnabled' in channelData?See https://github.com/microsoft/teams-ai/blob/main/getting-started/CONCEPTS/POWERED-BY-AI.md#feedback-loop. This will render a dialog in Teams, which will return a { name: "message/submitAction", type: "invoke" } with the feedback in the value property.

Would be great if these like/dislike buttons could be standardized across the channels supported by the Bot Service (or a way to map 'feedbackLoopEnabled' to way of working in BotFramework-Webchat).

AFAIK, it is a quick solution: a simple flag to enable the dialog, without ability to put a payload for more debugging information for prompt engineers.

Invoke activity activity isn't supported across the board. The URL handler design here should be able to send the response via postback or invoke, depending on what the bot choose in the original payload.

compulim avatar Jan 06 '25 22:01 compulim