Skip to content

Commit

Permalink
fix(openai): handle done opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
HoKim98 committed Jul 18, 2024
1 parent 551fd03 commit d976e9e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/cassette-plugin-openai-chat/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ where
}
let data = &data[PATTERN.len()..];

// handle sub-opcodes
if data.starts_with("[DONE]".as_bytes()) {
return Ok(());
}

let Response { mut choices } = ::serde_json::from_slice(data)?;
if let Some(MessageChoice {
index: _,
Expand Down

0 comments on commit d976e9e

Please sign in to comment.