Skip to content

Commit

Permalink
Merged done signal check for parsable APIs using new `respPatterns.do…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Jan 26, 2025
1 parent 9d5b184 commit 0516520
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions 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.26.3
// @version 2025.1.26.4
// @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 @@ -3596,16 +3596,15 @@
else { // AI response
apis.GPTforLove.parentID = chunkObjs[0].id || null // for contextual replies
chunkObjs.forEach(obj => replyChunk += obj.delta || '') // accumulate AI reply text
if (respChunk.includes('"finish_reason":"stop"')) isDone = true
}
} else if (callerAPI == 'MixerBox AI') { // extract/normalize AI reply data
replyChunk = [...respChunk.matchAll(/data:(.*)/g)] // arrayify data
.filter(match => !/message_(?:start|end)|done/.test(match)) // exclude signals
.map(match => // normalize whitespace
match[1].replace(/\[SPACE\]/g, ' ').replace(/\[NEWLINE\]/g, '\n'))
.join('') // stringify AI reply text
if (/data:(?:message_end|done)/.test(respChunk)) isDone = true
} textToShow += replyChunk
if (new RegExp(apis[callerAPI].respPatterns?.done).test(respChunk)) isDone = true
}

// Show accumulated reply chunks
Expand Down

0 comments on commit 0516520

Please sign in to comment.