chore(chat): refactor chat init into separate quota and history actors
Split `chatInitActor` into `loadQuotaActor` (guest quota fetch) and `loadHistoryActor` (local → network → save sync), and add `quotaLoaded` / `historyLoaded` state flags so the UI can display loading status during the new local-first history hydration flow. Also drop the now-unused `ChatInit` event and pipe Next.js stdout/stderr to a persistent log file in the post-receive hook for easier troubleshooting.
This commit is contained in:
@@ -40,6 +40,10 @@ interface ChatState {
|
||||
isLoadingMore: boolean;
|
||||
hasMore: boolean;
|
||||
historyOffset: number;
|
||||
/** 游客配额加载完成标**志**(**仅** guestSession 期间) —— UI 可**用**此**显**示 loading */
|
||||
quotaLoaded: boolean;
|
||||
/** history 初始加**载**完成标**志**(local → network → save 跑**完**) —— UI 可**用**此**显**示 loading */
|
||||
historyLoaded: boolean;
|
||||
}
|
||||
|
||||
const ChatStateCtx = createContext<ChatState | null>(null);
|
||||
@@ -63,6 +67,8 @@ export function ChatProvider({ children }: ChatProviderProps) {
|
||||
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