feat: Introduce smart-features Cargo feature to conditionally compile smart note functionalities and their dependencies.
This commit is contained in:
@@ -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>> {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user