Skip to content

Commit

Permalink
feat: 🎸 lots of new features
Browse files Browse the repository at this point in the history
- Custom instruction An instruction that will be added to the end of
each prompt. For example, you can add "Please repeat the prompt after
me.", or "Please refrain from writing warnings about your knowledge
cutoff" to the custom instruction, and it will be added to the end of
every prompt. - You can now export/import prompt history. Simply go to
My Prompt History, and you'll see two new buttons at the bottom of the
menu. - You can now also import/export your Settings, Custom Prompts
(Shortcuts), and Folder Structure. You can find this feature in the
Settings menu under the General tab. - Auto Click. You can now enable
auto-click on your custom prompt. By enabling this button, your
"default" custom prompt will be clicked automatically at the end of each
response. - Smart Replace. Custom prompts are now even more powerful.
Your custom prompt now also acts as a shortcut. To use shortcuts in your
prompt, simply type @ followed by the name of the prompt and press
space. Your text will automatically be replaced by the custom prompt
text. - Prompt Templates. We now support prompt templates using curly
brackets. If you try to submit a prompt that includes a word surrounded
by {{two curly brackets}}, a new popup shows up and asks you to enter
your desired values for those curly brackets. Make sure to use "{{ }}"
when submitting new prompts to the community. - Added a popup menu to
the extension icon for easy access to various links - Improved Auto-Sync
- Fixed the style issue with the Continue button not being correctly
placed - Fixed the list styling issue
  • Loading branch information
saeedezzati committed Jun 11, 2023
1 parent 10867f3 commit b0ac73d
Show file tree
Hide file tree
Showing 18 changed files with 664 additions and 218 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A browser extension to add the missing features like **Folders**, **Search**, an
[![Mozilla Add-on](https://img.shields.io/amo/users/superpower-chatgpt.svg)]([link-firefox])
[![Mozilla Add-on](https://img.shields.io/amo/rating/superpower-chatgpt.svg)]([link-firefox])

[![Discord](https://img.shields.io/discord/1060110102188797992?color=green&label=Discord&logo=discord)](https://discord.gg/Ma9VpTSct2)
[![Discord](https://img.shields.io/discord/1060110102188797992?color=green&label=Discord&logo=discord)](https://discord.gg/superpower-chatgpt-1083455984489476220)
[![Twitter Follow](https://img.shields.io/twitter/follow/eeeziii?label=follow%20me&style=social)](https://twitter.com/intent/user?screen_name=eeeziii)

<div align="center">
Expand All @@ -35,7 +35,7 @@ https://user-images.githubusercontent.com/574142/232172841-50f1b114-ef47-4533-a6

🔁 Auto Sync: Never lose your chats. Automatically sync a copy of all your chats on ChatGPT to your computer

📥 Export: Select and Export any number of your chats into multiple formats(.txt, .json, .md)
📥 Export: Select and Export any number of your chats into multiple formats(.txt, .json, .md). You can also export your prompt history, your settings, your shortcuts and your folders.

🔎 Search and Highlight: Search through all your previous chats on ChatGPT and highlight results for quick review

Expand All @@ -59,6 +59,8 @@ https://user-images.githubusercontent.com/574142/232172841-50f1b114-ef47-4533-a6

⭐ Favorite prompts: Mark your prompts as favorite in your prompt history

📄 Prompt templates: put words inside {{double curly brackets}} in your prompt, and you'll be asked to replace them before submitting the prompt

🔍 Search Function: Easily search through your prompt history and hundreds of prompt examples from the ChatGPT community

📜 Community Prompts: Get inspiration from hundreds of other prompts created by the ChatGPT Community and share your prompts too. Upvote, downvote, and report prompts, and sort them by the most used or most upvoted. Filter prompts by category and language
Expand All @@ -81,6 +83,12 @@ https://user-images.githubusercontent.com/574142/232172841-50f1b114-ef47-4533-a6

📏 Custom Conversation Width: Adjust the width of the conversation to your liking

🔄 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

👉 Custom Instruction: Don't epeat 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

🎛 Model Switcher: Easily change the model(GPT-4, GPT-3.5, etc.) in the middle of the conversation. Simply hover over the ChatGPT avatar icon to see what model was used for each response
Expand Down Expand Up @@ -175,7 +183,7 @@ Read our [FAQ document](https://ezi.notion.site/Superpower-ChatGPT-FAQ-9d43a8a1c

## Feature Requests, Bugs, and Support

Join our [Discord channel](https://discord.gg/Ma9VpTSct2) to stay up to date, submit feature requests, report bugs, and get faster support
Join our [Discord channel](https://discord.gg/superpower-chatgpt-1083455984489476220) to stay up to date, submit feature requests, report bugs, and get faster support

## Privacy

Expand All @@ -189,7 +197,7 @@ I appreciate your interest in supporting this extension. Here are some ways you
[![Donate with Stripe](https://img.shields.io/badge/stripe-donate-blue.svg)](https://buy.stripe.com/6oE6s0dQS7y2bjG9AA)

[![visitors](https://visitor-badge.glitch.me/badge?page_id=saeedezzati/superpower-chatgpt)](https://visitor-badge.glitch.me)
[![Discord](https://img.shields.io/discord/1060110102188797992?color=green&label=Discord&logo=discord)](https://discord.gg/Ma9VpTSct2)
[![Discord](https://img.shields.io/discord/1060110102188797992?color=green&label=Discord&logo=discord)](https://discord.gg/superpower-chatgpt-1083455984489476220)
[![Twitter Follow](https://img.shields.io/twitter/follow/eeeziii?label=follow%20me&style=social)](https://twitter.com/intent/user?screen_name=eeeziii)

## Copyright
Expand Down
4 changes: 3 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Superpower ChatGPT",
"version": "3.4.0",
"version": "3.5.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",
Expand All @@ -10,6 +10,7 @@
"128": "images/icon-128.png"
},
"action": {
"default_popup": "popup.html",
"16": "images/icon-16.png",
"32": "images/icon-32.png",
"48": "images/icon-48.png",
Expand Down Expand Up @@ -53,6 +54,7 @@
"scripts/content/enableMFA.js",
"scripts/content/pluginsDropdown.js",
"scripts/content/dropdown.js",
"scripts/content/templateWordsModal.js",
"scripts/content/shareModal.js",
"scripts/content/feedbackModal.js",
"scripts/content/toneList.js",
Expand Down
19 changes: 19 additions & 0 deletions popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
body {
margin: 0;
padding: 4px 8px;
width: 140px;
background-color: gold;
}
button {
height: 36px;
width: 100%;
margin: 4px 0;
border: solid 1px #f1f1f1;
border-radius: 4px;
cursor: pointer;
background-color: white;
&:hover {
background-color: #f1f1f1;
}
}

34 changes: 34 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="popup.css" />
</head>

<body>
<a target="_blank" href="https://chat.openai.com/">
<button id="chatgpt">ChatGPT <span>&#8594;</span></button>
</a>
<a target="_blank" href="https://www.superpowerdaily.com/">
<button id="newsletter">Newsletter <span>&#8594;</span></button>
</a>
<a target="_blank" href="https://sponsor.superpowerdaily.com/">
<button id="sponsorship">Sponsorship
<span>&#8594;</span></button>
</a>
<a href="https://ezi.notion.site/Superpower-ChatGPT-FAQ-9d43a8a1c31745c893a4080029d2eb24">
<button id="faq">FAQ
<span>&#8594;</span></button>
</a>
<a target="_blank"
href="https://www.paypal.com/donate/?business=TAF9NBUWQQQ7J&no_recurring=0&item_name=Thank+you+for+supporting+Superpower+ChatGPT+%F0%9F%99%87%F0%9F%8F%BB%E2%80%8D%E2%99%82%EF%B8%8F&currency_code=USD">
<button id="paypel">Support (Paypal) <span>&#8594;</span></button>
</a>
<a target="_blank" href="https://buy.stripe.com/6oE6s0dQS7y2bjG9AA">
<button id="stripe">Support (Stripe)
<span>&#8594;</span></button>
</a>
<script src="popup.js"></script>
</body>

</html>
14 changes: 7 additions & 7 deletions scripts/content/announcement.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const subtitleMap = {
general: 'You can see the latest announcement here',
newsletter: 'Daily dose of AI news and resources from the community',
};
function createAnnouncementModal(data) {
const bodyContent = announcementModalContent(data);
function createAnnouncementModal(data, email = '') {
const bodyContent = announcementModalContent(data, email);
const actionsBarContent = announcementModalActions(data);
const title = titleMap[data.category];
const subtitle = subtitleMap[data.category];
Expand Down Expand Up @@ -45,7 +45,7 @@ function addSponsorElement(sponsor) {
sponsor.appendChild(sponsorLink);
});
}
function announcementModalContent(data) {
function announcementModalContent(data, email = '') {
// create announcement modal content
const content = document.createElement('div');
content.id = `modal-content-${data.category}`;
Expand All @@ -64,7 +64,7 @@ function announcementModalContent(data) {
announcementText.style = 'display: flex; flex-direction: column; justify-content: start; align-items: start; min-height: 100%; width: 100%; white-space: break-spaces; overflow-wrap: break-word;padding:16px;position: relative;z-index:10;color: #fff;';
const announcement = data;
// add ?ref=superpower-chatgpt-chrome-extension to the end of all href links
const updatedTextWithRef = announcement.text.replace(/href="([^"]*)"/g, 'href="$1?ref=superpower-chatgpt-extension"');
const updatedTextWithRef = announcement.text.replace(/href="([^"]*)"/g, 'href="$1?ref=superpower-chatgpt-extension"').replace(/\{\{email\}\}/g, email);
announcementText.innerHTML = announcement.category === 'newsletter' ? updatedTextWithRef : `<h1 style="margin-bottom: 24px; ">${announcement.title}</h1>${announcement.text}`;
// if release_data is before march 21, 2023, add sponsor
if (announcement.category === 'newsletter' && new Date(announcement.release_date) < new Date('2023-03-20')) {
Expand Down Expand Up @@ -120,9 +120,9 @@ function announcementModalActions(data) {
// eslint-disable-next-line no-unused-vars
function initializeAnnouncement() {
setTimeout(() => {
chrome.storage.sync.get(['lastSeenAnnouncementId', 'lastSeenNewsletterId'], (result) => {
chrome.storage.sync.get(['lastSeenAnnouncementId', 'lastSeenNewsletterId', 'email'], (result) => {
chrome.storage.local.get(['settings'], (res) => {
const { lastSeenAnnouncementId, lastSeenNewsletterId } = result;
const { lastSeenAnnouncementId, lastSeenNewsletterId, email } = result;
// try getting latest announcement first
getLatestAnnouncement().then((announcement) => {
if (announcement && announcement.id && lastSeenAnnouncementId !== announcement.id) {
Expand All @@ -134,7 +134,7 @@ function initializeAnnouncement() {
getLatestNewsletter().then((newsletter) => {
if (!newsletter || !newsletter.id) return;
if (lastSeenNewsletterId !== newsletter.id) {
createAnnouncementModal(newsletter);
createAnnouncementModal(newsletter, email);
chrome.storage.sync.set({ lastSeenNewsletterId: newsletter.id });
chrome.storage.local.get(['readNewsletterIds'], (results) => {
const readNewsletterIds = results.readNewsletterIds || [];
Expand Down
27 changes: 15 additions & 12 deletions scripts/content/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ chrome.storage.local.get(['environment'], (result) => {
const defaultHeaders = {
'content-type': 'application/json',
};
function generateChat(message, conversationId, messageId, parentMessageId, saveHistory = true, role = 'user', pluginIds = []) {
function generateChat(message, conversationId, messageId, parentMessageId, 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: 'next',
messages: messageId
action,
arkose_token: null,
model: res.settings.selectedModel.slug,
parent_message_id: parentMessageId,
history_and_training_disabled: !saveHistory,
timezone_offset_min: new Date().getTimezoneOffset(),
};
if (action === 'next') {
payload.messages = messageId
? [
{
id: messageId,
Expand All @@ -27,12 +34,8 @@ function generateChat(message, conversationId, messageId, parentMessageId, saveH
},
},
]
: null,
model: res.settings.selectedModel.slug,
parent_message_id: parentMessageId,
history_and_training_disabled: !saveHistory,
timezone_offset_min: new Date().getTimezoneOffset(),
};
: null;
}
if (conversationId) {
payload.conversation_id = conversationId;
}
Expand Down Expand Up @@ -388,7 +391,7 @@ function getAllConversations(forceRefresh = false) {
const {
limit, offset, items,
} = convs;
const total = Math.min(convs.total, 10000); // sync last 10000 conversations
const total = convs.total ? Math.min(convs.total, 10000) : 10000; // sync last 10000 conversations
if (items.length === 0 || total === 0) {
resolve([]);
return;
Expand Down Expand Up @@ -446,11 +449,11 @@ function getSharedConversations(offset = 0, limit = 100) {
return Promise.reject(res);
}));
}
function getConversations(offset = 0, limit = 100) {
function getConversations(offset = 0, limit = 100, order = 'updated') {
const url = new URL('https://chat.openai.com/backend-api/conversations');
// without passing limit it returns 50 by default
// limit cannot be more than 20
const params = { offset, limit };
const params = { offset, limit, order };
url.search = new URLSearchParams(params).toString();
return chrome.storage.sync.get(['auth_token']).then((result) => fetch(url, {
method: 'GET',
Expand Down
9 changes: 5 additions & 4 deletions scripts/content/autoSave.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function updateOrCreateConversation(conversationId, message, parentId, settings,
existingConversation.writingStyleCode = settings.selectedWritingStyle.code;
existingConversation.shouldRefresh = forceRefresh;
existingConversation.current_node = message.id;
existingConversation.update_time = 'force_copy';
if (existingConversation.mapping[message.id]?.id) {
existingConversation.mapping[message.id].message = message;
} else {
Expand Down Expand Up @@ -172,7 +173,7 @@ function updateOrCreateConversation(conversationId, message, parentId, settings,
current_node: message.id,
title: 'New chat',
create_time: (new Date()).getTime() / 1000,
update_time: 'initialize',
update_time: 'force_copy',
mapping: {
[parentId]: {
children: [systemMessage.id], id: parentId, message: null, parent: null,
Expand Down Expand Up @@ -323,7 +324,7 @@ function initializeAutoSave(skipInputFormReload = false, forceRefreshIds = []) {
const remoteConv = remoteConversations.find((conv) => conv.id === localConvIds[i]) || localConversations[localConvIds[i]];
localConversations[localConvIds[i]].title = remoteConv.title;
// eslint-disable-next-line prefer-destructuring
if (localConversations[localConvIds[i]].update_time === 'initialize') {
if (localConversations[localConvIds[i]].update_time === 'force_copy') {
localConversations[localConvIds[i]].update_time = new Date(remoteConv.update_time).getTime() / 1000;
}
// delete conversation key(legacy)
Expand Down Expand Up @@ -591,7 +592,7 @@ function initializeAutoSave(skipInputFormReload = false, forceRefreshIds = []) {
// if (isGenerating || !canSubmit) return;
// const syncDiv = document.getElementById('sync-div');
// syncDiv.remove();
// const { pathname } = new URL(window.location.toString());;
// const { pathname } = new URL(window.location.toString());
// const conversationId = pathname.split('/').pop().replace(/[^a-z0-9-]/gi, '');
// const refreshIds = [];
// if (/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(conversationId)) {
Expand All @@ -605,7 +606,7 @@ function initializeAutoSave(skipInputFormReload = false, forceRefreshIds = []) {
// if (isGenerating || !canSubmit) return;
// const syncDiv = document.getElementById('sync-div');
// syncDiv.remove();
// const { pathname } = new URL(window.location.toString());;
// const { pathname } = new URL(window.location.toString())
// const conversationId = pathname.split('/').pop().replace(/[^a-z0-9-]/gi, '');
// const refreshIds = [];
// if (/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(conversationId)) {
Expand Down
Loading

0 comments on commit b0ac73d

Please sign in to comment.