Frontend top namespace level model selection
Recreate/reuse the UI component already built in /admin/ai/duo_self_hosted/features for the top level namespaces.
And create the page below:
Change the interfacing and transaction code accordingly. The GQL interfacing will be looking like this:
Request to get the feature settings:
query getAiFeatureSetting {
aiModelSelectionNamespaceSettings(namespaceId: $ID) {
nodes {
feature
title
mainFeature
selectedModel {
ref
name
}
namespace {
id
name
}
selectableModels {
ref
name
}
defaultModel {
ref
name
}
}
}
}
The mutation for update should look like this:
mutation AiModelSelectionNamespaceUpdate($input: AiModelSelectionNamespaceUpdateInput!) {
aiModelSelectionNamespaceUpdate(input: $input) {
aiFeatureSettings {
feature
title
selectedModel {
ref
name
}
namespace {
id
name
}
selectableModels {
ref
name
}
defaultModel {
ref
name
}
}
}
}
The input for this mutation would be:
{
"input": {
"groupId": "gid://gitlab/Group/95",
"features": ["DUO_CHAT", "CODE_COMPLETIONS"],
"offeredModelRef": "claude_sonnet_3_7_20250219"
}
}
And the response would be:
{
"data": {
"aiModelSelectionNamespaceUpdate": {
"aiFeatureSettings": [
{
"feature": "duo_chat",
"title": "General Chat",
"mainFeature": "GitLab Duo Chat",
"selectedModel": {
"ref": "claude_sonnet_3_7_20250219",
"name": "Claude Sonnet 3.7 - Anthropic"
},
"namespace": {
"id": "gid://gitlab/Group/95",
"name": "Custom Models"
},
"selectableModels": [
{
"ref": "claude_sonnet_3_7_20250219",
"name": "Claude Sonnet 3.7 - Anthropic"
},
{
"ref": "claude_3_5_sonnet_20240620",
"name": "Claude Sonnet 3.5 - Anthropic"
}
],
"defaultModel": {
"ref": "claude_sonnet_3_7_20250219",
"name": "Claude Sonnet 3.7 - Anthropic"
}
}
]
}
}
}
Edited by Patrick Cyiza

