refactor(chat): rely on server message limits
This commit is contained in:
@@ -21,19 +21,12 @@ import type { ChatEvent, ChatState as MachineContext } from "./chat-machine";
|
||||
interface ChatState {
|
||||
messages: MachineContext["messages"];
|
||||
isReplyingAI: boolean;
|
||||
/** 游客剩余配额(次/天)—— 业务展示用,鉴权判断由 chat-screen 派生 loginStatus */
|
||||
guestRemainingQuota: number;
|
||||
/** 游客总配额 */
|
||||
guestTotalQuota: number;
|
||||
quotaExceededTrigger: number;
|
||||
paywallTriggered: boolean;
|
||||
paywallReason: MachineContext["paywallReason"];
|
||||
paywallDetail: MachineContext["paywallDetail"];
|
||||
isLoadingMore: boolean;
|
||||
hasMore: boolean;
|
||||
historyOffset: number;
|
||||
/** 游客配额加载完成标志(仅 guestSession 期间) —— UI 可用此显示 loading */
|
||||
quotaLoaded: boolean;
|
||||
/** history 初始加载完成标志(local → network → save 跑完) —— UI 可用此显示 loading */
|
||||
historyLoaded: boolean;
|
||||
}
|
||||
@@ -53,16 +46,12 @@ export function ChatProvider({ children }: ChatProviderProps) {
|
||||
() => ({
|
||||
messages: state.context.messages,
|
||||
isReplyingAI: state.context.isReplyingAI,
|
||||
guestRemainingQuota: state.context.guestRemainingQuota,
|
||||
guestTotalQuota: state.context.guestTotalQuota,
|
||||
quotaExceededTrigger: state.context.quotaExceededTrigger,
|
||||
paywallTriggered: state.context.paywallTriggered,
|
||||
paywallReason: state.context.paywallReason,
|
||||
paywallDetail: state.context.paywallDetail,
|
||||
isLoadingMore: state.context.isLoadingMore,
|
||||
hasMore: state.context.hasMore,
|
||||
historyOffset: state.context.historyOffset,
|
||||
quotaLoaded: state.context.quotaLoaded,
|
||||
historyLoaded: state.context.historyLoaded,
|
||||
}),
|
||||
[state],
|
||||
|
||||
Reference in New Issue
Block a user