feat: solution for 'Экзамен: RAG-агент с ChromaDB и веб-поиском'
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import fetch from "node-fetch";
|
||||
|
||||
export async function fetchWebContent(url) {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error ${response.status}`);
|
||||
}
|
||||
const text = await response.text();
|
||||
return text;
|
||||
} catch (err) {
|
||||
console.error(`Failed to fetch ${url}: ${err.message}`);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user