Skip to content

Commit

Permalink
Condensed stream done check ↞ [auto-sync from https://github.com/adam…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Jan 15, 2025
1 parent 6f1f5ae commit 4d0dcfb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions chatgpt/amazongpt/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.15.4
// @version 2025.1.15.5
// @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 @@ -2685,9 +2685,8 @@
function processStreamText({ done, value }) {

// Handle stream done
if (done) { handleProcessCompletion() ; return }
let chunk = new TextDecoder('utf8').decode(new Uint8Array(value))
if (chunk.includes(apis[caller.api].watermark)) { handleProcessCompletion() ; return }
if (done || chunk.includes(apis[caller.api].watermark)) return handleProcessCompletion()
this.timeout = setTimeout(handleProcessCompletion, 500) // since reader.read() doesn't signal done in Chromium

// Process/show chunk
Expand Down

0 comments on commit 4d0dcfb

Please sign in to comment.