Skip to content

Commit

Permalink
Corrected API conditions in get.related() ↞ [auto-sync from `adamlu…
Browse files Browse the repository at this point in the history
…i/chatgpt-apps/bravegpt`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Jun 24, 2024
1 parent aa98dd5 commit 3b83ddc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions chatgpt/bravegpt/bravegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2024.6.24.1
// @version 2024.6.24.2
// @license MIT
// @icon https://media.bravegpt.com/images/icons/bravegpt/icon48.png?0a9e287
// @icon64 https://media.bravegpt.com/images/icons/bravegpt/icon64.png?0a9e287
Expand Down Expand Up @@ -1342,11 +1342,12 @@ setTimeout(async () => {
get.related.api = api.pick(get.related)
if (!get.related.api) return // no more proxy APIs left untried

if (!config.proxyAPIenabled) // init OpenAI key
// Init OpenAI key
if (get.related.api == 'OpenAI')
config.openAIkey = await Promise.race([getOpenAItoken(), new Promise(reject => setTimeout(reject, 3000))])
else setTimeout(() => { // try diff API after 7s of no response
if (get.related.status != 'done')
api.tryNew(get.related, 'timeout') }, 7000)

// Try diff API after 7s of no response
setTimeout(() => { if (get.related.status != 'done') api.tryNew(get.related, 'timeout') }, 7000)

return new Promise((resolve, reject) => {
const rqPrompt = 'Show a numbered list of queries related to this one:\n\n' + query
Expand Down

0 comments on commit 3b83ddc

Please sign in to comment.