41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import type { UiMessage } from "@/data/dto/chat";
|
|
|
|
export interface ChatState {
|
|
messages: UiMessage[];
|
|
isReplyingAI: boolean;
|
|
pendingReplyCount: number;
|
|
upgradePromptVisible: boolean;
|
|
upgradeReason: "daily_limit" | "image" | null;
|
|
upgradeHint: string | null;
|
|
upgradeDetail:
|
|
| {
|
|
type?: string;
|
|
usedToday?: number;
|
|
usedTotal?: number;
|
|
limit?: number;
|
|
}
|
|
| null;
|
|
isLoadingMore: boolean;
|
|
hasMore: boolean;
|
|
historyOffset: number;
|
|
/** history 加载完成标志(initial load —— local → network → save 跑完)
|
|
* - guestSession.initializing / user sessions initializing 走 always barrier
|
|
* - 不被 `loadMoreHistoryActor` 设置(翻页是另一码事)
|
|
*/
|
|
historyLoaded: boolean;
|
|
}
|
|
|
|
export const initialState: ChatState = {
|
|
messages: [],
|
|
isReplyingAI: false,
|
|
pendingReplyCount: 0,
|
|
upgradePromptVisible: false,
|
|
upgradeReason: null,
|
|
upgradeHint: null,
|
|
upgradeDetail: null,
|
|
isLoadingMore: false,
|
|
hasMore: true,
|
|
historyOffset: 0,
|
|
historyLoaded: false,
|
|
};
|