mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-05-08 19:02:07 +00:00
fix: clippy cleanup
This commit is contained in:
parent
538456ba68
commit
e1b6d5be4a
@ -1285,7 +1285,6 @@ pub(crate) async fn chat_completions(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut response_as_tool = using_tools;
|
let mut response_as_tool = using_tools;
|
||||||
let mut global_function_name = String::new();
|
|
||||||
while let Some(result) = response_stream.next().await {
|
while let Some(result) = response_stream.next().await {
|
||||||
match result{
|
match result{
|
||||||
Ok(stream_token) => {
|
Ok(stream_token) => {
|
||||||
@ -1295,8 +1294,8 @@ pub(crate) async fn chat_completions(
|
|||||||
json_buffer.push_str(&token_text.replace(" ", ""));
|
json_buffer.push_str(&token_text.replace(" ", ""));
|
||||||
buffer.push(stream_token);
|
buffer.push(stream_token);
|
||||||
if let Some(captures) = function_regex.captures(&json_buffer) {
|
if let Some(captures) = function_regex.captures(&json_buffer) {
|
||||||
global_function_name = captures[1].to_string();
|
let function_name = captures[1].to_string();
|
||||||
if global_function_name == "no_tool" {
|
if function_name == "no_tool" {
|
||||||
state = StreamState::BufferTrailing;
|
state = StreamState::BufferTrailing;
|
||||||
response_as_tool = false;
|
response_as_tool = false;
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
@ -1317,7 +1316,7 @@ pub(crate) async fn chat_completions(
|
|||||||
id: String::new(),
|
id: String::new(),
|
||||||
r#type: "function".to_string(),
|
r#type: "function".to_string(),
|
||||||
function: Function {
|
function: Function {
|
||||||
name: Some(global_function_name.clone()),
|
name: Some(function_name.clone()),
|
||||||
arguments: "".to_string(),
|
arguments: "".to_string(),
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
|
Loading…
Reference in New Issue
Block a user