fix: resolve type mismatch in async item stream handling

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 21:13:48 -03:00
parent c00b6230d4
commit f3132ec569
2 changed files with 10 additions and 5 deletions

View File

@@ -243,15 +243,16 @@ impl AsyncItemService {
let limited_stream = if length > 0 {
// We need to track how many bytes we've sent
let mut bytes_sent = 0;
Box::pin(stream.take_while(move |result| {
let limited = stream.take_while(move |result| {
if bytes_sent >= length {
return false;
return std::future::ready(false);
}
if let Ok(chunk) = result {
bytes_sent += chunk.len() as u64;
}
true
}))
std::future::ready(true)
});
Box::pin(limited)
} else {
Box::pin(stream)
};