kopia lustrzana https://github.com/learn-awesome/learndb
updated the response to test simplifyContent()
rodzic
a603edd790
commit
b866b6e7d0
|
@ -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);
|
||||||
|
|
Ładowanie…
Reference in New Issue