From 23b78d9a001bb5a50e318cb1c02a3ff695392ebc Mon Sep 17 00:00:00 2001 From: Claas Augner <495429+caugner@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:35:20 +0100 Subject: [PATCH] fix(ai-help): use GPT-3.5 for free users (#10205) --- client/src/plus/ai-help/banners.tsx | 32 +++++++++++++++++++ client/src/plus/ai-help/index.tsx | 15 +++------ client/src/plus/ai-help/landing.scss | 2 +- client/src/plus/ai-help/landing.tsx | 2 +- .../offer-overview-feature/index.tsx | 5 +-- copy/plus/features/ai-help.md | 13 ++++---- 6 files changed, 49 insertions(+), 20 deletions(-) diff --git a/client/src/plus/ai-help/banners.tsx b/client/src/plus/ai-help/banners.tsx index 2aab2d47fea0..aa4ddf9431e4 100644 --- a/client/src/plus/ai-help/banners.tsx +++ b/client/src/plus/ai-help/banners.tsx @@ -1,6 +1,38 @@ +import { useMemo } from "react"; import { AI_HELP } from "../../telemetry/constants"; +import { Icon } from "../../ui/atoms/icon"; import { SignUpLink } from "../../ui/atoms/signup-link"; +import { useUserData } from "../../user-context"; import { PlusLoginBanner } from "../common/login-banner"; +import { isPlusSubscriber } from "../../utils"; + +export function AiHelpBanner() { + const user = useUserData(); + + const isSubscriber = useMemo(() => isPlusSubscriber(user), [user]); + + return ( +
+

+ + + {isSubscriber + ? "GPT-4-powered AI Help." + : "Supercharge your AI Help experience with our paid subscriptions."} + +

+

+ {isSubscriber + ? "Now with chat history, enhanced context, and optimized prompts." + : "Upgrade to MDN Plus 5 or MDN Supporter 10 to unlock the potential of GPT-4-powered AI Help."} +

+

This is a beta feature.

+ {!isSubscriber && ( + + )} +
+ ); +} export function AiLoginBanner() { return ( diff --git a/client/src/plus/ai-help/index.tsx b/client/src/plus/ai-help/index.tsx index 41fad629caf0..9225fdf8a76f 100644 --- a/client/src/plus/ai-help/index.tsx +++ b/client/src/plus/ai-help/index.tsx @@ -19,7 +19,7 @@ import { Quota, useAiChat, } from "./use-ai"; -import { AiUpsellBanner } from "./banners"; +import { AiHelpBanner, AiUpsellBanner } from "./banners"; import { useUserData } from "../../user-context"; import Container from "../../ui/atoms/container"; import { FeatureId, MDN_PLUS_TITLE } from "../../constants"; @@ -57,6 +57,7 @@ import { MESSAGE_SEARCHED, } from "./constants"; import InternalLink from "../../ui/atoms/internal-link"; +import { isPlusSubscriber } from "../../utils"; type Category = "apis" | "css" | "html" | "http" | "js" | "learn"; @@ -124,14 +125,7 @@ function AIHelpAuthenticated() {

-
-

- - GPT-4-powered AI Help. -

-

Now with chat history, enhanced context, and optimized prompts.

-

This is a beta feature.

-
+
@@ -526,6 +520,7 @@ export function AIHelpInner() { const { queuedExamples, setQueue } = useUIStatus(); const { hash } = useLocation(); const gleanClick = useGleanClick(); + const user = useUserData(); const { isFinished, @@ -551,7 +546,7 @@ export function AIHelpInner() { const isQuotaLoading = quota === undefined; const hasQuota = !isQuotaLoading && quota !== null; const hasConversation = messages.length > 0; - const gptVersion = "GPT-4"; + const gptVersion = isPlusSubscriber(user) ? "GPT-4" : "GPT-3.5"; function isQuotaExceeded(quota: Quota | null | undefined): quota is Quota { return quota ? quota.remaining <= 0 : false; diff --git a/client/src/plus/ai-help/landing.scss b/client/src/plus/ai-help/landing.scss index 7ad1f86bfab2..107f5636ff86 100644 --- a/client/src/plus/ai-help/landing.scss +++ b/client/src/plus/ai-help/landing.scss @@ -64,7 +64,7 @@ @media screen and (min-width: $screen-md) { flex-direction: row; - gap: 4rem; + gap: 3rem; justify-content: space-between; } diff --git a/client/src/plus/ai-help/landing.tsx b/client/src/plus/ai-help/landing.tsx index 3b88a52cabb2..59421230778f 100644 --- a/client/src/plus/ai-help/landing.tsx +++ b/client/src/plus/ai-help/landing.tsx @@ -51,7 +51,7 @@ export function AIHelpLanding() {

GPT-4-Powered

-

Now based on GPT-4 for peak performance

+

Unlock GPT-4's potential with our paid subscriptions

diff --git a/client/src/plus/offer-overview/offer-overview-feature/index.tsx b/client/src/plus/offer-overview/offer-overview-feature/index.tsx index c1cdc46b3665..c976aade6ff0 100644 --- a/client/src/plus/offer-overview/offer-overview-feature/index.tsx +++ b/client/src/plus/offer-overview/offer-overview-feature/index.tsx @@ -1,5 +1,6 @@ import { Button } from "../../../ui/atoms/button"; import "./index.scss"; +import screenshotAiHelp from "../../../../public/assets/ai-help/ai-help_light.png"; function OfferOverviewFeature({ id, img, imgAlt, children }) { return ( @@ -23,14 +24,14 @@ function OfferOverviewFeature({ id, img, imgAlt, children }) { export default function OfferOverviewFeatures() { return (
- +

AI Help

Get real-time assistance and support.

No need to scroll through page after page to find your answers. Introducing an AI assistant that can answer all your web development - questions in real time. Powered by OpenAI GPT 3.5. + questions in real time. Powered by OpenAI GPT-3.5 and GPT-4.