From 50ba6b55fb7d158d4aab77a2d4658fe51df7e850 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Fri, 18 Oct 2024 09:17:55 -0700 Subject: [PATCH] Show banner if gen AI consent --- .../app/components/events/autofix/useAutofixSetup.tsx | 1 + .../issueDetails/resourcesAndPossibleSolutions.tsx | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/static/app/components/events/autofix/useAutofixSetup.tsx b/static/app/components/events/autofix/useAutofixSetup.tsx index 23dc3204677301..a7e18a0f4d04e4 100644 --- a/static/app/components/events/autofix/useAutofixSetup.tsx +++ b/static/app/components/events/autofix/useAutofixSetup.tsx @@ -47,6 +47,7 @@ export function useAutofixSetup( canStartAutofix: Boolean( queryData.data?.integration.ok && queryData.data?.genAIConsent.ok ), + genAIConsent: Boolean(queryData.data?.genAIConsent.ok ?? false), canCreatePullRequests: Boolean(queryData.data?.githubWriteIntegration.ok), }; } diff --git a/static/app/views/issueDetails/resourcesAndPossibleSolutions.tsx b/static/app/views/issueDetails/resourcesAndPossibleSolutions.tsx index 63b76a6acacd54..7dd4c9d9b8be25 100644 --- a/static/app/views/issueDetails/resourcesAndPossibleSolutions.tsx +++ b/static/app/views/issueDetails/resourcesAndPossibleSolutions.tsx @@ -3,6 +3,7 @@ import styled from '@emotion/styled'; import {AiSuggestedSolution} from 'sentry/components/events/aiSuggestedSolution'; import {Autofix} from 'sentry/components/events/autofix'; +import {useAutofixSetup} from 'sentry/components/events/autofix/useAutofixSetup'; import {Resources} from 'sentry/components/events/interfaces/performance/resources'; import {t} from 'sentry/locale'; import ConfigStore from 'sentry/stores/configStore'; @@ -51,10 +52,14 @@ export function ResourcesAndPossibleSolutions({event, project, group}: Props) { const config = getConfigForIssueType(group, project); const isSelfHostedErrorsOnly = ConfigStore.get('isSelfHostedErrorsOnly'); const isSampleError = useIsSampleEvent(); - // NOTE: Autofix is for INTERNAL testing only for now. + const {genAIConsent} = useAutofixSetup({ + groupId: group.id, + }); + const displayAiAutofix = - organization.features.includes('autofix') && - organization.features.includes('issue-details-autofix-ui') && + ((organization.features.includes('autofix') && + organization.features.includes('issue-details-autofix-ui')) || + genAIConsent) && !shouldShowCustomErrorResourceConfig(group, project) && config.autofix && hasStacktraceWithFrames(event) &&