Skip to content

Commit

Permalink
Merge pull request #327 from gngpp/fix
Browse files Browse the repository at this point in the history
fix(toapi): Fix duplicate reply content
  • Loading branch information
0x676e67 authored Nov 22, 2023
2 parents ee779d8 + 89c9c10 commit 61c05ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions openai/src/chatgpt/model/resp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ impl ConvoResponse {
.collect()
}

pub fn raw_messages(&self) -> &[String] {
self.message.content.parts.as_slice()
}

pub fn message_id(&self) -> &str {
&self.message.id
}
Expand Down
2 changes: 1 addition & 1 deletion openai/src/serve/proxy/toapi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ async fn event_convert_handler(
set_role: &mut bool,
convo: ConvoResponse,
) -> anyhow::Result<Event> {
let messages = convo.messages();
let messages = convo.raw_messages();
let message = messages
.first()
.ok_or(anyhow::anyhow!("message is empty"))?;
Expand Down

0 comments on commit 61c05ef

Please sign in to comment.