mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
fix: close prompt stream when finish or error chunk received
This commit is contained in:
parent
530e6516fd
commit
ff8e5ddd27
@ -365,6 +365,16 @@ class ClaudeCodeService implements AgentServiceInterface {
|
|||||||
type: 'chunk',
|
type: 'chunk',
|
||||||
chunk
|
chunk
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Close prompt stream when SDK signals completion or error
|
||||||
|
if (chunk.type === 'finish' || chunk.type === 'error') {
|
||||||
|
logger.info('Closing prompt stream as SDK signaled completion', {
|
||||||
|
chunkType: chunk.type,
|
||||||
|
reason: chunk.type === 'finish' ? 'finished' : 'error_occurred'
|
||||||
|
})
|
||||||
|
closePromptStream()
|
||||||
|
logger.info('Prompt stream closed successfully')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user