diff --git a/src/stores/chat/__tests__/chat-machine.helpers.test.ts b/src/stores/chat/__tests__/chat-machine.helpers.test.ts index b9297a0f..97e308f2 100644 --- a/src/stores/chat/__tests__/chat-machine.helpers.test.ts +++ b/src/stores/chat/__tests__/chat-machine.helpers.test.ts @@ -38,8 +38,6 @@ function makeChatState(overrides: Partial = {}): ChatState { pendingReplyCount: 1, upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, isLoadingMore: false, hasMore: true, historyOffset: 0, @@ -169,12 +167,6 @@ describe("applyHttpSendOutput", () => { expect(nextState.isReplyingAI).toBe(false); expect(nextState.upgradePromptVisible).toBe(true); expect(nextState.upgradeReason).toBe("daily_limit"); - expect(nextState.upgradeHint).toBeNull(); - expect(nextState.upgradeDetail).toEqual({ - type: "daily_msg_limit", - usedToday: 3, - limit: 3, - }); }); }); diff --git a/src/stores/chat/__tests__/chat-machine.transitions.test.ts b/src/stores/chat/__tests__/chat-machine.transitions.test.ts index f60ed230..4bcabbcf 100644 --- a/src/stores/chat/__tests__/chat-machine.transitions.test.ts +++ b/src/stores/chat/__tests__/chat-machine.transitions.test.ts @@ -479,8 +479,6 @@ describe("chatMachine transitions", () => { expect(actor.getSnapshot().context.upgradePromptVisible).toBe(false); expect(actor.getSnapshot().context.upgradeReason).toBeNull(); - expect(actor.getSnapshot().context.upgradeHint).toBeNull(); - expect(actor.getSnapshot().context.upgradeDetail).toBeNull(); actor.stop(); }); diff --git a/src/stores/chat/chat-context.tsx b/src/stores/chat/chat-context.tsx index 759ddfc7..a6c28024 100644 --- a/src/stores/chat/chat-context.tsx +++ b/src/stores/chat/chat-context.tsx @@ -23,8 +23,6 @@ interface ChatState { isReplyingAI: boolean; upgradePromptVisible: boolean; upgradeReason: MachineContext["upgradeReason"]; - upgradeHint: MachineContext["upgradeHint"]; - upgradeDetail: MachineContext["upgradeDetail"]; isLoadingMore: boolean; hasMore: boolean; historyOffset: number; @@ -53,8 +51,6 @@ export function ChatProvider({ children }: ChatProviderProps) { isReplyingAI: state.context.isReplyingAI, upgradePromptVisible: state.context.upgradePromptVisible, upgradeReason: state.context.upgradeReason, - upgradeHint: state.context.upgradeHint, - upgradeDetail: state.context.upgradeDetail, isLoadingMore: state.context.isLoadingMore, hasMore: state.context.hasMore, historyOffset: state.context.historyOffset, diff --git a/src/stores/chat/chat-machine.helpers.ts b/src/stores/chat/chat-machine.helpers.ts index 0c733099..ccba777b 100644 --- a/src/stores/chat/chat-machine.helpers.ts +++ b/src/stores/chat/chat-machine.helpers.ts @@ -194,8 +194,6 @@ export function applyHttpSendOutput( ...finishPendingReply(context), upgradePromptVisible: true, upgradeReason: "daily_limit", - upgradeHint: null, - upgradeDetail: normalizeLockDetail(lockDetail.detail), }; } @@ -211,8 +209,6 @@ export function applyHttpSendOutput( ...finishPendingReply(context), upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, }; } @@ -221,8 +217,6 @@ export function applyHttpSendOutput( ...finishPendingReply(context), upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, }; } @@ -252,22 +246,6 @@ export function shouldPromptUnlockHistory(messages: readonly UiMessage[]): boole return countLockedHistoryMessages(messages) > 1; } -export function normalizeLockDetail( - detail: Record | null, -): ChatState["upgradeDetail"] { - if (!detail) return null; - return { - ...(typeof detail.type === "string" ? { type: detail.type } : {}), - ...(typeof detail.usedToday === "number" - ? { usedToday: detail.usedToday } - : {}), - ...(typeof detail.usedTotal === "number" - ? { usedTotal: detail.usedTotal } - : {}), - ...(typeof detail.limit === "number" ? { limit: detail.limit } : {}), - }; -} - // ============================================================ // Init 任务 2:history 3 步流(local → network → save)—— `loadHistoryActor` 调 // ============================================================ diff --git a/src/stores/chat/chat-machine.ts b/src/stores/chat/chat-machine.ts index 09946577..d9acd6c4 100644 --- a/src/stores/chat/chat-machine.ts +++ b/src/stores/chat/chat-machine.ts @@ -109,8 +109,6 @@ export const chatMachine = setup({ ], upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, }; }), @@ -135,8 +133,6 @@ export const chatMachine = setup({ ], upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, }; }), @@ -161,8 +157,6 @@ export const chatMachine = setup({ ...beginPendingReply(context), upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, }; }), @@ -187,8 +181,6 @@ export const chatMachine = setup({ ...beginPendingReply(context), upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, }; }), @@ -214,8 +206,6 @@ export const chatMachine = setup({ clearUpgradePrompt: assign(() => ({ upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, })), markPaymentUnlockPending: assign(() => ({ diff --git a/src/stores/chat/chat-state.ts b/src/stores/chat/chat-state.ts index 3d1baa78..15376a66 100644 --- a/src/stores/chat/chat-state.ts +++ b/src/stores/chat/chat-state.ts @@ -5,16 +5,7 @@ export interface ChatState { isReplyingAI: boolean; pendingReplyCount: number; upgradePromptVisible: boolean; - upgradeReason: "daily_limit" | "image" | null; - upgradeHint: string | null; - upgradeDetail: - | { - type?: string; - usedToday?: number; - usedTotal?: number; - limit?: number; - } - | null; + upgradeReason: "daily_limit" | null; isLoadingMore: boolean; hasMore: boolean; historyOffset: number; @@ -36,8 +27,6 @@ export const initialState: ChatState = { pendingReplyCount: 0, upgradePromptVisible: false, upgradeReason: null, - upgradeHint: null, - upgradeDetail: null, isLoadingMore: false, hasMore: true, historyOffset: 0,