I'm trying to make an AI text generator (using an API) and it says "ReferenceError: require is not defined
", and I don't have a package JSON
or HTML
outside of it because I'm running it from a Snap! JavaScript function reporter. Any ideas? I've thought of putting a function in the variable box, but I don't know what goes in there. Code:
const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML
deepai.setApiKey('quickstart-QUdJIGlzIGNvbWluZy4uLi4K');
(async function() {
var resp = await deepai.callStandardApi("text-generator", {
text: "YOUR_TEXT_HERE",
});
console.log(resp);
})()