fix(chat): show loading when run from console and when sending in app (#228)

This commit is contained in:
Mao Mr
2026-02-28 17:09:00 +08:00
committed by GitHub
Unverified
parent 95a4c0234a
commit bf62639573
3 changed files with 35 additions and 2 deletions

View File

@@ -94,6 +94,21 @@ export const useGatewayStore = create<GatewayState>((set, get) => ({
.catch(() => {});
}
// When a run starts (e.g. user clicked Send on console), show loading in the app immediately.
const runId = p.runId ?? data.runId;
const sessionKey = p.sessionKey ?? data.sessionKey;
if (phase === 'started' && runId != null && sessionKey != null) {
import('./chat')
.then(({ useChatStore }) => {
useChatStore.getState().handleChatEvent({
state: 'started',
runId,
sessionKey,
});
})
.catch(() => {});
}
// When the agent run completes, reload history to get the final response.
if (phase === 'completed' || phase === 'done' || phase === 'finished' || phase === 'end') {
import('./chat')