feat(chat): handle daily message paywall

This commit is contained in:
2026-06-22 10:46:17 +08:00
parent df7f673855
commit 61fd4ca916
10 changed files with 162 additions and 44 deletions
+7 -4
View File
@@ -1,7 +1,5 @@
"use client";
/**
* ChatScreen 编排层
*/
import { useEffect, useRef, useState } from "react";
import Image from "next/image";
@@ -50,8 +48,13 @@ export function ChatScreen() {
// - quotaExceededTrigger 而非 guestTotalQuota / guestRemainingQuota ——
// trigger 由 chat 机器的 guard 在 ChatSendMessage / ChatSendImage 被拦截时 +1
// 是 "用户被配额拒绝过" 的权威信号(避免依赖 quota 数值本身的边界判断)
const showExhaustedBanner =
const showGuestQuotaBanner =
isGuest && state.quotaLoaded && state.quotaExceededTrigger > 0;
const showDailyLimitBanner =
!isGuest &&
state.paywallTriggered &&
state.paywallReason === "daily_limit";
const showExhaustedBanner = showGuestQuotaBanner || showDailyLimitBanner;
const externalBrowserPromptShownRef = useRef(false);
@@ -45,7 +45,7 @@ export function ChatQuotaExhaustedBanner({
onUnlock();
return;
}
router.push(ROUTES.auth);
router.push(`${ROUTES.subscription}?type=vip`);
};
return (