This commit is contained in:
Patrick_Pluto 2024-09-19 16:24:16 +02:00
parent 908272edcf
commit cb8d545764
2 changed files with 20 additions and 20 deletions

View file

@ -10,30 +10,30 @@ onmessage = function (e) {
};
switch (functionName) {
case "getAccess":
axios.get('https://localhost:5000/interstellar/api/ai_create')
axios.get('https://127.0.0.1:5000/interstellar/api/ai_create')
.then(Response => {
postMessage(Response.data.access_token)
}).catch(error => {
console.error("Error with GET Token request:", error)
})
postMessage(Response.data.access_token)
}).catch(error => {
console.error("Error with GET Token request:", error)
})
break
case "postRequest":
axios.post('https://localhost:5000/interstellar/api/ai_send', data)
axios.post('https://127.0.0.1:5000/interstellar/api/ai_send', data)
.then(Response => {
postMessage(Response.data)
}).catch(error => {
console.error("Error:", error)
console.error("Error:", error)
})
break
case "getResponse":
axios.get('https://localhost:5000/interstellar/api/ai_get?access_token='+access_token)
.then(Response => {
postMessage(Response.data.response)
}).catch(error => {
console.error("Error with GET response request:", error)
})
axios.get('https://127.0.0.1:5000/interstellar/api/ai_get?access_token=' + access_token)
.then(Response => {
postMessage(Response.data.response)
}).catch(error => {
console.error("Error with GET response request:", error)
})
break
}
}