mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-05-28 01:32:07 +00:00
Fmt.
This commit is contained in:
parent
a73cd56075
commit
214a5b5da1
@ -21,8 +21,8 @@ use serde::{Deserialize, Serialize};
|
||||
use tokenizers::Encoding;
|
||||
use tracing::warn;
|
||||
use utoipa::ToSchema;
|
||||
use validation::Validation;
|
||||
use uuid::Uuid;
|
||||
use validation::Validation;
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Clone)]
|
||||
@ -997,11 +997,11 @@ impl ChatRequest {
|
||||
))
|
||||
}
|
||||
|
||||
fn next_int_id(&self) -> Result<String, Box<dyn std::error::Error>>{
|
||||
fn next_int_id(&self) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let mut id: usize = 0;
|
||||
for message in &self.messages{
|
||||
if let MessageBody::Tool{tool_calls} = &message.body {
|
||||
for tool_call in tool_calls{
|
||||
for message in &self.messages {
|
||||
if let MessageBody::Tool { tool_calls } = &message.body {
|
||||
for tool_call in tool_calls {
|
||||
let new_id: usize = tool_call.id.parse()?;
|
||||
id = std::cmp::max(id, new_id + 1);
|
||||
}
|
||||
@ -1013,8 +1013,8 @@ impl ChatRequest {
|
||||
/// Try to have linearly increasing id
|
||||
/// or resort to using Uuid if the initial
|
||||
/// scheme is not understood
|
||||
fn next_tool_call_id(&self) -> String{
|
||||
self.next_int_id().unwrap_or_else(|_|{
|
||||
fn next_tool_call_id(&self) -> String {
|
||||
self.next_int_id().unwrap_or_else(|_| {
|
||||
let uid = Uuid::new_v4().to_string();
|
||||
uid.to_string()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user