From d3e60ad07dc24b4c5380420e0f4562691392f02e Mon Sep 17 00:00:00 2001 From: Saeed Ezzati Date: Wed, 14 Jun 2023 19:16:50 -0600 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20testing=20fix=20for=20un?= =?UTF-8?q?usual=20activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- manifest.json | 2 +- popup.html | 4 +- scripts/content/announcement.js | 2 +- scripts/content/api.js | 23 +++++++++++- scripts/content/autoSave.js | 2 +- scripts/content/conversationList.js | 57 +++++++++++++++-------------- scripts/content/settings.js | 11 ++++-- 8 files changed, 66 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 408d6fb..a0a3d93 100644 --- a/README.md +++ b/README.md @@ -85,9 +85,9 @@ https://user-images.githubusercontent.com/574142/232172841-50f1b114-ef47-4533-a6 🔄 Smart Replace: Automatically replace pre-defined phrases with longer text as you type prompts -🖱️ Auto Click: Automatically click on the defaul custom prompt button at the end of each response +🖱️ Auto Click: Automatically click on the default custom prompt button at the end of each response -👉 Custom Instruction: Don't epeat yourself. Automatically add a custom instruction to the end of each prompt +👉 Custom Instruction: Don't repeat yourself. Automatically add a custom instruction to the end of each prompt 📊 Word and Character Count: Add the word and character counters to both the user input and the ChatGPT responses diff --git a/manifest.json b/manifest.json index f013c30..7109433 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Superpower ChatGPT", - "version": "3.5.0", + "version": "3.6.0", "description": "ChatGPT with superpowers! Sync/search history locally, create folders, export all chats, pin messages, access thousands of prompts", "icons": { "16": "images/icon-16.png", diff --git a/popup.html b/popup.html index 4ae0ea5..f1bd565 100644 --- a/popup.html +++ b/popup.html @@ -12,8 +12,8 @@ - - diff --git a/scripts/content/announcement.js b/scripts/content/announcement.js index 983e9e7..3bf7d46 100644 --- a/scripts/content/announcement.js +++ b/scripts/content/announcement.js @@ -29,7 +29,7 @@ function addSponsorElement(sponsor) { sponsorImage.style = 'border-radius: 3px;margin:0 !important;'; sponsorLink.appendChild(sponsorImage); const sponsorTag = document.createElement('a'); - sponsorTag.href = 'https://ezi.notion.site/Sponsorship-3d0442f1e8634978902cf366c44be016'; + sponsorTag.href = 'https://www.passionfroot.me/superpower'; sponsorTag.target = '_blank'; sponsorTag.rel = 'noopener noreferrer'; sponsorTag.style = 'background-color:#595959;color:darkgrey;padding:0px 2px;border-radius: 0px 3px 0px 3px;font-size:10px;position:absolute;top:2px;right:2px;'; diff --git a/scripts/content/api.js b/scripts/content/api.js index 86c4e2d..709b0a0 100644 --- a/scripts/content/api.js +++ b/scripts/content/api.js @@ -12,11 +12,30 @@ chrome.storage.local.get(['environment'], (result) => { const defaultHeaders = { 'content-type': 'application/json', }; -function generateChat(message, conversationId, messageId, parentMessageId, saveHistory = true, role = 'user', action = 'next') { +function arkose() { + return fetch('https://tcr9i.chat.openai.com/fc/gt2/public_key/35536E1E-65B4-4D96-9D97-6ADB7EFF8147', { + headers: { + accept: '*/*', + 'accept-language': 'en-US,en;q=0.9,fa;q=0.8', + 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'sec-ch-ua': '"Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"macOS"', + 'sec-fetch-dest': 'empty', + 'sec-fetch-mode': 'cors', + 'sec-fetch-site': 'same-origin', + }, + referrer: 'https://tcr9i.chat.openai.com/v2/1.5.2/enforcement.64b3a4e29686f93d52816249ecbf9857.html', + referrerPolicy: 'strict-origin-when-cross-origin', + body: 'bda=eyJjdCI6IloyWURjNmZhTnhHUFAxYWJKN0cydUxkVFNITDRzdTRhYkh4dXY2WXB4WmlIMnVNaC9PUi90cDgvVDJlRnRsNVZkTkhTRjlGa3JPT2JYdnBoY1lrOUtzeUFJTk5lU2ZNV250T1hOYkVCOFBzOGMrdHgzUEh5SEtNMktIZ0ZNa05aZXJF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eFFqdFV2RVhpVUQzR1JKanhCZVI1Q0hmMnN4YW5KRUF4eUNnZkJkUXZPdkI5alMzZDlnQm1LZ01JVFJKY1gweDY3cGVISU4zRjBreE9pYUU0ODJpL2g4ZzRFWnJVeDlMNHo4RGpYYlBJYWZsb21NYkNRMldIQlhZM0dXcUJjcjNXM1VhV3B0Y0czcG44VzF2WCtqVnR2UTd6TTMrY093NE5kYXVuc0oxZTZjandVM1d1RFZTbmtGTVNOYkxjVHdyamtDdz09IiwiaXYiOiJiOTFmMzc0MGEyNWFjMmViYWJiMTVkNzhjZDQxN2ZkYSIsInMiOiI0Y2NmOTA3MTk2YTBhY2IyIn0%3D&public_key=35536E1E-65B4-4D96-9D97-6ADB7EFF8147&site=https%3A%2F%2Fchat.openai.com&userbrowser=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_15_7)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F113.0.0.0%20Safari%2F537.36&capi_version=1.5.2&capi_mode=lightbox&style_theme=default&rnd=0.4708405773111748', + method: 'POST', + }).then((response) => response.json()); +} +function generateChat(message, conversationId, messageId, parentMessageId, token, saveHistory = true, role = 'user', action = 'next') { return chrome.storage.local.get(['settings', 'enabledPluginIds']).then((res) => chrome.storage.sync.get(['auth_token']).then((result) => { const payload = { action, - arkose_token: null, + arkose_token: token, model: res.settings.selectedModel.slug, parent_message_id: parentMessageId, history_and_training_disabled: !saveHistory, diff --git a/scripts/content/autoSave.js b/scripts/content/autoSave.js index af43420..8375f31 100644 --- a/scripts/content/autoSave.js +++ b/scripts/content/autoSave.js @@ -284,7 +284,7 @@ function initializeAutoSave(skipInputFormReload = false, forceRefreshIds = []) { if (result.conversations && Object.keys(result.conversations).length > 0) { localConversations = result.conversations; } - const oldConversationsOrder = conversationsOrder && (conversationsOrder?.findIndex((f) => f.id === 'trash') !== -1) + const oldConversationsOrder = conversationsOrder && (conversationsOrder?.findIndex((f) => f && f.id === 'trash') !== -1) ? conversationsOrder : [{ id: 'trash', diff --git a/scripts/content/conversationList.js b/scripts/content/conversationList.js index 9b30684..f0aae91 100644 --- a/scripts/content/conversationList.js +++ b/scripts/content/conversationList.js @@ -1,6 +1,6 @@ /* eslint-disable no-restricted-globals */ // eslint-disable-next-line no-unused-vars -/* global markdown, markdownitSup, initializeNavbar, generateInstructions, generateChat, SSE, formatDate, loadConversation, resetSelection, katex, texmath, rowUser, rowAssistant, updateOrCreateConversation, replaceTextAreaElemet, highlight, isGenerating:true, disableTextInput:true, generateTitle, debounce, initializeRegenerateResponseButton, initializeStopGeneratingResponseButton, toggleTextAreaElemet, showNewChatPage, chatStreamIsClosed:true, addCopyCodeButtonsEventListeners, addScrollDetector, scrolUpDetected:true, Sortable, updateInputCounter, addUserPromptToHistory, getGPT4CounterMessageCapWindow, createFolder, getConversationElementClassList, notSelectedClassList, selectedClassList, conversationActions, addCheckboxToConversationElement, createConversation, deleteConversation, handleQueryParams, addScrollButtons, updateTotalCounter, isWindows, loadSharedConversation, createTemplateWordsModal */ +/* global markdown, markdownitSup, initializeNavbar, generateInstructions, generateChat, SSE, formatDate, loadConversation, resetSelection, katex, texmath, rowUser, rowAssistant, updateOrCreateConversation, replaceTextAreaElemet, highlight, isGenerating:true, disableTextInput:true, generateTitle, debounce, initializeRegenerateResponseButton, initializeStopGeneratingResponseButton, toggleTextAreaElemet, showNewChatPage, chatStreamIsClosed:true, addCopyCodeButtonsEventListeners, addScrollDetector, scrolUpDetected:true, Sortable, updateInputCounter, addUserPromptToHistory, getGPT4CounterMessageCapWindow, createFolder, getConversationElementClassList, notSelectedClassList, selectedClassList, conversationActions, addCheckboxToConversationElement, createConversation, deleteConversation, handleQueryParams, addScrollButtons, updateTotalCounter, isWindows, loadSharedConversation, createTemplateWordsModal, arkose */ // Initial state let userChatIsActuallySaved = false; @@ -438,7 +438,7 @@ function submitChat(userInput, conversation, messageId, parentId, settings, mode if (!regenerateResponse) initializeRegenerateResponseButton(); chatStreamIsClosed = false; const saveHistory = conversation?.id ? conversation.saveHistory : settings.saveHistory; - generateChat(userInput, conversation?.id, messageId, parentId, saveHistory).then((chatStream) => { + arkose().then((arkoseRes) => generateChat(userInput, conversation?.id, messageId, parentId, arkoseRes.token, saveHistory).then((chatStream) => { userChatIsActuallySaved = regenerateResponse; let userChatSavedLocally = regenerateResponse; // false by default unless regenerateResponse is true let assistantChatSavedLocally = false; @@ -667,33 +667,36 @@ function submitChat(userInput, conversation, messageId, parentId, settings, mode const submitButton = inputForm.querySelector('textarea ~ button'); // submitButton.disabled = false; submitButton.innerHTML = ''; - const error = JSON.parse(err.data); - const errorCode = error?.detail?.code; - let errorMessage = typeof error.detail === 'string' ? error.detail : error.detail.message; - if (errorCode === 'model_cap_exceeded') { - // seconds until cap is cleared - const clearsIn = error?.detail?.clears_in; - const date = new Date(); - date.setSeconds(date.getSeconds() + clearsIn); - // print expire hour minute from local time - const hour = date.getHours(); - const minute = date.getMinutes(); - const ampm = hour >= 12 ? 'pm' : 'am'; - const hour12 = hour % 12; - const hour12Display = hour12 || 12; - const minuteDisplay = minute < 10 ? `0${minute}` : minute; - const capExpiresAt = `${hour12Display}:${minuteDisplay}${ampm}`; - chrome.storage.local.set({ capExpiresAt }); - errorMessage = `You've reached the current usage cap for this model. You can continue with the default model now, or try again after ${capExpiresAt}.`; - } else { - chrome.storage.local.set({ capExpiresAt: '' }); + console.warn(err); + if (err.data) { + const error = JSON.parse(err.data); + const errorCode = error?.detail?.code; + let errorMessage = typeof error.detail === 'string' ? error.detail : error.detail.message; + if (errorCode === 'model_cap_exceeded') { + // seconds until cap is cleared + const clearsIn = error?.detail?.clears_in; + const date = new Date(); + date.setSeconds(date.getSeconds() + clearsIn); + // print expire hour minute from local time + const hour = date.getHours(); + const minute = date.getMinutes(); + const ampm = hour >= 12 ? 'pm' : 'am'; + const hour12 = hour % 12; + const hour12Display = hour12 || 12; + const minuteDisplay = minute < 10 ? `0${minute}` : minute; + const capExpiresAt = `${hour12Display}:${minuteDisplay}${ampm}`; + chrome.storage.local.set({ capExpiresAt }); + errorMessage = `You've reached the current usage cap for this model. You can continue with the default model now, or try again after ${capExpiresAt}.`; + } else { + chrome.storage.local.set({ capExpiresAt: '' }); + } + const conversationBottom = document.querySelector('#conversation-bottom'); + const errorMessageElement = `
${errorMessage}
`; + conversationBottom.insertAdjacentHTML('beforebegin', errorMessageElement); + conversationBottom.scrollIntoView({ behavior: 'smooth' }); } - const conversationBottom = document.querySelector('#conversation-bottom'); - const errorMessageElement = `
${errorMessage}
`; - conversationBottom.insertAdjacentHTML('beforebegin', errorMessageElement); - conversationBottom.scrollIntoView({ behavior: 'smooth' }); }); - }); + })); } function submitFinalSummary() { if (!shouldSubmitFinalSummary) return; diff --git a/scripts/content/settings.js b/scripts/content/settings.js index abf6103..86e271f 100644 --- a/scripts/content/settings.js +++ b/scripts/content/settings.js @@ -121,6 +121,10 @@ function generalTabContent() { const copyModeSwitch = createSwitch('Copy mode', 'OFF: only copy response / ON: copy both request and response', 'copyMode', false); leftContent.appendChild(copyModeSwitch); + // prompt template + const promptTemplateSwitch = createSwitch('Prompt Template', 'Enable/disable the doube {{curly}} brackets replacement', 'promptTemplate', false); + leftContent.appendChild(promptTemplateSwitch); + // conversation width const customConversationWidthSwitch = createSwitch('Custom Conversation Width', 'OFF: Use default / ON: Set Conversation Width (30%-90%)', 'customConversationWidth', false, toggleCustomWidthInput); leftContent.appendChild(customConversationWidthSwitch); @@ -380,9 +384,9 @@ function generalTabContent() { // add link for sponsorship const sponsorLink = document.createElement('a'); - sponsorLink.href = 'https://ezi.notion.site/Sponsorship-3d0442f1e8634978902cf366c44be016'; + sponsorLink.href = 'https://www.passionfroot.me/superpower'; sponsorLink.target = '_blank'; - sponsorLink.textContent = 'Sponsorship ➜'; + sponsorLink.textContent = 'Advertise with us ➜'; sponsorLink.style = 'color: #999; font-size: 12px; margin: 8px 0;min-width: 25%;text-align:center;padding-right: 8px;'; sponsorLink.addEventListener('mouseover', () => { sponsorLink.style = 'color: gold; font-size: 12px; margin: 8px 0;min-width: 25%;text-align:center;padding-right: 8px;'; @@ -392,7 +396,7 @@ function generalTabContent() { }); linkWrapper.appendChild(sponsorLink); - // add link for sponsorship + // add link for FAQ const faqLink = document.createElement('a'); faqLink.href = 'https://ezi.notion.site/Superpower-ChatGPT-FAQ-9d43a8a1c31745c893a4080029d2eb24'; faqLink.target = '_blank'; @@ -1254,6 +1258,7 @@ function initializeSettings() { customConversationWidth: result.settings?.customConversationWidth !== undefined ? result.settings.customConversationWidth : false, conversationWidth: result.settings?.conversationWidth !== undefined ? result.settings.conversationWidth : 50, saveHistory: result.settings?.saveHistory !== undefined ? result.settings.saveHistory : true, + promptTemplate: result.settings?.promptTemplate !== undefined ? result.settings.promptTemplate : false, emailNewsletter: result.settings?.emailNewsletter !== undefined ? result.settings.emailNewsletter : false, autoClick: result.settings?.autoClick !== undefined ? result.settings.autoClick : false, showGpt4Counter: result.settings?.showGpt4Counter !== undefined ? result.settings.showGpt4Counter : true,