fix(chat): track replies by queued batch
This commit is contained in:
@@ -111,7 +111,7 @@ export const chatMachine = setup({
|
||||
contentLength: event.content.length,
|
||||
contentPreview: event.content.slice(0, 50),
|
||||
quotaMode: "server controlled",
|
||||
isReplyingAI: true,
|
||||
isReplyingAI: context.isReplyingAI,
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -123,7 +123,6 @@ export const chatMachine = setup({
|
||||
date: today,
|
||||
},
|
||||
],
|
||||
...beginPendingReply(context),
|
||||
upgradePromptVisible: false,
|
||||
upgradeReason: null,
|
||||
upgradeHint: null,
|
||||
@@ -139,7 +138,7 @@ export const chatMachine = setup({
|
||||
contentLength: event.content.length,
|
||||
contentPreview: event.content.slice(0, 50),
|
||||
wsConnected: context.wsConnected,
|
||||
isReplyingAI: true,
|
||||
isReplyingAI: context.isReplyingAI,
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -151,7 +150,6 @@ export const chatMachine = setup({
|
||||
date: today,
|
||||
},
|
||||
],
|
||||
...beginPendingReply(context),
|
||||
upgradePromptVisible: false,
|
||||
upgradeReason: null,
|
||||
upgradeHint: null,
|
||||
@@ -261,6 +259,8 @@ export const chatMachine = setup({
|
||||
return { messages, ...finishPendingReply(context) };
|
||||
}),
|
||||
|
||||
markQueuedSendStarted: assign(({ context }) => beginPendingReply(context)),
|
||||
|
||||
applyQueuedHttpOutput: assign(({ context, event }) => {
|
||||
if (event.type !== "ChatQueuedHttpDone") return {};
|
||||
return applyHttpSendOutput(context, event.output);
|
||||
@@ -423,6 +423,9 @@ export const chatMachine = setup({
|
||||
target: "#chat.vipUserSession",
|
||||
actions: "startUserSession",
|
||||
},
|
||||
ChatQueuedSendStarted: {
|
||||
actions: "markQueuedSendStarted",
|
||||
},
|
||||
ChatQueuedHttpDone: {
|
||||
actions: "applyQueuedHttpOutput",
|
||||
},
|
||||
@@ -533,6 +536,9 @@ export const chatMachine = setup({
|
||||
target: "#chat.vipUserSession",
|
||||
actions: "startUserSession",
|
||||
},
|
||||
ChatQueuedSendStarted: {
|
||||
actions: "markQueuedSendStarted",
|
||||
},
|
||||
ChatQueuedHttpDone: {
|
||||
actions: "applyQueuedHttpOutput",
|
||||
},
|
||||
@@ -666,6 +672,9 @@ export const chatMachine = setup({
|
||||
ChatPaywallStatusReceived: { actions: "applyPaywallStatus" },
|
||||
ChatWebSocketError: { actions: "appendSocketErrorMessage" },
|
||||
ChatWebSocketConnected: { actions: "setWsConnected" },
|
||||
ChatQueuedSendStarted: {
|
||||
actions: "markQueuedSendStarted",
|
||||
},
|
||||
ChatQueuedHttpDone: {
|
||||
actions: "applyQueuedHttpOutput",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user