From 95852452d057f035bc1e05886cd3f06e63ae0004 Mon Sep 17 00:00:00 2001 From: Julian Ng Date: Thu, 22 Jun 2023 12:24:44 +0100 Subject: [PATCH 1/4] Create function to send request to OpenAI --- index.html | 1 + main.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/index.html b/index.html index 503e1c4..dfc6607 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,7 @@ + diff --git a/main.js b/main.js index 67b0f50..a90c750 100644 --- a/main.js +++ b/main.js @@ -1,3 +1,18 @@ +const makeRequest = async (url, data) => { + const response = await fetch(url, { + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${_CONFIG_.API_KEY}`, + // Our _CONFIG data is imported in the HTML file using the