Skip to content

Add trigger and parent consumer to consumer type

What does this MR do and why?

These are just 2 attributes that the FE needs to be able to use to show in the UI.

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  • Enable the global_ai_catalog and ai_catalog_flows flags

  • Create a flow:

mutation {
  aiCatalogFlowCreate(
    input: {name: "New Flow 20251107", description: "Test flow", projectId: "gid://gitlab/Project/1000000", public: true, definition:  "version: v1\nenvironment: ambient\ncomponents:\n  - name: main_agent\n    type: AgentComponent\n    prompt_id: test_prompt\nrouters: []\nflow:\n  entry_point: main_agent"}
  ) {
    errors
    item {
      id
    }
  }
}
  • Create a group consumer:
mutation {
  aiCatalogItemConsumerCreate(
    input: {itemId: "gid://gitlab/Ai::Catalog::Item/103", target: {groupId: "gid://gitlab/Group/1000000"} }
  ) {
    itemConsumer {
      id
      serviceAccount { id username }
    }
    errors
  }
}
  • Create a project consumer:
mutation {
  aiCatalogItemConsumerCreate(
    input: {itemId: "gid://gitlab/Ai::Catalog::Item/<FLOW ID>", target: {projectId: "gid://gitlab/Project/1000000"}, parentItemConsumerId: "gid://gitlab/Ai::Catalog::ItemConsumer/<GROUP CONSUMER CREATED ABOVE>", triggerTypes: ["mention"]}
  ) {
    itemConsumer {
      id
      serviceAccount { id username }
    }
    errors
  }
}
  • Query the items item:
query {
  aiCatalogItemConsumer(id: "gid://gitlab/Ai::Catalog::ItemConsumer/<PROJECT CONSUMER ID>") {
    id
    item {
      id
      name
      description
    }
    flowTrigger {
      id
      eventTypes
    }
    parentItemConsumer {
      id
    }
  }
}

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 #579093 (closed)

Edited by Keeyan Nejad

Merge request reports

Loading