Skip to content

Commit

Permalink
Added clear Chromium timeout to fail flag match + no recursion on nex…
Browse files Browse the repository at this point in the history
…t chunk read in `handleProcessStream()`
  • Loading branch information
adamlui committed Jan 26, 2025
1 parent 9f29a70 commit 0cda891
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions amazongpt/greasemonkey/amazongpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Adds the magic of AI to Amazon shopping
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.25.18
// @version 2025.1.25.19
// @license MIT
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
Expand Down Expand Up @@ -2676,6 +2676,7 @@
const failMatch = failFlagsAndURLs.exec(textToShow)
if (failMatch) {
log.dev('Text to show', textToShow) ; log.error('Fail flag detected', `'${failMatch[0]}'`)
if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
if (caller.status != 'done' && !caller.sender) api.tryNew(caller)
return
} else if (caller.status != 'done') { // app waiting or sending
Expand All @@ -2688,7 +2689,8 @@

// Read next chunk, process if designated sender
return reader.read().then(({ done, value }) => {
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI)
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI) // recurse
else if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
}).catch(err => log.error('Error reading stream', err.message))
}

Expand Down
6 changes: 4 additions & 2 deletions bravegpt/greasemonkey/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 2025.1.25.19
// @version 2025.1.25.20
// @license MIT
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
Expand Down Expand Up @@ -3426,6 +3426,7 @@
const failMatch = failFlagsAndURLs.exec(textToShow)
if (failMatch) {
log.dev('Text to show', textToShow) ; log.error('Fail flag detected', `'${failMatch[0]}'`)
if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
if (caller.status != 'done' && !caller.sender) api.tryNew(caller)
return
} else if (caller.status != 'done') { // app waiting or sending
Expand All @@ -3438,7 +3439,8 @@

// Read next chunk, process if designated sender
return reader.read().then(({ done, value }) => {
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI)
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI) // recurse
else if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
}).catch(err => log.error('Error reading stream', err.message))
}

Expand Down
6 changes: 4 additions & 2 deletions duckduckgpt/greasemonkey/duckduckgpt.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-DuckDuckGo (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.25.21
// @version 2025.1.25.22
// @license MIT
// @icon https://assets.ddgpt.com/images/icons/duckduckgpt/icon48.png?v=06af076
// @icon64 https://assets.ddgpt.com/images/icons/duckduckgpt/icon64.png?v=06af076
Expand Down Expand Up @@ -3310,6 +3310,7 @@
const failMatch = failFlagsAndURLs.exec(textToShow)
if (failMatch) {
log.dev('Text to show', textToShow) ; log.error('Fail flag detected', `'${failMatch[0]}'`)
if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
if (caller.status != 'done' && !caller.sender) api.tryNew(caller)
return
} else if (caller.status != 'done') { // app waiting or sending
Expand All @@ -3322,7 +3323,8 @@

// Read next chunk, process if designated sender
return reader.read().then(({ done, value }) => {
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI)
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI) // recurse
else if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
}).catch(err => log.error('Error reading stream', err.message))
}

Expand Down
6 changes: 4 additions & 2 deletions googlegpt/greasemonkey/googlegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.25.19
// @version 2025.1.25.20
// @license MIT
// @icon https://assets.googlegpt.io/images/icons/googlegpt/black/icon48.png?v=59409b2
// @icon64 https://assets.googlegpt.io/images/icons/googlegpt/black/icon64.png?v=59409b2
Expand Down Expand Up @@ -3607,6 +3607,7 @@
const failMatch = failFlagsAndURLs.exec(textToShow)
if (failMatch) {
log.dev('Text to show', textToShow) ; log.error('Fail flag detected', `'${failMatch[0]}'`)
if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
if (caller.status != 'done' && !caller.sender) api.tryNew(caller)
return
} else if (caller.status != 'done') { // app waiting or sending
Expand All @@ -3619,7 +3620,8 @@

// Read next chunk, process if designated sender
return reader.read().then(({ done, value }) => {
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI)
if (caller.sender == callerAPI) processStreamText({ done, value }, callerAPI) // recurse
else if (env.browser.isChromium) clearTimeout(this.timeout) // skip handleProcessCompletion()
}).catch(err => log.error('Error reading stream', err.message))
}

Expand Down

0 comments on commit 0cda891

Please sign in to comment.