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:
@@ -39,6 +39,16 @@ export interface ChatState {
|
||||
isLoadingMore: boolean;
|
||||
hasMore: boolean;
|
||||
historyOffset: number;
|
||||
/** 游客配额加载完成标**志**(**仅** guestSession 期间) —— default false
|
||||
* - guestSession.initializing **走** always barrier:`quotaLoaded && historyLoaded` **才**进** ready
|
||||
* - userSession **永不为** true(**不**调 loadQuota)—— OK,**不**影响 barrier
|
||||
*/
|
||||
quotaLoaded: boolean;
|
||||
/** history 加**载**完成标**志**(initial load —— local → network → save 跑**完**)
|
||||
* - guestSession.initializing / userSession.initializing 走 always barrier
|
||||
* - **不**被 `loadMoreHistoryActor` 设**置**(**翻**页**是**另**一**码**事**)
|
||||
*/
|
||||
historyLoaded: boolean;
|
||||
}
|
||||
|
||||
export const initialState: ChatState = {
|
||||
@@ -51,4 +61,6 @@ export const initialState: ChatState = {
|
||||
isLoadingMore: false,
|
||||
hasMore: true,
|
||||
historyOffset: 0,
|
||||
quotaLoaded: false,
|
||||
historyLoaded: false,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user