Open lima12 opened 3 hours ago
https://neuranet-ai.com/ well look like they shutting down
Here a temp fix for this issue. Here what you need:
async function performSearch(query) {
const apiKey = 'replace-this';
const cx = 'replace-this-too';
const url = `https://www.googleapis.com/customsearch/v1?q=${encodeURIComponent(query)}&key=${apiKey}&cx=${cx}`;
try {
const response = await axios.get(url);
const entries = response.data.items;
if (Array.isArray(entries)) {
const resultObject = entries.slice(0, 5).map((entry, index) => {
const title = entry.title;
const result = entry.snippet;
const url = entry.link;
return {
[`result_${index + 1}`]: { title, result, url }
};
});
const note = {
"Note": "Search results provide only an overview and do not offer sufficiently detailed information. Please continue by using the Search Website tool and search websites to find relevant information about the topic."
};
const finalResult = JSON.stringify(
resultObject.reduce((acc, curr) => Object.assign(acc, curr), note),
null,
2
);
/*console.log(finalResult); //For debug purpose only!*/
return finalResult;
} else {
console.error('Entries is not an array:', entries);
throw new Error('Unexpected response format');
}
} catch (error) {
console.error('Request failed:', error.response?.data || error.message);
throw new Error(`Failed to perform the search request: ${error.message}`);
}
}
This isn't official solution! im just a scripty pasta dude.
step to replicate:
error while performing web search: Error: Failed to perform the search request: getaddrinfo ENOTFOUND search.neuranet-ai.com