From c5551e7fb8d128c4b68f5555cd0d506e581a240a Mon Sep 17 00:00:00 2001 From: jhqxxx <18280426169@163.com> Date: Tue, 31 Mar 2026 13:08:25 +0800 Subject: [PATCH] update fmt --- src/api/asr.rs | 2 +- src/api/mod.rs | 2 +- src/lib.rs | 3 +-- src/params/chat.rs | 6 +++--- src/params/mod.rs | 2 +- src/params/shared.rs | 1 - src/utils/mod.rs | 1 - tests/messy_test.rs | 2 +- tests/test_deepseek_ocr.rs | 2 +- tests/test_gguf_qwen3_5.rs | 2 +- tests/test_lfm2.rs | 2 +- tests/test_lfm2vl.rs | 2 +- 12 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/api/asr.rs b/src/api/asr.rs index 7d13f39..b48f155 100644 --- a/src/api/asr.rs +++ b/src/api/asr.rs @@ -1,11 +1,11 @@ // OpenAI-compatible ASR (Automatic Speech Recognition) API endpoint // Implements POST /audio/transcriptions and /v1/audio/transcriptions +use aha::models::GenerateModel; use aha::params::chat::{ AudioUrlType, ChatCompletionParameters, ChatMessage, ChatMessageAudioContentPart, ChatMessageContent, ChatMessageContentPart, }; -use aha::models::GenerateModel; use aha::utils::{clean_asr_response, map_language_code}; use rocket::http::Status; use rocket::serde::json::Json; diff --git a/src/api/mod.rs b/src/api/mod.rs index 0cc6ff0..28a08ad 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -2,8 +2,8 @@ use std::pin::pin; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, OnceLock}; -use aha::params::chat::ChatCompletionParameters; use aha::models::{GenerateModel, ModelInstance, WhichModel, load_model}; +use aha::params::chat::ChatCompletionParameters; use aha::process::cleanup_pid_file; use aha::utils::string_to_static_str; use rocket::futures::StreamExt; diff --git a/src/lib.rs b/src/lib.rs index 543fa9d..2fbdb33 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,8 @@ pub mod chat_template; pub mod exec; pub mod models; +pub mod params; pub mod position_embed; pub mod process; pub mod tokenizer; pub mod utils; -pub mod params; - diff --git a/src/params/chat.rs b/src/params/chat.rs index 4974fe5..ad5c485 100644 --- a/src/params/chat.rs +++ b/src/params/chat.rs @@ -534,7 +534,7 @@ pub struct AudioUrlType { #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub struct VideoUrlType { - /// video URL + /// video URL pub url: String, } @@ -613,7 +613,7 @@ pub struct ChatMessageImageContentPart { /// The type of the content part. pub r#type: String, /// The text content. - pub image_url: ImageUrlType + pub image_url: ImageUrlType, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] @@ -621,7 +621,7 @@ pub struct ChatMessageAudioContentPart { /// The type of the content part. Always input_audio. pub r#type: String, /// The input audio data. - pub audio_url: AudioUrlType + pub audio_url: AudioUrlType, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] diff --git a/src/params/mod.rs b/src/params/mod.rs index 4c7dfa7..399aa97 100644 --- a/src/params/mod.rs +++ b/src/params/mod.rs @@ -1,2 +1,2 @@ pub mod chat; -pub mod shared; \ No newline at end of file +pub mod shared; diff --git a/src/params/shared.rs b/src/params/shared.rs index 3ff357c..c4645c5 100644 --- a/src/params/shared.rs +++ b/src/params/shared.rs @@ -1,4 +1,3 @@ - use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] diff --git a/src/utils/mod.rs b/src/utils/mod.rs index d3bd750..b1044ab 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -394,7 +394,6 @@ pub fn timestamp_millis() -> u128 { .as_millis() } - pub fn round_by_factor(num: u32, factor: u32) -> u32 { let round = (num as f32 / factor as f32).round() as u32; round * factor diff --git a/tests/messy_test.rs b/tests/messy_test.rs index b48b99a..a948a2c 100644 --- a/tests/messy_test.rs +++ b/tests/messy_test.rs @@ -38,7 +38,7 @@ fn messy_test() -> Result<()> { // RUST_BACKTRACE=1 cargo test -F cuda --test messy_test messy_test -r -- --nocapture println!("当前秒级时间戳: {}", timestamp()); println!("当前毫秒级时间戳: {}", timestamp_millis()); - + // let t1 = Tensor::randn(0.0, 1.0, (1, 2, 6), device)?; // println!(" t1: {}", t1); // let t2 = t1.pad_with_zeros(D::Minus1, -3, 0)?; diff --git a/tests/test_deepseek_ocr.rs b/tests/test_deepseek_ocr.rs index 3acfa17..7266f1b 100644 --- a/tests/test_deepseek_ocr.rs +++ b/tests/test_deepseek_ocr.rs @@ -1,7 +1,7 @@ use std::{pin::pin, time::Instant}; -use aha::params::chat::ChatCompletionParameters; use aha::models::{GenerateModel, deepseek_ocr::generate::DeepseekOCRGenerateModel}; +use aha::params::chat::ChatCompletionParameters; use anyhow::Result; use rocket::futures::StreamExt; diff --git a/tests/test_gguf_qwen3_5.rs b/tests/test_gguf_qwen3_5.rs index eb1f1be..c8133fc 100644 --- a/tests/test_gguf_qwen3_5.rs +++ b/tests/test_gguf_qwen3_5.rs @@ -1,8 +1,8 @@ use std::time::Instant; use aha::{ - params::chat::ChatCompletionParameters, models::{GenerateModel, qwen3_5::generate::Qwen3_5GenerateModel}, + params::chat::ChatCompletionParameters, }; use anyhow::Result; // use candle_core::{DType, Device, quantized::gguf_file}; diff --git a/tests/test_lfm2.rs b/tests/test_lfm2.rs index 7fb26b3..3c678a8 100644 --- a/tests/test_lfm2.rs +++ b/tests/test_lfm2.rs @@ -1,6 +1,6 @@ use aha::{ - params::chat::ChatCompletionParameters, models::{GenerateModel, lfm2::generate::Lfm2GenerateModel}, + params::chat::ChatCompletionParameters, }; use anyhow::Result; use rocket::futures::StreamExt; diff --git a/tests/test_lfm2vl.rs b/tests/test_lfm2vl.rs index 8586863..b095471 100644 --- a/tests/test_lfm2vl.rs +++ b/tests/test_lfm2vl.rs @@ -1,8 +1,8 @@ use std::{pin::pin, time::Instant}; use aha::{ - params::chat::ChatCompletionParameters, models::{GenerateModel, lfm2vl::generate::Lfm2VLGenerateModel}, + params::chat::ChatCompletionParameters, }; use anyhow::Result; use rocket::futures::StreamExt;