Embed all vault entries.
(
&self,
embed_fn: &F,
config: &EmbedConfig,
)
| 130 | |
| 131 | /// Embed all vault entries. |
| 132 | pub fn vault_embed_all<F>( |
| 133 | &self, |
| 134 | embed_fn: &F, |
| 135 | config: &EmbedConfig, |
| 136 | ) -> Result<usize, RepositoryError> |
| 137 | where |
| 138 | F: Fn(&str) -> Vec<f32>, |
| 139 | { |
| 140 | let entries = self.vault_list("", None)?; |
| 141 | let mut total = 0; |
| 142 | for meta in &entries { |
| 143 | // Only embed text content types |
| 144 | match meta.entry_type { |
| 145 | VaultEntryType::Memory |
| 146 | | VaultEntryType::Intent |
| 147 | | VaultEntryType::Session |
| 148 | | VaultEntryType::Skill => match self.vault_embed(&meta.path, embed_fn, config) { |
| 149 | Ok(count) => total += count, |
| 150 | Err(e) => log::warn!("Failed to embed {}: {}", meta.path, e), |
| 151 | }, |
| 152 | _ => {} |
| 153 | } |
| 154 | } |
| 155 | Ok(total) |
| 156 | } |
| 157 | |
| 158 | /// Search vault embeddings for similar content. |
| 159 | pub fn vault_search( |