fix(desktop): keep queued messages blocked during toolUse phases
This commit is contained in:
parent
bfe0c82e87
commit
3c1fa3f349
1 changed files with 15 additions and 1 deletions
|
|
@ -79,7 +79,21 @@ export function useLocalChat() {
|
|||
|
||||
chatRef.current.handleStream(payload)
|
||||
if (payload.event.type === 'message_start') setIsLoading(true)
|
||||
if (payload.event.type === 'message_end') setIsLoading(false)
|
||||
if (payload.event.type === 'tool_execution_start') setIsLoading(true)
|
||||
if (payload.event.type === 'message_end') {
|
||||
const stopReason =
|
||||
'message' in payload.event
|
||||
? (payload.event.message as { stopReason?: string } | undefined)?.stopReason
|
||||
: undefined
|
||||
|
||||
// message_end with stopReason=toolUse is an intermediate step in the same run.
|
||||
// Keep loading=true so queued user messages are not dispatched mid-run.
|
||||
if (stopReason === 'toolUse') {
|
||||
setIsLoading(true)
|
||||
} else {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Listen for exec approval requests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue