Browse Source

feat(suggested-solution): Add suggested solution to org level config (#47771)

Priscila Oliveira 1 year ago
parent
commit
bf4ee72899

+ 14 - 0
static/app/data/forms/organizationGeneralSettings.tsx

@@ -42,6 +42,20 @@ const formGroups: JsonFormObject[] = [
           ),
         }),
       },
+      {
+        name: 'aiSuggestedSolution',
+        type: 'boolean',
+        label: t('AI Suggested Solution'),
+        visible: ({features}) => features.has('open-ai-suggestion'),
+        help: tct(
+          'Opt-in to [link:ai suggested solution] to get AI help on how to solve an issue.',
+          {
+            link: (
+              <ExternalLink href="https://docs.sentry.io/product/issues/issue-details/ai-suggested-solution/" />
+            ),
+          }
+        ),
+      },
     ],
   },
 

+ 1 - 0
static/app/types/organization.tsx

@@ -12,6 +12,7 @@ import type {User} from './user';
  * Organization summaries are sent when you request a list of all organizations
  */
 export interface OrganizationSummary {
+  aiSuggestedSolution: boolean;
   avatar: Avatar;
   codecovAccess: boolean;
   dateCreated: string;

+ 7 - 2
static/app/views/issueDetails/resourcesAndMaybeSolutions.tsx

@@ -20,8 +20,11 @@ type Props = {
 export function ResourcesAndMaybeSolutions({event, projectSlug, group}: Props) {
   const organization = useOrganization();
   const config = getConfigForIssueType(group);
+  const displayAiSuggestedSolution =
+    organization.aiSuggestedSolution &&
+    organization.features.includes('open-ai-suggestion');
 
-  if (!config.resources && !organization.features.includes('open-ai-suggestion')) {
+  if (!config.resources && !displayAiSuggestedSolution) {
     return null;
   }
 
@@ -35,7 +38,9 @@ export function ResourcesAndMaybeSolutions({event, projectSlug, group}: Props) {
         {config.resources && (
           <Resources eventPlatform={event.platform} configResources={config.resources} />
         )}
-        <AiSuggestedSolution event={event} projectSlug={projectSlug} />
+        {displayAiSuggestedSolution && (
+          <AiSuggestedSolution event={event} projectSlug={projectSlug} />
+        )}
       </Content>
     </Wrapper>
   );