fix(streamable): Append read stream buffer to ongoing response for long items (#372)

Process output is streamed into a buffer. By default this buffer fits 4k characters, which is too short for image data.
With this change, if this block does not contain a stream separator, the complete block is appended to the in-progress content stored so far.
Fixes #371.
This commit is contained in:
Alexander Lais 2023-04-14 20:56:00 +02:00 committed by GitHub
parent 569146d51d
commit 269a4107f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,7 +98,7 @@ class StreamablePlugin: Plugin {
self?.content = nil
return
}
guard str.contains("\n") else {
guard str.contains("\n") || !str.contains(streamSeparator) else {
self?.streamInProgressContent.append(contentsOf: str)
return
}