mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-29 11:18:25 +08:00
update for chatgpt3.5 web (#562, #551#issuecomment-1803668105, #543#issuecomment-1803666487)
This commit is contained in:
@@ -84,7 +84,8 @@ export async function generateAnswersWithChatgptWebApi(port, question, session,
|
||||
})
|
||||
.join('; ')
|
||||
|
||||
if (!config.chatgptArkoseReqUrl)
|
||||
const needArkoseToken = !usedModel.includes(Models[chatgptWebModelKeys[0]].value)
|
||||
if (needArkoseToken && !config.chatgptArkoseReqUrl)
|
||||
throw new Error(
|
||||
t('Please login at https://chat.openai.com first') +
|
||||
'\n\n' +
|
||||
@@ -92,20 +93,19 @@ export async function generateAnswersWithChatgptWebApi(port, question, session,
|
||||
"Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.",
|
||||
),
|
||||
)
|
||||
const arkoseToken = await fetch(
|
||||
config.chatgptArkoseReqUrl + '?' + config.chatgptArkoseReqParams,
|
||||
{
|
||||
method: 'POST',
|
||||
body: config.chatgptArkoseReqForm,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
},
|
||||
)
|
||||
.then((resp) => resp.json())
|
||||
.then((resp) => resp.token)
|
||||
.catch(() => null)
|
||||
if (!arkoseToken)
|
||||
const arkoseToken = config.chatgptArkoseReqUrl
|
||||
? await fetch(config.chatgptArkoseReqUrl + '?' + config.chatgptArkoseReqParams, {
|
||||
method: 'POST',
|
||||
body: config.chatgptArkoseReqForm,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
})
|
||||
.then((resp) => resp.json())
|
||||
.then((resp) => resp.token)
|
||||
.catch(() => null)
|
||||
: null
|
||||
if (needArkoseToken && !arkoseToken)
|
||||
throw new Error(
|
||||
t('Failed to get arkose token.') +
|
||||
'\n\n' +
|
||||
|
||||
Reference in New Issue
Block a user