#[cfg(feature = "fastembed")]
use fastembed::{EmbeddingModel, TextEmbedding, TextInitOptions};
#[cfg(feature = "fastembed")]
pub fn try_new_text_embedding() -> Result<TextEmbedding, String> {
let cache = crate::cm_config::ensure_fastembed_cache_dir()?;
TextEmbedding::try_new(
TextInitOptions::new(EmbeddingModel::AllMiniLML6V2).with_cache_dir(cache),
)
.map_err(|e| format!("fastembed 初始化失败: {e}"))
}