mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-24 08:22:07 +00:00
fix: ensure wrapping curly is not included
This commit is contained in:
parent
dbce04e4d3
commit
07c20903e5
@ -1382,6 +1382,19 @@ pub(crate) async fn chat_completions(
|
|||||||
Err(err) => yield Ok(err.into_openai_event())
|
Err(err) => yield Ok(err.into_openai_event())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// send the second to last stream token but remove the trailing '}' if it exists
|
||||||
|
let mut closing_stream_token = buffer.remove(0);
|
||||||
|
closing_stream_token.token.text = closing_stream_token.token.text.strip_suffix("}").unwrap_or(&closing_stream_token.token.text).to_string();
|
||||||
|
let event = create_event_from_stream_token(
|
||||||
|
&closing_stream_token,
|
||||||
|
logprobs,
|
||||||
|
stream_options.clone(),
|
||||||
|
response_as_tool,
|
||||||
|
system_fingerprint.clone(),
|
||||||
|
model_id.clone(),
|
||||||
|
Some(global_function_name.clone()),
|
||||||
|
);
|
||||||
|
yield Ok::<Event, Infallible>(event);
|
||||||
yield Ok::<Event, Infallible>(Event::default().data("[DONE]"));
|
yield Ok::<Event, Infallible>(Event::default().data("[DONE]"));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user