feat(chat): handle credit-gated send responses
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
import type { UiMessage } from "@/data/dto/chat";
|
||||
|
||||
export type ChatUpgradeReason = "weekly_limit" | "insufficient_credits";
|
||||
|
||||
export interface ChatState {
|
||||
messages: UiMessage[];
|
||||
isReplyingAI: boolean;
|
||||
pendingReplyCount: number;
|
||||
upgradePromptVisible: boolean;
|
||||
upgradeReason: "weekly_limit" | null;
|
||||
upgradeReason: ChatUpgradeReason | null;
|
||||
canSendMessage: boolean;
|
||||
cannotSendReason: string | null;
|
||||
creditBalance: number;
|
||||
creditsCharged: number;
|
||||
requiredCredits: number;
|
||||
shortfallCredits: number;
|
||||
isLoadingMore: boolean;
|
||||
hasMore: boolean;
|
||||
historyOffset: number;
|
||||
@@ -27,6 +35,12 @@ export const initialState: ChatState = {
|
||||
pendingReplyCount: 0,
|
||||
upgradePromptVisible: false,
|
||||
upgradeReason: null,
|
||||
canSendMessage: true,
|
||||
cannotSendReason: null,
|
||||
creditBalance: 0,
|
||||
creditsCharged: 0,
|
||||
requiredCredits: 0,
|
||||
shortfallCredits: 0,
|
||||
isLoadingMore: false,
|
||||
hasMore: true,
|
||||
historyOffset: 0,
|
||||
|
||||
Reference in New Issue
Block a user