8294634f by Administrator

Merge branch '30852_chatbot_chatgpt' into 'master'

30852_chatbot_chatgpt

See merge request !105
2 parents 810e6366 d82cedaa
......@@ -130,14 +130,14 @@ function App() {
if(data.status === 'invalid'){
if(data.limited) {
window.btutil_modalRegisterUpgrade();
window.btutil_maxUsage();
return;
}
if(data && data.status === 'max-tokens') {
window.btutil_maxUsage();
return;
}
window.btutil_modalRegisterUpgrade(true);
window.btutil_maxUsage(true);
return;
}
// "gpt-3.5-turbo"
......
......@@ -346,7 +346,7 @@ async function runOpensource(req, res) {
}
async function authenticate(params) {
console.log("349", params)
let data = await fetch(`${hostapi}/e/authenticate/v2`, {
method: "POST",
headers: {
......@@ -355,12 +355,12 @@ async function authenticate(params) {
body: JSON.stringify(params),
referrer: "https://chatgpt.ai-pro.org"
});
console.log("358", data);
return await data.json();
}
async function getLimitedUsage(params) {
console.log("363", params)
let data = await fetch(`${hostapi}/e/get-usage`, {
method: "POST",
headers: {
......@@ -369,11 +369,11 @@ async function getLimitedUsage(params) {
body: JSON.stringify(params),
referrer: "https://chatgpt.ai-pro.org"
});
console.log("372", data);
return await data.json();
}
async function getUsage(params) {
console.log("376", params)
let data = await fetch(`${hostapi}/e/get-chat-usage`, {
method: "POST",
headers: {
......@@ -382,11 +382,11 @@ async function getUsage(params) {
body: JSON.stringify(params),
referrer: "https://chatgpt.ai-pro.org"
});
console.log("373", data);
return await data.json();
}
async function setUsage(params) {
console.log("389", params)
fetch(`${hostapi}/e/set-usage`, {
method: "POST",
headers: {
......@@ -397,7 +397,7 @@ async function setUsage(params) {
});
}
async function setChatUsage(params) {
console.log("400", params)
fetch(`${hostapi}/e/set-chat-usage`, {
method: "POST",
headers: {
......@@ -416,7 +416,7 @@ async function validation (aiwp_app_id, req, res) {
if (aiwp_logged_in) {
let auth = await authenticate({ "aiwp_logged_in": aiwp_logged_in, "user_event_data": {}, "user_event": "endpoint" });
console.log(auth)
if (!auth.success) {
IS_FREE_USER = true;
if (auth.is_restrict) {
......@@ -429,7 +429,7 @@ async function validation (aiwp_app_id, req, res) {
return false;
}
}
if (!auth.subscription_type || (auth.auth_version === 'v2' && auth.subscription_type.toLowerCase() === 'basic')) {
if (!auth.subscription_type || auth.auth_version === 'v2') {
res.json({ status: "invalid" });
res.status(200);
return false;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!