fix(api): return stream events directly from ingest_chunk
Resolves clippy::unnecessary_wraps on StreamState::ingest_chunk in openai_compat.rs. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
722eee3ea5
commit
d9c1883879
1 changed files with 3 additions and 3 deletions
|
|
@ -261,7 +261,7 @@ impl MessageStream {
|
||||||
match self.response.chunk().await? {
|
match self.response.chunk().await? {
|
||||||
Some(chunk) => {
|
Some(chunk) => {
|
||||||
for parsed in self.parser.push(&chunk)? {
|
for parsed in self.parser.push(&chunk)? {
|
||||||
self.pending.extend(self.state.ingest_chunk(parsed)?);
|
self.pending.extend(self.state.ingest_chunk(parsed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
@ -330,7 +330,7 @@ impl StreamState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ingest_chunk(&mut self, chunk: ChatCompletionChunk) -> Result<Vec<StreamEvent>, ApiError> {
|
fn ingest_chunk(&mut self, chunk: ChatCompletionChunk) -> Vec<StreamEvent> {
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
if !self.message.started {
|
if !self.message.started {
|
||||||
self.message.started = true;
|
self.message.started = true;
|
||||||
|
|
@ -418,7 +418,7 @@ impl StreamState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(events)
|
events
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finish(&mut self) -> Result<Vec<StreamEvent>, ApiError> {
|
fn finish(&mut self) -> Result<Vec<StreamEvent>, ApiError> {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue