updated the response to test simplifyContent()

pull/73/head
Huda Joad 2023-11-24 23:56:28 +03:00
rodzic a603edd790
commit b866b6e7d0
1 zmienionych plików z 2 dodań i 4 usunięć

Wyświetl plik

@ -1,7 +1,5 @@
const https = require('https'); // Import for webscraping (fetchContentFromURL(url) function const fetch = require('node-fetch'); // Import for webscraping (fetchContentFromURL(url) function
import { OpenAIApi, Configuration } from 'openai'; import { OpenAIApi, Configuration } from 'openai';
// import { fetch } from 'node-fetch';
const fetch = require('node-fetch');
// Function to fetch content from URL using a web scraping service // Function to fetch content from URL using a web scraping service
async function fetchContentFromURL(url) { async function fetchContentFromURL(url) {
@ -102,7 +100,7 @@ export async function handler(event) {
// Return the formatted response // Return the formatted response
return { return {
statusCode: 200, statusCode: 200,
body: JSON.stringify(fetchedContent), body: JSON.stringify(simplifiedContent),
}; };
} catch (error) { } catch (error) {
console.error('Error occurred:', error.message); console.error('Error occurred:', error.message);