Skip to content

Commit

Permalink
Escaped curly braces in regex to widen browser support ↞ [auto-sync f…
Browse files Browse the repository at this point in the history
…rom `adamlui/ai-web-extensions`]
  • Loading branch information
kudo-sync-bot committed Nov 14, 2024
1 parent be5a146 commit 5b9ad0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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.11.14.1
// @version 2024.11.14.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 @@ -281,7 +281,7 @@

prettifyObj(obj) { return JSON.stringify(obj)
.replace(/([{,](?=")|":)/g, '$1 ') // append spaces to { and "
.replace(/((?<!})})/g, ' $1') // prepend spaces to }
.replace(/((?<!\})\})/g, ' $1') // prepend spaces to }
.replace(/"/g, '\'') // replace " w/ '
},

Expand Down Expand Up @@ -3081,7 +3081,7 @@
chunk = extractedChunks.join('')
}
accumulatedChunks = apis[caller.api].accumulatesText ? chunk : accumulatedChunks + chunk
if (/^(?:{|event:)/.test(accumulatedChunks)) api.tryNew(caller)
if (/^(?:\{|event:)/.test(accumulatedChunks)) api.tryNew(caller)
else {
try { // to show stream text
let textToShow = ''
Expand Down Expand Up @@ -3172,7 +3172,7 @@
if (caller.status != 'done') {
log.debug('Response text', respText)
const failMatch = failFlagsAndURLs.exec(respText)
if (failMatch || /^(?:{|event:)/.test(respText)) {
if (failMatch || /^(?:\{|event:)/.test(respText)) {
if (failMatch) log.error('Fail flag detected', `'${failMatch[0]}'`)
api.tryNew(caller)
} else {
Expand Down

0 comments on commit 5b9ad0c

Please sign in to comment.