🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat: add intro dialog for Fast (Preview) toggle (#12543)
Lotte Verheyden6a82c24134b1
diff --git a/web/public/assets/v4-beta-intro.jpg b/web/public/assets/v4-beta-intro.jpgnew file mode 100644index 0000000000..541adb3b8dBinary files /dev/null and b/web/public/assets/v4-beta-intro.jpg differdiff --git a/web/src/features/events/components/V4BetaIntroDialog.tsx b/web/src/features/events/components/V4BetaIntroDialog.tsxnew file mode 100644index 0000000000..d5980abe50--- /dev/null+++ b/web/src/features/events/components/V4BetaIntroDialog.tsx@@ -0,0 +1,82 @@+import { Button } from "@/src/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogBody,+ DialogFooter,+} from "@/src/components/ui/dialog";++export function V4BetaIntroDialog({+ open,+ onConfirm,+}: {+ open: boolean;+ onConfirm: () => void;+}) {+ return (+ <Dialog open={open} onOpenChange={(o) => !o && onConfirm()}>+ <DialogContent+ className="[&>div:last-child]:hidden"+ aria-label="Welcome to a faster Langfuse"+ >+ <DialogBody>+ {/* eslint-disable-next-line @next/next/no-img-element */}+ <img+ src="/assets/v4-beta-intro.jpg"+ alt="Langfuse gets Faster — performance comparison showing 5x to 165x speedups"+ className="w-full rounded-md"+ />+ <ul className="flex flex-col gap-3">+ <li className="text-sm text-muted-foreground">+ <span className="font-medium text-foreground">+ Welcome to a faster Langfuse.+ </span>{" "}+ This is what you can expect:+ </li>+ <li className="text-sm text-muted-foreground">+ <span className="block font-medium text-foreground">+ Everything loads faster.+ </span>{" "}+ We've rebuilt the data model around observations rather than+ traces, which means charts, filters, and APIs are dramatically+ faster, especially as your data grows.+ </li>+ <li className="text-sm text-muted-foreground">+ <span className="block font-medium text-foreground">+ Your traces are still here.+ </span>{" "}+ The default view now shows all observations. To see a table with+ just your root traces, filter by{" "}+ <span className="font-medium">+ Is Root Observation → True+ </span>+ . Tip: save that as an org-wide saved view so your whole team+ starts from the same place.+ </li>+ <li className="text-sm text-muted-foreground">+ <span className="block font-medium text-foreground">+ Saved views are now shared.+ </span>{" "}+ You can create and share views across your organization.+ </li>+ </ul>+ <p className="mt-4 text-sm text-muted-foreground">+ This is currently in beta. Things may look a little different as we+ roll it out.+ </p>+ </DialogBody>+ <DialogFooter className="items-center sm:justify-between">+ <a+ href="https://langfuse.com/docs/v4"+ target="_blank"+ rel="noopener noreferrer"+ className="text-sm font-medium text-primary hover:underline"+ >+ Read the v4 docs →+ </a>+ <Button onClick={onConfirm}>Understood →</Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}diff --git a/web/src/features/events/components/V4BetaPromoBanner.tsx b/web/src/features/events/components/V4BetaPromoBanner.tsxindex 3ae31ddb93..bece766edd 100644--- a/web/src/features/events/components/V4BetaPromoBanner.tsx+++ b/web/src/features/events/components/V4BetaPromoBanner.tsx@@ -10,6 +10,7 @@ import {useTopBannerRegistration,} from "@/src/features/top-banner";import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";+import { V4BetaIntroDialog } from "@/src/features/events/components/V4BetaIntroDialog";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { useLangfuseCloudRegion } from "@/src/features/organizations/hooks";@@ -31,7 +32,13 @@ const PAGE_MESSAGES: Record<string, string> = {export function V4BetaPromoBanner() {const router = useRouter();const session = useSession();- const { isBetaEnabled, setBetaEnabled, isLoading } = useV4Beta();+ const {+ isBetaEnabled,+ enableWithIntro,+ showIntroDialog,+ confirmIntroDialog,+ isLoading,+ } = useV4Beta();const capture = usePostHogClientCapture();const { isLangfuseCloud } = useLangfuseCloudRegion();const { getTopBannerOffset } = useTopBanner();@@ -67,7 +74,12 @@ export function V4BetaPromoBanner() {});if (!isVisible) {- return null;+ return (+ <V4BetaIntroDialog+ open={showIntroDialog}+ onConfirm={confirmIntroDialog}+ />+ );}return (@@ -85,7 +97,7 @@ export function V4BetaPromoBanner() {<buttonclassName="inline cursor-pointer font-semibold underline underline-offset-2"onClick={() => {- setBetaEnabled(true, {+ enableWithIntro({onSuccess: () => {capture("sidebar:v4_beta_toggled", { enabled: true });},@@ -116,6 +128,10 @@ export function V4BetaPromoBanner() {<X className="h-4 w-4" /></Button></div>+ <V4BetaIntroDialog+ open={showIntroDialog}+ onConfirm={confirmIntroDialog}+ /></div>);}diff --git a/web/src/features/events/components/V4BetaSidebarToggle.tsx b/web/src/features/events/components/V4BetaSidebarToggle.tsxindex 0adb2fa9ba..5ca2e906d8 100644--- a/web/src/features/events/components/V4BetaSidebarToggle.tsx+++ b/web/src/features/events/components/V4BetaSidebarToggle.tsx@@ -7,6 +7,7 @@ import {TooltipTrigger,} from "@/src/components/ui/tooltip";import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";+import { V4BetaIntroDialog } from "@/src/features/events/components/V4BetaIntroDialog";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { ZapIcon } from "lucide-react";@@ -15,53 +16,76 @@ const PREVIEW_FAST_DESCRIPTION =const PREVIEW_FAST_DESCRIPTION_ID = "preview-fast-toggle-description";export function V4BetaSidebarToggle() {- const { isBetaEnabled, setBetaEnabled, isLoading } = useV4Beta();+ const {+ isBetaEnabled,+ setBetaEnabled,+ enableWithIntro,+ showIntroDialog,+ confirmIntroDialog,+ isLoading,+ } = useV4Beta();const capture = usePostHogClientCapture();+ const handleToggle = (enabled: boolean) => {+ if (enabled) {+ enableWithIntro({+ onSuccess: () => {+ capture("sidebar:v4_beta_toggled", { enabled: true });+ },+ });+ } else {+ setBetaEnabled(false, {+ onSuccess: () => {+ capture("sidebar:v4_beta_toggled", { enabled: false });+ },+ });+ }+ };+return (- <SidebarMenuButton- asChild- className="justify-between gap-1.5 group-data-[collapsible=icon]:justify-center"- >- <div>- <div className="flex min-w-0 flex-1 items-center gap-2 group-data-[collapsible=icon]:hidden">- <ZapIcon className="h-4 w-4 shrink-0" />- <Label- htmlFor="v4-beta-toggle"- className="block min-w-0 flex-1 cursor-pointer truncate text-sm font-normal"- >- Fast (Preview)- </Label>- </div>- <Tooltip>- <TooltipTrigger asChild>- <div className="flex shrink-0">- <Switch- id="v4-beta-toggle"- size="sm"- checked={isBetaEnabled}- onCheckedChange={(enabled) => {- setBetaEnabled(enabled, {- onSuccess: () => {- capture("sidebar:v4_beta_toggled", { enabled });- },- });- }}- disabled={isLoading}- className="shrink-0"- aria-label="Toggle Preview (fast)"- aria-describedby={PREVIEW_FAST_DESCRIPTION_ID}- />- </div>- </TooltipTrigger>- <TooltipContent side="right" className="max-w-xs text-xs">+ <>+ <SidebarMenuButton+ asChild+ className="justify-between gap-1.5 group-data-[collapsible=icon]:justify-center"+ >+ <div>+ <div className="flex min-w-0 flex-1 items-center gap-2 group-data-[collapsible=icon]:hidden">+ <ZapIcon className="h-4 w-4 shrink-0" />+ <Label+ htmlFor="v4-beta-toggle"+ className="block min-w-0 flex-1 cursor-pointer truncate text-sm font-normal"+ >+ Fast (Preview)+ </Label>+ </div>+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="flex shrink-0">+ <Switch+ id="v4-beta-toggle"+ size="sm"+ checked={isBetaEnabled}+ onCheckedChange={handleToggle}+ disabled={isLoading}+ className="shrink-0"+ aria-label="Toggle Preview (fast)"+ aria-describedby={PREVIEW_FAST_DESCRIPTION_ID}+ />+ </div>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xs text-xs">+ {PREVIEW_FAST_DESCRIPTION}+ </TooltipContent>+ </Tooltip>+ <span id={PREVIEW_FAST_DESCRIPTION_ID} className="sr-only">{PREVIEW_FAST_DESCRIPTION}- </TooltipContent>- </Tooltip>- <span id={PREVIEW_FAST_DESCRIPTION_ID} className="sr-only">- {PREVIEW_FAST_DESCRIPTION}- </span>- </div>- </SidebarMenuButton>+ </span>+ </div>+ </SidebarMenuButton>+ <V4BetaIntroDialog+ open={showIntroDialog}+ onConfirm={confirmIntroDialog}+ />+ </>);}diff --git a/web/src/features/events/hooks/useV4Beta.ts b/web/src/features/events/hooks/useV4Beta.tsindex 59e922b083..fe83ee668e 100644--- a/web/src/features/events/hooks/useV4Beta.ts+++ b/web/src/features/events/hooks/useV4Beta.ts@@ -1,6 +1,6 @@import { useSession } from "next-auth/react";import { api } from "@/src/utils/api";-import { useCallback } from "react";+import { useCallback, useState } from "react";import posthog from "posthog-js";import { V4_BETA_ENABLED_POSTHOG_PROPERTY } from "@/src/features/posthog-analytics/usePostHogClientCapture";@@ -8,12 +8,17 @@ type SetV4BetaEnabledOptions = {onSuccess?: () => void | Promise<void>;};+const INTRO_DIALOG_SEEN_KEY = "v4-beta-intro-dialog-seen";+export function useV4Beta() {const { data: session, update: updateSession } = useSession();const mutation = api.userAccount.setV4BetaEnabled.useMutation();const isBetaEnabled = session?.user?.v4BetaEnabled ?? false;+ const [showIntroDialog, setShowIntroDialog] = useState(false);+ const [pendingOnSuccess, setPendingOnSuccess] =+ useState<SetV4BetaEnabledOptions["onSuccess"]>();const setBetaEnabled = useCallback((enabled: boolean, options?: SetV4BetaEnabledOptions) => {@@ -36,9 +41,41 @@ export function useV4Beta() {[mutation, updateSession],);+ const enableWithIntro = useCallback(+ (options?: SetV4BetaEnabledOptions) => {+ if (+ typeof window !== "undefined" &&+ !localStorage.getItem(INTRO_DIALOG_SEEN_KEY)+ ) {+ setPendingOnSuccess(() => options?.onSuccess);+ setShowIntroDialog(true);+ return;+ }++ setBetaEnabled(true, options);+ },+ [setBetaEnabled],+ );++ const confirmIntroDialog = useCallback(() => {+ localStorage.setItem(INTRO_DIALOG_SEEN_KEY, "true");+ setShowIntroDialog(false);+ setBetaEnabled(true, { onSuccess: pendingOnSuccess });+ setPendingOnSuccess(undefined);+ }, [setBetaEnabled, pendingOnSuccess]);++ const dismissIntroDialog = useCallback(() => {+ setShowIntroDialog(false);+ setPendingOnSuccess(undefined);+ }, []);+return {isBetaEnabled,setBetaEnabled,+ enableWithIntro,+ showIntroDialog,+ confirmIntroDialog,+ dismissIntroDialog,isLoading: mutation.isPending,};}