Do not display upload icon when new chats do not allow it

What does this MR do and why?

Gate the file upload icon on Duo agentic chat using a boolean provided by the backend. This same boolean is also passed to DWS to gate the feature, creating a single source of truth.

Currently the backend logic will gate it on SM based on the instance setting and feature flag, and on SaaS based on the feature flag alone (FE already gates on feature flag, so no logic should change). The SaaS logic will change once the API and UI changes are added for the group setting page.

image.png

References

Admin setting issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/633198

File upload epic: gitlab-org#20481

Backend gate added in: !268832 (merged)

How to set up and validate locally

Instance setting toggle: Ai::Setting.for_organization(Organizations::Organization.default_organization).update!(duo_workflow_file_attachments_enabled: <value>)

Note: Drag and drop should also work when the icon should appear, and do nothing when the icon does not appear.

Note: Feature.disable(:dap_web_chat_file_attachments) should always take precedence over any instance or group setting.

  1. In SM
    1. GITLAB_SIMULATE_SAAS: '0' in gdk.yml and gdk reconfigure; gdk restart
  2. Enable the flag in gdk rails c
    1. Feature.enable(:dap_web_chat_file_attachments)
  3. With instance setting toggled to false, load any page and open the chat bar
  4. You should not be able to see the file upload in the + in the bottom left of the chat panel
    1. Note: with Feature.disable(:dap_web_search) the + will also not appear at all since at least one of web search or file upload is required.
  5. With instance setting toggled to true, you should be able to see it

Optional SaaS test

  1. In SaaS
    1. GITLAB_SIMULATE_SAAS: '1' in gdk.yml and gdk reconfigure; gdk restart
  2. Enable the setting in 1 group, but leave as false in another
group = Group.find_by_name('GitLab Duo')
(group.ai_settings || group.build_ai_settings).update!(duo_workflow_file_attachments_enabled: true)
  1. Apply changes from !269571
    1. curl https://gitlab.com/gitlab-org/gitlab/-/merge_requests/269571.diff | git apply
  2. Open Duo chat on a page in that group
  3. The icon should appear
  4. Open Duo chat chat on another group where the setting is false
  5. The icon should not appear
Edited by Kaveh Nejad

Merge request reports

Loading
Loading