Skip to content

Commit

Permalink
Fixed Reply Language setting stopped persisting (https://greasyfork.o…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Jan 13, 2025
1 parent 2394a77 commit 57b54b4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions chatgpt/duckduckgpt/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 2025.1.12.1
// @version 2025.1.12.2
// @license MIT
// @icon https://assets.ddgpt.com/images/icons/duckduckgpt/icon48.png?v=06af076
// @icon64 https://assets.ddgpt.com/images/icons/duckduckgpt/icon64.png?v=06af076
Expand Down Expand Up @@ -562,7 +562,7 @@
}})
Object.assign(config, { minFontSize: 11, maxFontSize: 24, lineHeightRatio: 1.28 })
settings.load([...Object.keys(settings.controls), 'expanded', 'fontSize', 'minimized', 'notFirstRun'])
if (!config.replyLanguage) settings.save('replyLanguage', env.browser.language) // init reply language if unset
if (!config.replyLang) settings.save('replyLang', env.browser.language) // init reply language if unset
if (!config.fontSize) settings.save('fontSize', 14) // init reply font size if unset
if (!env.streamingSupported.byBrowser || !env.streamingSupported.byScriptManager)
settings.save('streamingDisabled', true) // disable Streaming in unspported env
Expand Down Expand Up @@ -1189,15 +1189,15 @@
log.caller = 'modals.replyLang()'
while (true) {
let replyLang = prompt(
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLanguage)
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLang)
if (replyLang == null) break // user cancelled so do nothing
else if (!/\d/.test(replyLang)) {
replyLang = ( // auto-case for menu/alert aesthetics
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
: replyLang.charAt(0).toUpperCase() + replyLang.slice(1).toLowerCase() )
log.debug('Saving reply language...')
settings.save('replyLanguage', replyLang || env.browser.language)
log.debug(`Success! config.replyLanguage = ${config.replyLanguage}`)
settings.save('replyLang', replyLang || env.browser.language)
log.debug(`Success! config.replyLang = ${config.replyLang}`)
modals.alert(`${app.msgs.alert_langUpdated}!`, // title
`${app.name} ${app.msgs.alert_willReplyIn} ` // msg
+ ( replyLang || app.msgs.alert_yourSysLang ) + '.',
Expand Down Expand Up @@ -1436,7 +1436,7 @@
configStatusSpan.style.cssText = 'float: right ; font-size: 11px ; margin-top: 3px ;'
+ ( !key.includes('about') ? 'text-transform: uppercase !important' : '' )
if (key.includes('replyLang')) {
configStatusSpan.textContent = config.replyLanguage
configStatusSpan.textContent = config.replyLang
settingItem.onclick = () => modals.open('replyLang')
} else if (key.includes('scheme')) {
modals.settings.updateSchemeStatus(configStatusSpan)
Expand Down Expand Up @@ -2478,7 +2478,7 @@
{ code: 'zh-CHS', regex: /^(chi(nese)?|zh|[])/i, rate: 2 }
]
const sgtReplyDialect = sgtDialectMap.find(entry =>
entry.regex.test(config.replyLanguage)) || sgtDialectMap[0]
entry.regex.test(config.replyLang)) || sgtDialectMap[0]
const payload = {
text: wholeAnswer, curTime: Date.now(), spokenDialect: sgtReplyDialect.code,
rate: sgtReplyDialect.rate.toString()
Expand Down Expand Up @@ -3126,7 +3126,7 @@

// Define QUERY AUGMENT functions

function augmentQuery(query) { return query + ` (reply in ${config.replyLanguage})` }
function augmentQuery(query) { return query + ` (reply in ${config.replyLang})` }

function stripQueryAugments(msgChain) {
const augmentCnt = augmentQuery.toString().match(/\+/g).length
Expand Down Expand Up @@ -3239,7 +3239,7 @@
+ 'But the key is variety. Do not be repetitive. '
+ ' You must entice user to want to ask one of your related queries.' ))

+ ` Reply in ${config.replyLanguage}`
+ ` Reply in ${config.replyLang}`

// Try diff API after 7s of no response
const iniAPI = get.related.api
Expand Down

0 comments on commit 57b54b4

Please sign in to comment.