(ctx: &mut Context)
| 547 | } |
| 548 | |
| 549 | async fn run_text_worker(ctx: &mut Context) -> String { |
| 550 | log_mobile(&format!("[cake-mobile] text model arch: {:?}", ctx.text_model_arch)); |
| 551 | |
| 552 | match ctx.text_model_arch { |
| 553 | #[cfg(feature = "qwen3_5")] |
| 554 | TextModelArch::Qwen3_5 => { |
| 555 | log_mobile("[cake-mobile] creating Qwen3.5 worker..."); |
| 556 | let mut worker = match Worker::<cake_core::models::qwen3_5::Qwen3_5>::new(ctx).await { |
| 557 | Ok(w) => { |
| 558 | log_mobile("[cake-mobile] Qwen3.5 worker ready on 0.0.0.0:10128"); |
| 559 | w |
| 560 | } |
| 561 | Err(e) => { |
| 562 | let msg = format!("Qwen3.5 worker creation failed: {}", e); |
| 563 | log_mobile(&format!("[cake-mobile] ERROR: {}", msg)); |
| 564 | return msg; |
| 565 | } |
| 566 | }; |
| 567 | log_mobile("[cake-mobile] Qwen3.5 worker.run() starting..."); |
| 568 | match worker.run().await { |
| 569 | Ok(_) => String::new(), |
| 570 | Err(e) => { |
| 571 | let msg = format!("worker error: {}", e); |
| 572 | log_mobile(&format!("[cake-mobile] ERROR: {}", msg)); |
| 573 | msg |
| 574 | } |
| 575 | } |
| 576 | } |
| 577 | #[cfg(feature = "qwen2")] |
| 578 | TextModelArch::Qwen2 => { |
| 579 | log_mobile("[cake-mobile] creating Qwen2 worker..."); |
| 580 | let mut worker = match Worker::<cake_core::models::qwen2::Qwen2>::new(ctx).await { |
| 581 | Ok(w) => { |
| 582 | log_mobile("[cake-mobile] Qwen2 worker ready on 0.0.0.0:10128"); |
| 583 | w |
| 584 | } |
| 585 | Err(e) => { |
| 586 | let msg = format!("Qwen2 worker creation failed: {}", e); |
| 587 | log_mobile(&format!("[cake-mobile] ERROR: {}", msg)); |
| 588 | return msg; |
| 589 | } |
| 590 | }; |
| 591 | log_mobile("[cake-mobile] Qwen2 worker.run() starting..."); |
| 592 | match worker.run().await { |
| 593 | Ok(_) => String::new(), |
| 594 | Err(e) => { |
| 595 | let msg = format!("worker error: {}", e); |
| 596 | log_mobile(&format!("[cake-mobile] ERROR: {}", msg)); |
| 597 | msg |
| 598 | } |
| 599 | } |
| 600 | } |
| 601 | #[cfg(feature = "llama")] |
| 602 | TextModelArch::Llama | TextModelArch::Auto => { |
| 603 | log_mobile("[cake-mobile] creating LLaMA worker..."); |
| 604 | let mut worker = match Worker::<cake_core::models::llama3::LLama>::new(ctx).await { |
| 605 | Ok(w) => { |
| 606 | log_mobile("[cake-mobile] LLaMA worker ready on 0.0.0.0:10128"); |
no test coverage detected