Skip to content

Commit

Permalink
Added missing prompt defs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Jan 15, 2025
1 parent 97966db commit 2beb8a5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
59 changes: 58 additions & 1 deletion amazongpt/greasemonkey/amazongpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Adds the magic of AI to Amazon shopping
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.15.7
// @version 2025.1.15.8
// @license MIT
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
Expand Down Expand Up @@ -2273,6 +2273,63 @@
}
}

// Define PROMPTS props/function

const prompts = {

create({ type, prevQuery }) {
const promptSrc = this[type],
modsToApply = promptSrc.mods?.flatMap(mod => typeof mod == 'string' ? mod : mod.mods)
let builtPrompt = `${promptSrc.base} ${modsToApply?.join(' ')}`.trim()
if (prevQuery) builtPrompt = builtPrompt.replace('${prevQuery}', prevQuery)
return builtPrompt
},

randomQA: {
base: 'Generate a single random question on any topic then answer it.',
mods: [
{ type: 'formatting', mods: [
'Try to give an answer that is 50-100 words.',
'Do not type anything but the question and answer.',
'Reply in markdown.'
]},
{ type: 'loopBias', mods: [
'Don\'t provide a question you generated before.',
'Don\'t talk about Canberra, Tokyo, blue whales, photosynthesis, oceans, deserts, '
+ 'mindfulness meditation, the Fibonacci sequence, the liver, Jupiter, '
+ 'the Great Wall of China, Shakespeare, or da Vinci.'
]},
{ type: 'MixerBox AI', mods: [
'Don\'t talk about the benefits of practicing something regularly.'
]}
]
},

relatedQueries: {
get base() {
return `Print me a numbered list of ${
get.related.replyIsQuestion ? 'possible answers to this question'
: 'queries related to this one' }:\n\n"\${prevQuery}"\n\n`
},

get mods() {
return get.related.replyIsQuestion ?
'Generate answers as if in reply to a search engine chatbot asking the question.'
: [{ type: 'variety', mods: [
'Make sure to suggest a variety that can even greatly deviate from the original topic.',
'For example, if the original query asked about someone\'s wife, '
+ 'a good related query could involve a different relative and using their name.',
'Another example, if the query asked about a game/movie/show, '
+ 'good related queries could involve pertinent characters.',
'Another example, if the original query asked how to learn JavaScript, '
+ 'good related queries could ask why/when/where instead, even replace JS w/ other langs.',
'But the key is variety. Do not be repetitive. '
+ 'You must entice user to want to ask one of your related queries.'
]}]
}
}
}

// Define TOGGLE functions

const toggle = {
Expand Down
5 changes: 3 additions & 2 deletions bravegpt/greasemonkey/bravegpt.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-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.15.8
// @version 2025.1.15.9
// @license MIT
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
Expand Down Expand Up @@ -3400,7 +3400,8 @@
}, 7000)

// Get related queries
const payload = await api.createPayload(get.related.api, [{ role: 'user', content: rqPrompt }])
const rqPrompt = augmentQuery(prompts.create({ type: 'relatedQueries', prevQuery: query })),
payload = await api.createPayload(get.related.api, [{ role: 'user', content: rqPrompt }])
return new Promise(resolve => {
const reqMethod = apis[get.related.api].method
const xhrConfig = {
Expand Down

0 comments on commit 2beb8a5

Please sign in to comment.