fix(chat): show loading when run from console and when sending in app (#228)
This commit is contained in:
committed by
GitHub
Unverified
parent
95a4c0234a
commit
bf62639573
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user