Skip to content

Commit 09c7677

Browse files
committed
Improved api.pick() filtering
+ Excluded `get.related` calls from unneeded `get.reply` exclusions ± Excluded GET APIs for `get.reply` if msg history established
1 parent 2b6f1e8 commit 09c7677

File tree

4 files changed

+36
-24
lines changed

4 files changed

+36
-24
lines changed

amazongpt/greasemonkey/amazongpt.user.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @description Adds the magic of AI to Amazon shopping
44
// @author KudoAI
55
// @namespace https://kudoai.com
6-
// @version 2025.1.25.7
6+
// @version 2025.1.25.8
77
// @license MIT
88
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
99
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
@@ -2534,11 +2534,14 @@
25342534
pick(caller) {
25352535
log.caller = `get.${caller.name}() » api.pick()`
25362536
const untriedAPIs = Object.keys(apis).filter(api =>
2537-
api != ( caller == get.reply ? 'OpenAI' : '' ) // exclude OpenAI for get.reply() since Proxy Mode
2538-
&& !caller.triedAPIs.some(entry => // exclude tried APIs
2539-
Object.prototype.hasOwnProperty.call(entry, api))
2540-
&& ( // exclude unstreamable APIs if !config.streamingDisabled
2541-
config.streamingDisabled || apis[api].streamable))
2537+
!caller.triedAPIs.some(entry => // exclude tried APIs
2538+
Object.prototype.hasOwnProperty.call(entry, api))
2539+
&& ( // handle get.reply exclusions
2540+
api != 'OpenAI' // exclude OpenAI since api.pick in get.reply only in Proxy Mode
2541+
&& ( // exclude unstreamable APIs if !config.streamingDisabled
2542+
config.streamingDisabled || apis[api].streamable)
2543+
&& !( // exclude GET APIs if msg history established
2544+
msgChain.length > 2 && apis[api].method == 'GET')))
25422545
const chosenAPI = untriedAPIs[ // pick random array entry
25432546
Math.floor(chatgpt.randomFloat() * untriedAPIs.length)]
25442547
if (!chosenAPI) { log.error('No proxy APIs left untried') ; return null }

bravegpt/greasemonkey/bravegpt.user.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.1.25.8
151+
// @version 2025.1.25.9
152152
// @license MIT
153153
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
154154
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
@@ -3232,11 +3232,14 @@
32323232
pick(caller) {
32333233
log.caller = `get.${caller.name}() » api.pick()`
32343234
const untriedAPIs = Object.keys(apis).filter(api =>
3235-
api != ( caller == get.reply ? 'OpenAI' : '' ) // exclude OpenAI for get.reply() since Proxy Mode
3236-
&& !caller.triedAPIs.some(entry => // exclude tried APIs
3237-
Object.prototype.hasOwnProperty.call(entry, api))
3238-
&& ( // exclude unstreamable APIs if !config.streamingDisabled
3239-
config.streamingDisabled || apis[api].streamable))
3235+
!caller.triedAPIs.some(entry => // exclude tried APIs
3236+
Object.prototype.hasOwnProperty.call(entry, api))
3237+
&& caller == 'get.related' || ( // handle get.reply exclusions
3238+
api != 'OpenAI' // exclude OpenAI since api.pick in get.reply only in Proxy Mode
3239+
&& ( // exclude unstreamable APIs if !config.streamingDisabled
3240+
config.streamingDisabled || apis[api].streamable)
3241+
&& !( // exclude GET APIs if msg history established
3242+
msgChain.length > 2 && apis[api].method == 'GET')))
32403243
const chosenAPI = untriedAPIs[ // pick random array entry
32413244
Math.floor(chatgpt.randomFloat() * untriedAPIs.length)]
32423245
if (!chosenAPI) { log.error('No proxy APIs left untried') ; return null }

duckduckgpt/greasemonkey/duckduckgpt.user.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.1.25.8
151+
// @version 2025.1.25.9
152152
// @license MIT
153153
// @icon https://assets.ddgpt.com/images/icons/duckduckgpt/icon48.png?v=06af076
154154
// @icon64 https://assets.ddgpt.com/images/icons/duckduckgpt/icon64.png?v=06af076
@@ -3118,11 +3118,14 @@
31183118
pick(caller) {
31193119
log.caller = `get.${caller.name}() » api.pick()`
31203120
const untriedAPIs = Object.keys(apis).filter(api =>
3121-
api != ( caller == get.reply ? 'OpenAI' : '' ) // exclude OpenAI for get.reply() since Proxy Mode
3122-
&& !caller.triedAPIs.some(entry => // exclude tried APIs
3123-
Object.prototype.hasOwnProperty.call(entry, api))
3124-
&& ( // exclude unstreamable APIs if !config.streamingDisabled
3125-
config.streamingDisabled || apis[api].streamable))
3121+
!caller.triedAPIs.some(entry => // exclude tried APIs
3122+
Object.prototype.hasOwnProperty.call(entry, api))
3123+
&& caller == 'get.related' || ( // handle get.reply exclusions
3124+
api != 'OpenAI' // exclude OpenAI since api.pick in get.reply only in Proxy Mode
3125+
&& ( // exclude unstreamable APIs if !config.streamingDisabled
3126+
config.streamingDisabled || apis[api].streamable)
3127+
&& !( // exclude GET APIs if msg history established
3128+
msgChain.length > 2 && apis[api].method == 'GET')))
31263129
const chosenAPI = untriedAPIs[ // pick random array entry
31273130
Math.floor(chatgpt.randomFloat() * untriedAPIs.length)]
31283131
if (!chosenAPI) { log.error('No proxy APIs left untried') ; return null }

googlegpt/greasemonkey/googlegpt.user.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
150150
// @author KudoAI
151151
// @namespace https://kudoai.com
152-
// @version 2025.1.25.8
152+
// @version 2025.1.25.9
153153
// @license MIT
154154
// @icon https://assets.googlegpt.io/images/icons/googlegpt/black/icon48.png?v=59409b2
155155
// @icon64 https://assets.googlegpt.io/images/icons/googlegpt/black/icon64.png?v=59409b2
@@ -3413,11 +3413,14 @@
34133413
pick(caller) {
34143414
log.caller = `get.${caller.name}() » api.pick()`
34153415
const untriedAPIs = Object.keys(apis).filter(api =>
3416-
api != ( caller == get.reply ? 'OpenAI' : '' ) // exclude OpenAI for get.reply() since Proxy Mode
3417-
&& !caller.triedAPIs.some(entry => // exclude tried APIs
3418-
Object.prototype.hasOwnProperty.call(entry, api))
3419-
&& ( // exclude unstreamable APIs if !config.streamingDisabled
3420-
config.streamingDisabled || apis[api].streamable))
3416+
!caller.triedAPIs.some(entry => // exclude tried APIs
3417+
Object.prototype.hasOwnProperty.call(entry, api))
3418+
&& caller == 'get.related' || ( // handle get.reply exclusions
3419+
api != 'OpenAI' // exclude OpenAI since api.pick in get.reply only in Proxy Mode
3420+
&& ( // exclude unstreamable APIs if !config.streamingDisabled
3421+
config.streamingDisabled || apis[api].streamable)
3422+
&& !( // exclude GET APIs if msg history established
3423+
msgChain.length > 2 && apis[api].method == 'GET')))
34213424
const chosenAPI = untriedAPIs[ // pick random array entry
34223425
Math.floor(chatgpt.randomFloat() * untriedAPIs.length)]
34233426
if (!chosenAPI) { log.error('No proxy APIs left untried') ; return null }

0 commit comments

Comments
 (0)