Skip to content
代码片段 群组 项目
未验证 提交 91d0e25e 编辑于 作者: Vitaly Slobodin's avatar Vitaly Slobodin 提交者: GitLab
浏览文件

Merge branch '517748-pass-expanded-chat-sub-features-feature-flag-to-frontend' into 'master'

Pass duoChatSubFeaturesEnabled prop to Duo Self-hosted frontend

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183786



Merged-by: default avatarVitaly Slobodin <vslobodin@gitlab.com>
Approved-by: default avatarVitaly Slobodin <vslobodin@gitlab.com>
Reviewed-by: default avatarEduardo Bonet <ebonet@gitlab.com>
Co-authored-by: default avatarJulie Huang <julhuang@gitlab.com>
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
...@@ -16,9 +16,13 @@ function mountSelfHostedModelsApp() { ...@@ -16,9 +16,13 @@ function mountSelfHostedModelsApp() {
return null; return null;
} }
const { basePath, modelOptions, betaModelsEnabled, duoConfigurationSettingsPath } = JSON.parse( const {
el.dataset.viewModel, basePath,
); modelOptions,
betaModelsEnabled,
duoChatSubFeaturesEnabled,
duoConfigurationSettingsPath,
} = JSON.parse(el.dataset.viewModel);
const router = createRouter(basePath); const router = createRouter(basePath);
...@@ -31,6 +35,7 @@ function mountSelfHostedModelsApp() { ...@@ -31,6 +35,7 @@ function mountSelfHostedModelsApp() {
basePath, basePath,
modelOptions, modelOptions,
betaModelsEnabled, betaModelsEnabled,
duoChatSubFeaturesEnabled,
duoConfigurationSettingsPath, duoConfigurationSettingsPath,
}, },
render(createElement) { render(createElement) {
......
...@@ -35,6 +35,10 @@ def model_choices_as_options ...@@ -35,6 +35,10 @@ def model_choices_as_options
def beta_models_enabled? def beta_models_enabled?
::Ai::TestingTermsAcceptance.has_accepted? ::Ai::TestingTermsAcceptance.has_accepted?
end end
def duo_chat_sub_features_enabled?
Feature.enabled?(:ai_duo_chat_sub_features_settings) # rubocop:disable Gitlab/FeatureFlagWithoutActor -- global feature flag
end
end end
end end
end end
- page_title s_("AdminSelfHostedModels|GitLab Duo Self-Hosted") - page_title s_("AdminSelfHostedModels|GitLab Duo Self-Hosted")
#js-duo-self-hosted{ data: { view_model: { basePath: admin_ai_duo_self_hosted_path, modelOptions: model_choices_as_options, betaModelsEnabled: beta_models_enabled?, duoConfigurationSettingsPath: admin_gitlab_duo_configuration_index_url }.to_json } } #js-duo-self-hosted{ data: { view_model: { basePath: admin_ai_duo_self_hosted_path, modelOptions: model_choices_as_options, betaModelsEnabled: beta_models_enabled?, duoChatSubFeaturesEnabled: duo_chat_sub_features_enabled?, duoConfigurationSettingsPath: admin_gitlab_duo_configuration_index_url }.to_json } }
...@@ -60,4 +60,18 @@ ...@@ -60,4 +60,18 @@
expect(helper.beta_models_enabled?).to be(false) expect(helper.beta_models_enabled?).to be(false)
end end
end end
describe '#duo_chat_sub_features_enabled?' do
it 'returns true if ai_duo_chat_sub_features_settings is enabled' do
stub_feature_flags(ai_duo_chat_sub_features_settings: true)
expect(helper.duo_chat_sub_features_enabled?).to be(true)
end
it 'returns false if ai_duo_chat_sub_features_settings is disabled' do
stub_feature_flags(ai_duo_chat_sub_features_settings: false)
expect(helper.duo_chat_sub_features_enabled?).to be(false)
end
end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册