by Khian Victory D. Calderon
- In your javascript file:
fetch("https://khianvictorycalderon.github.io/NLP-Frontend-API/nlp.js") .then(data => data.json) .then(data => { eval(data); });
- Create
src/global.d.ts:export {}; // ensures this file is treated as a module declare global { interface Window { API: { generateResponse: (input: string[]) => string; }; } }
- Then in your
App.tsx(Using axios):const res = await axios.get("https://khianvictorycalderon.github.io/NLP-Frontend-API/nlp.js"); eval(res.data); const conversation = window.API.getResponse(["Hi there"]);
