Skip to content

Consolidate Self-hosted models and AI feature settings into a tabbed Custom Models component

Julie Huang requested to merge 493581-add-unified-custom-models-component into master

What does this MR do and why?

This MR consolidates the Self-hosted models pages and AI Feature settings into a single Custom Models component in preparation for transitioning over to the unified Duo Settings page.

See Figma

Out of Scope:

  • This MR does not connect the component to the unified Duo page as it's being built in parallel and not ready yet. The component will be dropped in separately when the page is ready for it. Follow validation instructions below to see component locally.
  • Removing the "Self-hosted models" and "Features" button from admin menu

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Self-hosted Models

Before After
Screenshot_2024-10-03_at_1.30.12_PM Screenshot_2024-10-08_at_1.14.19_PM

AI Feature Settings

Before After
Screenshot_2024-10-03_at_1.30.35_PM Screenshot_2024-10-08_at_1.17.04_PM

Screen Recording:

Screen_Recording_2024-10-08_at_1.24.42_PM

How to set up and validate locally

Prequisites

You will need an active GitLab ultimate license.

  1. Start GDK instance in self-managed mode:

GITLAB_SIMULATE_SAAS=0 && gdk start

  1. In the rails console, enable Code Suggestions and the custom models experiment:
Feature.enable(:ai_custom_model)
Feature.enable(:custom_models_vue_app)
Feature.enable(:custom_models_feature_settings_vue_app)
ApplicationSetting.first.update(duo_features_enabled: true)
  1. Apply the following patch to render component (code is just for validation) show_custom_models.patch
diff --git a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue
index dd6d09eab1e5..bb0f1dfcc1a0 100644
--- a/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue
+++ b/ee/app/assets/javascripts/usage_quotas/code_suggestions/components/code_suggestions_usage.vue
@@ -6,6 +6,7 @@ import PageHeading from '~/vue_shared/components/page_heading.vue';
 import { isInFuture } from '~/lib/utils/datetime/date_calculation_utility';
 import getAddOnPurchasesQuery from 'ee/usage_quotas/add_on/graphql/get_add_on_purchases.query.graphql';
 import getCurrentLicense from 'ee/admin/subscriptions/show/graphql/queries/get_current_license.query.graphql';
+import SelfHostedDuoConfiguration from 'ee/pages/admin/ai/custom_models/self_hosted_duo_configuration.vue';

 import {
   ADD_ON_CODE_SUGGESTIONS,
@@ -52,6 +53,7 @@ export default {
     HealthCheckList,
     GlBadge,
     GlAlert,
+    SelfHostedDuoConfiguration,
     GlSprintf,
     PageHeading,
   },
@@ -281,16 +283,19 @@ export default {
             @error="handleAddOnPurchaseFetchError"
           />
         </section>
-        <saas-add-on-eligible-user-list
-          v-if="isSaaS"
-          :add-on-purchase-id="addOnPurchase.id"
-          :duo-tier="duoTier"
-        />
-        <self-managed-add-on-eligible-user-list
-          v-else
-          :add-on-purchase-id="addOnPurchase.id"
-          :duo-tier="duoTier"
-        />
+        <!-- Hide user list to mimic unified Duo page
+          <saas-add-on-eligible-user-list
+            v-if="isSaaS"
+            :add-on-purchase-id="addOnPurchase.id"
+            :duo-tier="duoTier"
+          />
+          <self-managed-add-on-eligible-user-list
+            v-else
+            :add-on-purchase-id="addOnPurchase.id"
+            :duo-tier="duoTier"
+          />
+        -->
+        <section class="gl-pt-2"><self-hosted-duo-configuration /></section>
       </section>
       <error-alert
         v-else-if="addOnPurchaseFetchError"

Test it!

  1. Log in as an admin
  2. Visit the page Admin Area > AI-Powered Features > Gitlab Duo
    Screenshot_2024-10-03_at_1.34.07_PM
  3. You should see a "Custom Models" section at the bottom half of the page (as per screengrabs)
  4. Self-hosted models tab
    • You should be able to add/edit/delete self-hosted models
  5. AI feature settings tab
    • You should be able to update AI features

Related to #493581 (closed)

Edited by Julie Huang

Merge request reports

Loading