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