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 4d0dcfb commit 982229d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 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 2025.1.15.5
// @version 2025.1.15.6
// @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 @@ -3407,9 +3407,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 982229d

Please sign in to comment.