diff --git a/crates/tabby/src/serve.rs b/crates/tabby/src/serve.rs index 3b1036603560..43ee77aa715e 100644 --- a/crates/tabby/src/serve.rs +++ b/crates/tabby/src/serve.rs @@ -5,7 +5,7 @@ use clap::Args; use hyper::StatusCode; use tabby_common::{ api::{self, code::CodeSearch, event::EventLogger}, - config::{Config, ConfigAccess, ModelConfig, StaticConfigAccess}, + config::{Config, ConfigAccess, LocalModelConfig, ModelConfig, StaticConfigAccess}, usage, }; use tabby_inference::Embedding; @@ -398,5 +398,13 @@ fn merge_args(config: &Config, args: &ServeArgs) -> Config { )); } + if config.model.embedding.is_none() { + config.model.embedding = Some(ModelConfig::Local(LocalModelConfig { + model_id: "Nomic-Embed-Text".to_string(), + parallelism: 4, + num_gpu_layers: 9999, + })) + } + config } diff --git a/crates/tabby/src/services/embedding.rs b/crates/tabby/src/services/embedding.rs index d93f4e38dba3..e515adee0d12 100644 --- a/crates/tabby/src/services/embedding.rs +++ b/crates/tabby/src/services/embedding.rs @@ -6,17 +6,5 @@ use tabby_inference::Embedding; use super::model; pub async fn create(config: Option<&ModelConfig>) -> Arc { - if let Some(config) = config { - model::load_embedding(config).await - } else { - model::load_embedding(&default_config()).await - } -} - -fn default_config() -> ModelConfig { - ModelConfig::Local(LocalModelConfig { - model_id: "Nomic-Embed-Text".to_string(), - parallelism: 4, - num_gpu_layers: 9999, - }) + model::load_embedding(config.expect("Embedding model is not specified")).await }