Integrated the AIGenie component into the blob_content_viewer

What does this MR do and why?

The MR integrates the AIGenie component introduced in Added the AiGenie component (!116875 - merged) The integration happens with protection of the two flags, introduced in Added the licenced `explain_code` flag (!117376 - merged):

  • licensed to Ultimate tier feature explain_code, and
  • feature flag explain_code_snippet

Screenshots or screen recordings

Tier explain_code_snippet: false explain_code_snippet: true
FOSS Screenshot_2023-04-12_at_15.21.09 Screenshot_2023-04-12_at_15.21.09
Premium Screenshot_2023-04-12_at_15.21.09 Screenshot_2023-04-12_at_15.21.09
Ultimate Screenshot_2023-04-12_at_15.21.09 Screenshot_2023-04-12_at_15.04.17

How to set up and validate locally

Ultimate tier:

  1. Make sure to add a license to your local GDK
  2. Open a blob (/flightjs/Flight/-/blob/master/lib/debug.js, for example)
  3. Select some content within the blob. Note that there are no changes in the viewer's gutter except for the icons alignment

Screenshot_2023-04-12_at_15.21.09

  1. Enable the explain_code_snippet feature flag:
pry(main)> Feature.enable(:explain_code_snippet)
  1. Reload the blob page and select the code block again
  2. Note the icon in the viewer's gutter aligned with the top line of the selected content

Screenshot_2023-04-12_at_15.04.17

  1. [Optional]: If you have OpenAI API key supplied to your local setup, you could:

    • Enable a couple of feature flags to enable connection to Experimentation API locally:
    pry(main)> Feature.enable(:ai_experimentation_api)
    pry(main)> Feature.enable(:openai_experimentation)
    • click the icon and get the explanation of the selected piece of code

    Screenshot_2023-04-12_at_15.11.40

Free tier:

  1. To simulate the Free tier, follow the instructions
  2. Follow the same steps as above. No matter whether you have explain_code_snippet flag enabled or not, the icon should not be available to you.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #403727

Edited by Denys Mishunov

Merge request reports

Loading