kopia lustrzana https://github.com/learn-awesome/learndb
removed the import
rodzic
4cf2d5e1d1
commit
586030a79a
|
@ -1,6 +1,6 @@
|
||||||
const fetch = require('node-fetch'); // Import for webscraping in fetchContentFromURL()
|
const fetch = require('node-fetch'); // Import for webscraping in fetchContentFromURL()
|
||||||
// import { OpenAIApi, Configuration } from 'openai';
|
// import { OpenAIApi, Configuration } from 'openai';
|
||||||
const { OpenAIApi, Configuration } = require('openai');
|
const { Configuration, OpenAIApi } = require('openai');
|
||||||
|
|
||||||
// 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) {
|
||||||
|
@ -117,7 +117,7 @@ export async function handler(event) {
|
||||||
const simplifiedContent = simplifyContent(fetchedContent);
|
const simplifiedContent = simplifyContent(fetchedContent);
|
||||||
|
|
||||||
// Step 3: Perform GPT analysis for media type and topics
|
// Step 3: Perform GPT analysis for media type and topics
|
||||||
const responseText = await performGPTAnalysis(simplifiedContent, apiKey);
|
// const responseText = await performGPTAnalysis(simplifiedContent, apiKey);
|
||||||
|
|
||||||
// Step 4: Map inferred values to predefined formats and topics
|
// Step 4: Map inferred values to predefined formats and topics
|
||||||
// const { predefinedMediaType, predefinedTopics } = mapInferredValues(inferredMediaType, extractedTopics);
|
// const { predefinedMediaType, predefinedTopics } = mapInferredValues(inferredMediaType, extractedTopics);
|
||||||
|
@ -128,7 +128,7 @@ export async function handler(event) {
|
||||||
// Return the formatted response
|
// Return the formatted response
|
||||||
return {
|
return {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: JSON.stringify(responseText),
|
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