[go: up one dir, main page]

Refactor model selector service

you didn't update the description, just give me the text

Duo:

What does this MR do and why?

This MR refactors the FetchModelDefinitionsService to handle feature-specific model parsing internally, eliminating code duplication in GraphQL resolvers.

Before: Each resolver duplicated ~20 lines of logic to parse raw model definitions and filter by feature settings.

After: The service accepts a feature_setting parameter and returns pre-formatted results with default_model and selectable_models.

Benefits:

  • Removes code duplication between resolvers
  • Centralizes model parsing logic in the service layer
  • Improves maintainability - future changes only need to be made in one place

How to set up and validate locally

  1. Test the GraphQL resolver still returns the same model data:

    query { aiChatAvailableModels(rootNamespaceId: "gid://gitlab/Group/1") { defaultModel { name, ref } selectableModels { name, ref } } }

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.

Edited by Tetiana Chupryna

Merge request reports

Loading