feat: Introduce smart-features Cargo feature to conditionally compile smart note functionalities and their dependencies.

This commit is contained in:
2025-12-26 00:48:03 +01:00
parent c8276ac306
commit c2a324b368
12 changed files with 144 additions and 60 deletions

View File

@@ -17,6 +17,7 @@ pub enum FactoryError {
pub type FactoryResult<T> = Result<T, FactoryError>;
#[cfg(feature = "smart-features")]
#[derive(Debug, Clone)]
pub enum EmbeddingProvider {
FastEmbed,
@@ -24,12 +25,14 @@ pub enum EmbeddingProvider {
// OpenAI(String), // ApiKey
}
#[cfg(feature = "smart-features")]
#[derive(Debug, Clone)]
pub enum VectorProvider {
Qdrant { url: String, collection: String },
// InMemory,
}
#[cfg(feature = "smart-features")]
pub async fn build_embedding_generator(
provider: &EmbeddingProvider,
) -> FactoryResult<Arc<dyn notes_domain::ports::EmbeddingGenerator>> {
@@ -41,6 +44,7 @@ pub async fn build_embedding_generator(
}
}
#[cfg(feature = "smart-features")]
pub async fn build_vector_store(
provider: &VectorProvider,
) -> FactoryResult<Arc<dyn notes_domain::ports::VectorStore>> {

View File

@@ -15,6 +15,7 @@
//! - [`db::run_migrations`] - Run database migrations
pub mod db;
#[cfg(feature = "smart-features")]
pub mod embeddings;
pub mod factory;
#[cfg(feature = "sqlite")]
@@ -26,6 +27,7 @@ pub mod session_store;
pub mod tag_repository;
#[cfg(feature = "sqlite")]
pub mod user_repository;
#[cfg(feature = "smart-features")]
pub mod vector;
// Re-export for convenience