Embed all vault entries.
(
&self,
embed_fn: &F,
config: &EmbedConfig,
)
| 144 | |
| 145 | /// Embed all vault entries. |
| 146 | pub fn vault_embed_all<F>( |
| 147 | &self, |
| 148 | embed_fn: &F, |
| 149 | config: &EmbedConfig, |
| 150 | ) -> Result<usize, RepositoryError> |
| 151 | where |
| 152 | F: Fn(&str) -> Vec<f32>, |
| 153 | { |
| 154 | let entries = self.vault_list("", None)?; |
| 155 | let mut total = 0; |
| 156 | for meta in &entries { |
| 157 | // Only embed text content types |
| 158 | match meta.entry_type { |
| 159 | VaultEntryType::Memory |
| 160 | | VaultEntryType::Intent |
| 161 | | VaultEntryType::Session |
| 162 | | VaultEntryType::Skill => match self.vault_embed(&meta.path, embed_fn, config) { |
| 163 | Ok(count) => total += count, |
| 164 | Err(e) => log::warn!("Failed to embed {}: {}", meta.path, e), |
| 165 | }, |
| 166 | _ => {} |
| 167 | } |
| 168 | } |
| 169 | Ok(total) |
| 170 | } |
| 171 | |
| 172 | /// Search vault embeddings for similar content. |
| 173 | pub fn vault_search( |