Skip to content

Commit

Permalink
Added skip fragmented responses ↞ [auto-sync from adamlui/ai-apps]
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Oct 17, 2024
1 parent e5fdc20 commit 8a3282d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 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 2024.10.17.1
// @version 2024.10.17.2
// @license MIT
// @icon https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png?af89302
// @icon64 https://media.ddgpt.com/images/icons/duckduckgpt/icon64.png?af89302
Expand Down Expand Up @@ -3077,7 +3077,7 @@
chunk = extractedChunks.join('')
}
accumulatedChunks = apis[caller.api].accumulatesText ? chunk : accumulatedChunks + chunk
if (accumulatedChunks.startsWith('{')) api.tryNew(caller)
if (/^(?:{|event:)/.test(accumulatedChunks)) api.tryNew(caller)
else {
try { // to show stream text
let textToShow = ''
Expand Down Expand Up @@ -3168,7 +3168,7 @@
if (caller.status != 'done') {
log.debug('Response text', respText)
const failMatch = failFlagsAndURLs.exec(respText)
if (failMatch || respText.startsWith('{')) {
if (failMatch || /^(?:{|event:)/.test(respText) {
if (failMatch) log.error('Fail flag detected', `'${failMatch[0]}'`)
api.tryNew(caller)
} else {
Expand Down

0 comments on commit 8a3282d

Please sign in to comment.