feat: add error handling to SearXNG search provider

This commit is contained in:
n4ze3m 2024-12-01 17:43:14 +05:30
parent 0226de7c39
commit 379ba6996d

View File

@ -50,6 +50,7 @@ export const searxngSearch = async (query: string) => {
} }
const docs: Document<Record<string, any>>[] = [] const docs: Document<Record<string, any>>[] = []
try {
for (const result of searchResults) { for (const result of searchResults) {
const loader = new PageAssistHtmlLoader({ const loader = new PageAssistHtmlLoader({
html: "", html: "",
@ -61,6 +62,9 @@ export const searxngSearch = async (query: string) => {
docs.push(doc) docs.push(doc)
}) })
} }
} catch (error) {
console.error(error)
}
const ollamaUrl = await getOllamaURL() const ollamaUrl = await getOllamaURL()
const embeddingModel = await defaultEmbeddingModelForRag() const embeddingModel = await defaultEmbeddingModelForRag()