Skip to content

Commit

Permalink
Merged apiIDs into apis for simplicity ↞ [auto-sync from `adamlui…
Browse files Browse the repository at this point in the history
…/chatgpt-apps`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Jul 31, 2024
1 parent 5eddfdd commit ff2043d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 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.7.30.1
// @version 2024.7.30.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 @@ -264,7 +264,8 @@
const apis = {
'AIchatOS': {
endpoint: 'https://api.binjie.fun/api/generateStream', expectedOrigin: 'https://chat18.aichatos8.com',
method: 'POST', streamable: true, accumulatesText: false, failFlags: ['很抱歉地', '系统公告'] },
method: 'POST', streamable: true, accumulatesText: false, failFlags: ['很抱歉地', '系统公告'],
userID: '#/chat/' + Date.now() },
'GPTforLove': {
endpoint: 'https://api11.gptforlove.com/chat-process', expectedOrigin: 'https://ai27.gptforlove.com',
method: 'POST', streamable: true, accumulatesText: true },
Expand All @@ -275,7 +276,6 @@
endpoint: 'https://api.openai.com/v1/chat/completions', expectedOrigin: 'https://chatgpt.com',
method: 'POST', streamable: true }
}
const apiIDs = { gptForLove: { parentID: '' }, aiChatOS: { userID: '#/chat/' + Date.now() }}

// Init INPUT EVENTS
const inputEvents = {} ; ['down', 'move', 'up'].forEach(action =>
Expand Down Expand Up @@ -2261,15 +2261,15 @@
else if (api == 'AIchatOS') {
payload = {
prompt: msgs[msgs.length - 1].content,
withoutContext: false, userId: apiIDs.aiChatOS.userID, network: true
withoutContext: false, userId: apis.AIchatOS.userID, network: true
}
} else if (api == 'GPTforLove') {
payload = {
prompt: msgs[msgs.length - 1].content,
secret: generateGPTforLoveKey(), top_p: 1, temperature: 0.8,
systemMessage: 'You are ChatGPT, the version is GPT-4o, a large language model trained by OpenAI. Follow the user\'s instructions carefully.'
}
if (apiIDs.gptForLove.parentID) payload.options = { parentMessageId: apiIDs.gptForLove.parentID }
if (apis.GPTforLove.parentID) payload.options = { parentMessageId: apis.GPTforLove.parentID }
} else if (api == 'MixerBox AI')
payload = { prompt: msgs, model: 'gpt-3.5-turbo' }
return JSON.stringify(payload)
Expand Down Expand Up @@ -2437,7 +2437,7 @@
try { // to show response or return related queries
let chunks = resp.responseText.trim().split('\n'),
lastObj = JSON.parse(chunks[chunks.length - 1])
if (lastObj.id) apiIDs.gptForLove.parentID = lastObj.id
if (lastObj.id) apis.GPTforLove.parentID = lastObj.id
respText = lastObj.text ; handleProcessCompletion()
} catch (err) { handleProcessError(err) }
} else if (caller.status != 'done') api.tryNew(caller)
Expand Down Expand Up @@ -2500,7 +2500,7 @@
if (caller.api == 'GPTforLove') { // extract parentID + latest chunk text
const jsonLines = accumulatedChunks.split('\n'),
nowResult = JSON.parse(jsonLines[jsonLines.length - 1])
if (nowResult.id) apiIDs.gptForLove.parentID = nowResult.id // for contextual replies
if (nowResult.id) apis.GPTforLove.parentID = nowResult.id // for contextual replies
textToShow = nowResult.text
} else textToShow = accumulatedChunks
if (caller.status != 'done') { // app waiting or sending
Expand Down

0 comments on commit ff2043d

Please sign in to comment.