Add agent context compaction
This commit is contained in:
@@ -165,6 +165,12 @@ fn completion_stream_response(
|
||||
send_sse_headers_with_cors(stream, request.cors).map_err(|error| (500, error))?;
|
||||
while let Ok(event) = active.events.recv() {
|
||||
match event {
|
||||
GenerationEvent::Compacted(_) => {
|
||||
return Err((
|
||||
500,
|
||||
"The model runtime returned an unexpected compaction event.".into(),
|
||||
));
|
||||
}
|
||||
GenerationEvent::Chunk {
|
||||
reasoning: false,
|
||||
content,
|
||||
@@ -737,6 +743,12 @@ fn stream_response_with_keepalive(
|
||||
Err(_) => return Ok(()),
|
||||
};
|
||||
match event {
|
||||
GenerationEvent::Compacted(_) => {
|
||||
return Err((
|
||||
500,
|
||||
"The model runtime returned an unexpected compaction event.".into(),
|
||||
));
|
||||
}
|
||||
GenerationEvent::Loading => {}
|
||||
GenerationEvent::Context {
|
||||
tokens_per_second, ..
|
||||
|
||||
Reference in New Issue
Block a user