Skip to content

Allow User for resource_id on chat action

Nicolas Dular requested to merge nd/chat-support-user-resource into master

What does this MR do and why?

Allow User for resource_id on chat action

This allows the User to be a resource_id for the aiAction chat input. This is a temporary solution as we want to make resource_id optional. Until we're able to do so, we allow to use the resource to be the current_user.

This is how we also do it for TanukiBot right now.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Set up the local environment for Anthropic https://docs.gitlab.com/ee/development/ai_features.html#test-ai-features-locally
  2. Enable the feature flag Feature.enable(:gitlab_duo)
  3. Test it with the GraphQL mutation and message history:
# get the messages after submitting the mutation
query messages {
  aiMessages {
    nodes {
      id
      requestId
      content
      errors
      role
    }
  }
}

mutation chat {
  aiAction(input:{chat:{resourceId:"gid://gitlab/User/1", content:"What is the title from the issue http://gdk.test:3000/flightjs/Flight/-/issues/37?"}}) {
    requestId
    errors
  }
}

NOTE: Expectations is not that the chat history will respond with the info yet, this is WIP from another MR.

MR acceptance checklist

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

Edited by Nicolas Dular

Merge request reports