[go: up one dir, main page]

Skip to content

Unauthorize model selection with Amazon Q

What does this MR do and why?

There is no need for anything model selection feature when AmazonQ is enabled for a an instance. Therefore we need to hide it in all the related menus:

  • Model Selection user default namespace: http://gdk.test:3000/-/profile/preferences
  • Namespace Model Selection menu for SAAS: http://gdk.test:3000/groups/gitlab-duo/-/settings/gitlab_duo/model_selection
  • Instance Model Selection menu: http://gdk.test:3000/admin/gitlab_duo/self_hosted/features

How to set up and validate locally

Self-managed deployments

prequisite:

  • Ultimate or Premium offline license.

What to do:

  • Run GDK on non-SAAS mode: GITLAB_SIMULATE_SAAS=0 gdk start
  • Run the following setup script to get Duo Enterprise add on: GITLAB_SIMULATE_SAAS=0 bundle exec 'rake gitlab:duo:setup'

When Amazon Q is disabled

You should be to go to the page http://gdk.test:3000/admin/gitlab_duo/self_hosted/features.

When Amazon Q is enabled

To enable Amazon Q programatically you can apply these diff:

diff --git a/ee/lib/ai/amazon_q.rb b/ee/lib/ai/amazon_q.rb
index 066392a889aa55..7a6dbdad927a01 100644
--- a/ee/lib/ai/amazon_q.rb
+++ b/ee/lib/ai/amazon_q.rb
@@ -17,6 +17,7 @@ def feature_available?
       end

       def connected?
+        return true
         return false unless feature_available?

         ai_settings.amazon_q_ready

http://gdk.test:3000/admin/gitlab_duo/self_hosted/features should return a 404.

SAAS deployment

prequisite:

  • An active online cloud, Ultimate license.

What to do:

  1. Start GDK in saas mode GITLAB_SIMULATE_SAAS=1 gdk start
  2. Enable the ai_model_switching feature flag by visiting http://gdk.test:3000/rails/features/
  3. Run the Duo setup rake task GITLAB_SIMULATE_SAAS=1 bundle exec 'rake gitlab:duo:setup' to seed DB with a Duo test group (it's called gitlab-duo).

When Amazon Q is disabled

  • Namespace Model Selection menu setting http://gdk.test:3000/groups/gitlab-duo/-/settings/gitlab_duo/model_selection should be accessible.
  • You should also be able to see default Duo namespace setting at http://gdk.test:3000/-/profile/preferences

When Amazon Q is enabled

To enable Amazon Q programatically you can apply these diff:

diff --git a/ee/lib/ai/amazon_q.rb b/ee/lib/ai/amazon_q.rb
index 066392a889aa55..7a6dbdad927a01 100644
--- a/ee/lib/ai/amazon_q.rb
+++ b/ee/lib/ai/amazon_q.rb
@@ -17,6 +17,7 @@ def feature_available?
       end

       def connected?
+        return true
         return false unless feature_available?

         ai_settings.amazon_q_ready

Related to #558225

Edited by Patrick Cyiza

Merge request reports

Loading