From 1c35774eed11b3ec1396a9b92c43159319cf9c67 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 14 Nov 2023 16:52:22 +0530 Subject: [PATCH] feat: add feature flag for label suggestions --- config/features.yml | 2 ++ .../lib/enterprise/integrations/openai_processor_service.rb | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/config/features.yml b/config/features.yml index 1bb355fc8..7abeb27c1 100644 --- a/config/features.yml +++ b/config/features.yml @@ -61,3 +61,5 @@ enabled: false - name: insert_article_in_reply enabled: false +- name: openai_label_suggestions + enabled: true diff --git a/enterprise/lib/enterprise/integrations/openai_processor_service.rb b/enterprise/lib/enterprise/integrations/openai_processor_service.rb index 8cc481f43..f528135d8 100644 --- a/enterprise/lib/enterprise/integrations/openai_processor_service.rb +++ b/enterprise/lib/enterprise/integrations/openai_processor_service.rb @@ -50,6 +50,8 @@ module Enterprise::Integrations::OpenaiProcessorService end def label_suggestion_body + return unless label_suggestions_enabled? + content = labels_with_messages return nil if content.blank? @@ -64,4 +66,8 @@ module Enterprise::Integrations::OpenaiProcessorService ] }.to_json end + + def label_suggestions_enabled? + hook.account.feature_enabled?(:openai_label_suggestions) + end end