Duo agentic chat uses persistent file upload from the frontend when flag is enabled

What does this MR do and why?

Reads the duo_workflow_session_file_persistent_uploads and decides which type of file upload to use:

  • When True uses the new persistent file upload which uploads the file to rails (and therefore object storage), and send a download url to the LLM.
  • When False uses the current logic which is to send the Base64 of the image to the LLM directly. This data is then deleted once the LLM views it.

The goal is to switch to using persistent storage only as it comes with several benefits including ability to re-view images (LLM and user), ability to retry/queue messages, survives interrupt errors.

However, we cannot switch over yet as there are still several features to implement, such as file deletion, geo, etc.

References

Persistent upload issue: #632837

Backend API code (This MR depends on the API code): !263192 (merged)

DWS code to download file from URL: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!7549 (merged)

How to set up and validate locally

  1. Feature.enable(:dap_web_chat_file_attachments)
  2. Feature.enable(:duo_workflow_session_file_persistent_uploads)
  3. Open Duo Agentic chat and click the + Icon in the bottom left and send a file with an image attached.
    1. Also test with multiple files
  4. Confirm in the network tab that the file is uploaded to the session_files endpoint
  5. Confirm in the network tab that the url of the image is sent instead of the base64 (View images below)
  6. Disable Feature.disable(:duo_workflow_session_file_persistent_uploads), reload the page, and send another image
  7. Confirm the base64 is now sent instead of the url

To allow Duo to view the images when a url is provided, also checkout gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!7549 (merged) in the AIGW

Flag enabled Flag disabled
image.png image.png

MR acceptance checklist

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

Related to #632837

Edited by Kaveh Nejad

Merge request reports

Loading
Loading