(siteIndexingConfig: SiteIndexingConfig)
| 1163 | } |
| 1164 | |
| 1165 | private async updateMetadataInSqlite(siteIndexingConfig: SiteIndexingConfig) { |
| 1166 | const { startUrl, title, faviconUrl } = siteIndexingConfig; |
| 1167 | const favicon = faviconUrl || (await fetchFavicon(new URL(startUrl))); |
| 1168 | if (!this.config.selectedModelByRole.embed) { |
| 1169 | console.warn( |
| 1170 | `Attempting to add metadata for ${startUrl} without embeddings provider specified`, |
| 1171 | ); |
| 1172 | return; |
| 1173 | } |
| 1174 | |
| 1175 | const db = await this.getOrCreateSqliteDb(); |
| 1176 | |
| 1177 | await db.run( |
| 1178 | `UPDATE ${DocsService.sqlitebTableName} SET title = ?, favicon = ? WHERE startUrl = ? AND embeddingsProviderId = ?`, |
| 1179 | title, |
| 1180 | favicon, |
| 1181 | startUrl, |
| 1182 | this.config.selectedModelByRole.embed.embeddingId, |
| 1183 | ); |
| 1184 | } |
| 1185 | |
| 1186 | private addToConfig(siteIndexingConfig: SiteIndexingConfig) { |
| 1187 | // Handles the case where a user has manually added the doc to config.json |
no test coverage detected