@@ -43,9 +43,7 @@ pub async fn doctor_command(config: Config) -> Result<()> {
4343
4444 // Endpoint reachability
4545 print ! ( "Checking endpoint {}... " , base_url) ;
46- let client = Client :: builder ( )
47- . timeout ( Duration :: from_secs ( 5 ) )
48- . build ( ) ?;
46+ let client = Client :: builder ( ) . timeout ( Duration :: from_secs ( 5 ) ) . build ( ) ?;
4947
5048 // Try Ollama /api/tags first
5149 let ollama_url = format ! ( "{}/api/tags" , base_url) ;
@@ -136,7 +134,10 @@ pub async fn doctor_command(config: Config) -> Result<()> {
136134 if let Some ( ctx_size) =
137135 detect_model_context_window ( & client, & base_url, & recommended. name ) . await
138136 {
139- println ! ( " Context window: {} tokens (detected from model)" , ctx_size) ;
137+ println ! (
138+ " Context window: {} tokens (detected from model)" ,
139+ ctx_size
140+ ) ;
140141 }
141142 }
142143
@@ -154,9 +155,7 @@ pub async fn doctor_command(config: Config) -> Result<()> {
154155 // Test inference
155156 let recommended_name = recommended. name . clone ( ) ;
156157 print ! ( "\n Testing model {}... " , recommended_name) ;
157- let test_client = Client :: builder ( )
158- . timeout ( Duration :: from_secs ( 10 ) )
159- . build ( ) ?;
158+ let test_client = Client :: builder ( ) . timeout ( Duration :: from_secs ( 10 ) ) . build ( ) ?;
160159 let test_start = std:: time:: Instant :: now ( ) ;
161160 let test_result =
162161 test_model_inference ( & test_client, & base_url, & recommended_name, endpoint_type)
@@ -165,8 +164,7 @@ pub async fn doctor_command(config: Config) -> Result<()> {
165164
166165 match test_result {
167166 Ok ( response) => {
168- let tokens_per_sec =
169- estimate_tokens ( & response) as f64 / elapsed. as_secs_f64 ( ) ;
167+ let tokens_per_sec = estimate_tokens ( & response) as f64 / elapsed. as_secs_f64 ( ) ;
170168 println ! (
171169 "OK ({:.1}s, ~{:.0} tok/s)" ,
172170 elapsed. as_secs_f64( ) ,
@@ -369,7 +367,10 @@ fn check_system_resources() {
369367 let cpu = String :: from_utf8_lossy ( & output. stdout ) ;
370368 let cpu = cpu. trim ( ) ;
371369 if cpu. contains ( "Apple" ) {
372- println ! ( " Chip: {} (unified memory, GPU acceleration available)" , cpu) ;
370+ println ! (
371+ " Chip: {} (unified memory, GPU acceleration available)" ,
372+ cpu
373+ ) ;
373374 }
374375 }
375376 }
@@ -592,7 +593,8 @@ mod tests {
592593 #[ tokio:: test]
593594 async fn test_detect_context_window_from_parameters ( ) {
594595 // Simulate Ollama /api/show response with parameters field
595- let json = r#"{"parameters":"stop [INST]\nstop [/INST]\nnum_ctx 4096\nrepeat_penalty 1.1"}"# ;
596+ let json =
597+ r#"{"parameters":"stop [INST]\nstop [/INST]\nnum_ctx 4096\nrepeat_penalty 1.1"}"# ;
596598 let value: serde_json:: Value = serde_json:: from_str ( json) . unwrap ( ) ;
597599 let mut result = None ;
598600 if let Some ( params) = value. get ( "parameters" ) . and_then ( |p| p. as_str ( ) ) {
0 commit comments