File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -1285,7 +1285,6 @@ pub(crate) async fn chat_completions(
1285
1285
}
1286
1286
} ;
1287
1287
let mut response_as_tool = using_tools;
1288
- let mut global_function_name = String :: new( ) ;
1289
1288
while let Some ( result) = response_stream. next( ) . await {
1290
1289
match result{
1291
1290
Ok ( stream_token) => {
@@ -1295,8 +1294,8 @@ pub(crate) async fn chat_completions(
1295
1294
json_buffer. push_str( & token_text. replace( " " , "" ) ) ;
1296
1295
buffer. push( stream_token) ;
1297
1296
if let Some ( captures) = function_regex. captures( & json_buffer) {
1298
- global_function_name = captures[ 1 ] . to_string( ) ;
1299
- if global_function_name == "no_tool" {
1297
+ let function_name = captures[ 1 ] . to_string( ) ;
1298
+ if function_name == "no_tool" {
1300
1299
state = StreamState :: BufferTrailing ;
1301
1300
response_as_tool = false ;
1302
1301
buffer. clear( ) ;
@@ -1317,7 +1316,7 @@ pub(crate) async fn chat_completions(
1317
1316
id: String :: new( ) ,
1318
1317
r#type: "function" . to_string( ) ,
1319
1318
function: Function {
1320
- name: Some ( global_function_name . clone( ) ) ,
1319
+ name: Some ( function_name . clone( ) ) ,
1321
1320
arguments: "" . to_string( ) ,
1322
1321
} ,
1323
1322
} ] ,
You can’t perform that action at this time.
0 commit comments