Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat(app): add upgrade dialog for free tier limits

Louis Beaumontbbb0f550eb02
diff --git a/screenpipe-app-tauri/components/global-chat.tsx b/screenpipe-app-tauri/components/global-chat.tsx
index 60356290d..ab91a31b0 100644
--- a/screenpipe-app-tauri/components/global-chat.tsx
+++ b/screenpipe-app-tauri/components/global-chat.tsx
@@ -27,6 +27,7 @@ import { usePlatform } from "@/lib/hooks/use-platform";
import { useTimelineSelection } from "@/lib/hooks/use-timeline-selection";
import { useSqlAutocomplete } from "@/lib/hooks/use-sql-autocomplete";
import { commands } from "@/lib/utils/tauri";
+import { UpgradeDialog } from "@/components/upgrade-dialog";
const SCREENPIPE_API = "http://localhost:3030";
@@ -444,6 +445,11 @@ export function GlobalChat() {
const [isExporting, setIsExporting] = useState(false);
const [exportProgress, setExportProgress] = useState(0);
+ // Upgrade dialog state
+ const [showUpgradeDialog, setShowUpgradeDialog] = useState(false);
+ const [upgradeReason, setUpgradeReason] = useState<"daily_limit" | "model_not_allowed">("daily_limit");
+ const [upgradeResetsAt, setUpgradeResetsAt] = useState<string | undefined>();
+
const appMentionSuggestions = React.useMemo(
() => buildAppMentionSuggestions(appItems, APP_SUGGESTION_LIMIT),
[appItems]
@@ -1184,8 +1190,23 @@ export function GlobalChat() {
let errorMessage = error instanceof Error ? error.message : "Something went wrong";
+ // Check for screenpipe-cloud free tier limits
+ if (errorMessage.includes("daily_limit_exceeded")) {
+ // Parse resets_at from error if available
+ try {
+ const match = errorMessage.match(/"resets_at":\s*"([^"]+)"/);
+ if (match) setUpgradeResetsAt(match[1]);
+ } catch {}
+ setUpgradeReason("daily_limit");
+ setShowUpgradeDialog(true);
+ errorMessage = "You've used all your free queries for today.";
+ } else if (errorMessage.includes("model_not_allowed")) {
+ setUpgradeReason("model_not_allowed");
+ setShowUpgradeDialog(true);
+ errorMessage = "This model requires an upgrade.";
+ }
// Check for common API errors and provide helpful messages
- if (errorMessage.includes("401") || errorMessage.includes("Unauthorized")) {
+ else if (errorMessage.includes("401") || errorMessage.includes("Unauthorized")) {
errorMessage = "Invalid API key. Please check your preset configuration.";
} else if (errorMessage.includes("429")) {
errorMessage = "Rate limit exceeded. Please wait a moment and try again.";
@@ -1647,6 +1668,13 @@ export function GlobalChat() {
</div>
</CustomDialogContent>
</Dialog>
+
+ <UpgradeDialog
+ open={showUpgradeDialog}
+ onOpenChange={setShowUpgradeDialog}
+ reason={upgradeReason}
+ resetsAt={upgradeResetsAt}
+ />
</>
);
}
diff --git a/screenpipe-app-tauri/components/settings/account-section.tsx b/screenpipe-app-tauri/components/settings/account-section.tsx
index ad7430f4c..5dfdb65b6 100644
--- a/screenpipe-app-tauri/components/settings/account-section.tsx
+++ b/screenpipe-app-tauri/components/settings/account-section.tsx
@@ -8,6 +8,9 @@ import {
RefreshCw,
UserCog,
ExternalLinkIcon,
+ Sparkles,
+ Zap,
+ Brain,
} from "lucide-react";
import { toast } from "@/components/ui/use-toast";
import { open as openUrl } from "@tauri-apps/plugin-shell";
@@ -265,6 +268,31 @@ export function AccountSection() {
</div>
</div>
+ {/* AI tier info - only show for non-subscribers */}
+ {!settings.user?.cloud_subscribed && (
+ <Card className="p-4 space-y-3 bg-secondary/5">
+ <div className="flex items-center gap-2">
+ <Sparkles className="h-5 w-5 text-primary" />
+ <h4 className="font-medium">screenpipe cloud ai</h4>
+ </div>
+ <div className="grid gap-2 text-sm text-muted-foreground">
+ <div className="flex items-center gap-2">
+ <span className="inline-flex h-1.5 w-1.5 rounded-full bg-muted-foreground" />
+ {settings.user?.token ? "50 free ai queries per day" : "25 free ai queries per day"}
+ </div>
+ <div className="flex items-center gap-2">
+ <span className="inline-flex h-1.5 w-1.5 rounded-full bg-muted-foreground" />
+ {settings.user?.token ? "access to claude haiku & sonnet" : "access to claude haiku"}
+ </div>
+ </div>
+ <Separator className="my-2" />
+ <div className="text-sm">
+ <span className="text-muted-foreground">upgrade benefits: </span>
+ <span className="text-foreground">unlimited queries, all models (gpt-4, claude opus), priority support</span>
+ </div>
+ </Card>
+ )}
+
<div className="space-y-8">
<div className="space-y-6">
<div className="grid gap-4">
diff --git a/screenpipe-app-tauri/components/upgrade-dialog.tsx b/screenpipe-app-tauri/components/upgrade-dialog.tsx
new file mode 100644
index 000000000..0404b1521
--- /dev/null
+++ b/screenpipe-app-tauri/components/upgrade-dialog.tsx
@@ -0,0 +1,126 @@
+import React from "react";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { open as openUrl } from "@tauri-apps/plugin-shell";
+import { useSettings } from "@/lib/hooks/use-settings";
+import { Sparkles, Zap, Clock } from "lucide-react";
+
+interface UpgradeDialogProps {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ reason?: "daily_limit" | "model_not_allowed";
+ resetsAt?: string;
+}
+
+export function UpgradeDialog({
+ open,
+ onOpenChange,
+ reason = "daily_limit",
+ resetsAt,
+}: UpgradeDialogProps) {
+ const { settings } = useSettings();
+ const isLoggedIn = !!settings.user?.token;
+
+ const handleSubscribe = async () => {
+ const baseUrl = "https://buy.stripe.com/5kA6p79qefweacg5kJ";
+ const params = new URLSearchParams();
+ if (settings.user?.id) {
+ params.set("client_reference_id", settings.user.id);
+ }
+ if (settings.user?.email) {
+ params.set("customer_email", settings.user.email);
+ }
+ await openUrl(`${baseUrl}?${params.toString()}`);
+ onOpenChange(false);
+ };
+
+ const handleLogin = async () => {
+ await openUrl("https://screenpi.pe/login");
+ onOpenChange(false);
+ };
+
+ const formatResetTime = () => {
+ if (!resetsAt) return "tomorrow";
+ try {
+ const reset = new Date(resetsAt);
+ const now = new Date();
+ const hoursLeft = Math.ceil((reset.getTime() - now.getTime()) / (1000 * 60 * 60));
+ if (hoursLeft <= 1) return "in about an hour";
+ if (hoursLeft < 24) return `in ${hoursLeft} hours`;
+ return "tomorrow";
+ } catch {
+ return "tomorrow";
+ }
+ };
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="w-full max-w-[420px]">
+ <DialogHeader>
+ <DialogTitle className="flex items-center gap-2">
+ <Sparkles className="h-5 w-5" />
+ {reason === "daily_limit"
+ ? "you've used all your free queries today"
+ : "this model requires an upgrade"}
+ </DialogTitle>
+ <DialogDescription>
+ {reason === "daily_limit"
+ ? `your free queries reset ${formatResetTime()}, or upgrade for unlimited access`
+ : "upgrade to access smarter models like claude sonnet and gpt-4"}
+ </DialogDescription>
+ </DialogHeader>
+
+ <div className="space-y-3 pt-2">
+ <Button
+ className="w-full justify-start gap-3 h-auto py-3"
+ onClick={handleSubscribe}
+ >
+ <Zap className="h-5 w-5" />
+ <div className="text-left">
+ <div className="font-medium">subscribe for $30/mo</div>
+ <div className="text-xs opacity-80">
+ unlimited queries, all models, priority support
+ </div>
+ </div>
+ </Button>
+
+ {!isLoggedIn && reason === "daily_limit" && (
+ <Button
+ variant="outline"
+ className="w-full justify-start gap-3 h-auto py-3"
+ onClick={handleLogin}
+ >
+ <Sparkles className="h-5 w-5" />
+ <div className="text-left">
+ <div className="font-medium">sign in for more</div>
+ <div className="text-xs text-muted-foreground">
+ get 50 queries/day + access to sonnet
+ </div>
+ </div>
+ </Button>
+ )}
+
+ <Button
+ variant="ghost"
+ className="w-full justify-start gap-3 h-auto py-3"
+ onClick={() => onOpenChange(false)}
+ >
+ <Clock className="h-5 w-5" />
+ <div className="text-left">
+ <div className="font-medium">wait until {formatResetTime()}</div>
+ <div className="text-xs text-muted-foreground">
+ your free queries will reset automatically
+ </div>
+ </div>
+ </Button>
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+}