Skip to content

feat(GlDuoChat): support for slash commands

Denys Mishunov requested to merge 2364-duo-chat-slash-commands into main

What does this MR do?

The MR introduces the UI support for the slash commands in Duo Chat. Some notes:

  • the available commands are hardcoded in the component for now
  • the commands' list is shown when the prompt starts with / or if there is any command starting with the current prompt
  • the list allows the keyboard navigation with up/down arrows and Enter as the selection tool
  • the list is filterable and is updated when user types in more characters into a command
  • the component "translates" the slash commands to user-friendly text, using parameters of each command. For example, the prompt /refactor this code … is shown and stored as Refactor this code … user message in the chat

There is a known need for refactoring GlDuoChat component like extracting the whole prompt form, incl. the slash commands introduced here, into a separate component. However, considering this functionality needs to be delivered asap and within %16.6, this kind of refactoring will be taken as the next step.

Screenshots or screen recordings

slash-commands-2

How to test

  1. Go to the Review App (the link is under the pipeline status in the merge request widget below, something like http://2364-duo-chat-slash-commands.34.140.25.101.nip.io/ at the time of writing)
  2. In the Review App, in the left-hand navigation, go to Experimental/duo/chat/duo-chat/Interactive story.
  3. Try playing with the / in the prompt input

Integration merge requests

Does this MR meet the acceptance criteria?

This checklist encourages the authors, reviewers, and maintainers of merge requests (MRs) to confirm changes were analyzed for conformity with the project's guidelines, security and accessibility.

Toggle the acceptance checklist

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidelines.
  • If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened (see integration merge requests above).
  • Added the ~"component:*" label(s) if applicable.

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • Security reports checked/validated by a reviewer from the AppSec team

Accessibility

If this MR adds or modifies a component, take a few moments to review the following:

  • All actions and functionality can be done with a keyboard.
  • Links, buttons, and controls have a visible focus state.
  • All content is presented in text or with a text equivalent. For example, alt text for SVG, or aria-label for icons that have meaning or perform actions.
  • Changes in a component’s state are announced by a screen reader. For example, changing aria-expanded="false" to aria-expanded="true" when an accordion is expanded.
  • Color combinations have sufficient contrast.

Closes #2364 (closed)

Edited by Denys Mishunov

Merge request reports

Loading