Skip to content

Commit 2a0bf32

Browse files
committed
Improved prompts.create()
± Added `mods` option + Expanded symbols checked before appending missing punctuation + Added lowercase 1st char of mod if preceded by one w/ trailing comma
1 parent 09877d6 commit 2a0bf32

File tree

4 files changed

+57
-20
lines changed

4 files changed

+57
-20
lines changed

amazongpt/greasemonkey/amazongpt.user.js

Lines changed: 15 additions & 5 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.19.5
6+
// @version 2025.1.19.6
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
@@ -2189,13 +2189,23 @@
21892189

21902190
augment(prompt) { return `${prompt} {{reply in the language ${config.replyLang}}}` },
21912191

2192-
create({ type }) {
2193-
const promptSrc = this[type],
2194-
modsToApply = promptSrc.mods?.flatMap(mod => typeof mod == 'string' ? mod : mod.mods) || [],
2195-
promptElems = [promptSrc.base, ...modsToApply].map(elem => elem += /[\n.]$/.test(elem) ? '' : '.')
2192+
create({ type, mods }) {
2193+
mods = [].concat(mods || []) // normalize mods into array
2194+
const promptSrc = this[type]
2195+
const modsToApply = promptSrc.mods?.flatMap(mod =>
2196+
!mods.length && typeof mod == 'string' ? mod // string if no mods passed
2197+
: !mods.length || mods.includes(mod.type) ? mod.mods : [] // sub-array if no mods passed or includes type
2198+
) || []
2199+
const promptElems = [promptSrc.base || '', ...modsToApply].map((elem, idx, array) => {
2200+
if (elem && !/[\n,.!]$/.test(elem)) elem += '.' // append missing punctuation
2201+
if (idx > 0 && array[idx -1].endsWith(',')) // prev elem ended in comma...
2202+
elem = elem.charAt(0).toLowerCase() + elem.slice(1) // ...so lowercase 1st char of this one
2203+
return elem
2204+
})
21962205
return promptElems.join(' ').trim()
21972206
},
21982207

2208+
21992209
informCategory: {
22002210
get base() {
22012211
return `Tell me more about what to look for when shopping for this category: ${document.title}`

bravegpt/greasemonkey/bravegpt.user.js

Lines changed: 14 additions & 5 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.19.5
151+
// @version 2025.1.19.6
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
@@ -2785,10 +2785,19 @@
27852785

27862786
augment(prompt) { return `${prompt} {{reply in the language ${config.replyLang}}}` },
27872787

2788-
create({ type, prevQuery }) {
2789-
const promptSrc = this[type],
2790-
modsToApply = promptSrc.mods?.flatMap(mod => typeof mod == 'string' ? mod : mod.mods) || [],
2791-
promptElems = [promptSrc.base, ...modsToApply].map(elem => elem += /[\n.]$/.test(elem) ? '' : '.')
2788+
create({ type, mods, prevQuery }) {
2789+
mods = [].concat(mods || []) // normalize mods into array
2790+
const promptSrc = this[type]
2791+
const modsToApply = promptSrc.mods?.flatMap(mod =>
2792+
!mods.length && typeof mod == 'string' ? mod // string if no mods passed
2793+
: !mods.length || mods.includes(mod.type) ? mod.mods : [] // sub-array if no mods passed or includes type
2794+
) || []
2795+
const promptElems = [promptSrc.base || '', ...modsToApply].map((elem, idx, array) => {
2796+
if (elem && !/[\n,.!]$/.test(elem)) elem += '.' // append missing punctuation
2797+
if (idx > 0 && array[idx -1].endsWith(',')) // prev elem ended in comma...
2798+
elem = elem.charAt(0).toLowerCase() + elem.slice(1) // ...so lowercase 1st char of this one
2799+
return elem
2800+
})
27922801
let builtPrompt = promptElems.join(' ').trim()
27932802
if (prevQuery) builtPrompt = builtPrompt.replace('${prevQuery}', prevQuery)
27942803
return builtPrompt

duckduckgpt/greasemonkey/duckduckgpt.user.js

Lines changed: 14 additions & 5 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.19.5
151+
// @version 2025.1.19.6
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
@@ -2672,10 +2672,19 @@
26722672

26732673
augment(prompt) { return `${prompt} {{reply in the language ${config.replyLang}}}` },
26742674

2675-
create({ type, prevQuery }) {
2676-
const promptSrc = this[type],
2677-
modsToApply = promptSrc.mods?.flatMap(mod => typeof mod == 'string' ? mod : mod.mods) || [],
2678-
promptElems = [promptSrc.base, ...modsToApply].map(elem => elem += /[\n.]$/.test(elem) ? '' : '.')
2675+
create({ type, mods, prevQuery }) {
2676+
mods = [].concat(mods || []) // normalize mods into array
2677+
const promptSrc = this[type]
2678+
const modsToApply = promptSrc.mods?.flatMap(mod =>
2679+
!mods.length && typeof mod == 'string' ? mod // string if no mods passed
2680+
: !mods.length || mods.includes(mod.type) ? mod.mods : [] // sub-array if no mods passed or includes type
2681+
) || []
2682+
const promptElems = [promptSrc.base || '', ...modsToApply].map((elem, idx, array) => {
2683+
if (elem && !/[\n,.!]$/.test(elem)) elem += '.' // append missing punctuation
2684+
if (idx > 0 && array[idx -1].endsWith(',')) // prev elem ended in comma...
2685+
elem = elem.charAt(0).toLowerCase() + elem.slice(1) // ...so lowercase 1st char of this one
2686+
return elem
2687+
})
26792688
let builtPrompt = promptElems.join(' ').trim()
26802689
if (prevQuery) builtPrompt = builtPrompt.replace('${prevQuery}', prevQuery)
26812690
return builtPrompt

googlegpt/greasemonkey/googlegpt.user.js

Lines changed: 14 additions & 5 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.19.5
152+
// @version 2025.1.19.6
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
@@ -2960,10 +2960,19 @@
29602960

29612961
augment(prompt) { return `${prompt} {{reply in the language ${config.replyLang}}}` },
29622962

2963-
create({ type, prevQuery }) {
2964-
const promptSrc = this[type],
2965-
modsToApply = promptSrc.mods?.flatMap(mod => typeof mod == 'string' ? mod : mod.mods) || [],
2966-
promptElems = [promptSrc.base, ...modsToApply].map(elem => elem += /[\n.]$/.test(elem) ? '' : '.')
2963+
create({ type, mods, prevQuery }) {
2964+
mods = [].concat(mods || []) // normalize mods into array
2965+
const promptSrc = this[type]
2966+
const modsToApply = promptSrc.mods?.flatMap(mod =>
2967+
!mods.length && typeof mod == 'string' ? mod // string if no mods passed
2968+
: !mods.length || mods.includes(mod.type) ? mod.mods : [] // sub-array if no mods passed or includes type
2969+
) || []
2970+
const promptElems = [promptSrc.base || '', ...modsToApply].map((elem, idx, array) => {
2971+
if (elem && !/[\n,.!]$/.test(elem)) elem += '.' // append missing punctuation
2972+
if (idx > 0 && array[idx -1].endsWith(',')) // prev elem ended in comma...
2973+
elem = elem.charAt(0).toLowerCase() + elem.slice(1) // ...so lowercase 1st char of this one
2974+
return elem
2975+
})
29672976
let builtPrompt = promptElems.join(' ').trim()
29682977
if (prevQuery) builtPrompt = builtPrompt.replace('${prevQuery}', prevQuery)
29692978
return builtPrompt

0 commit comments

Comments
 (0)