Giter Site home page Giter Site logo

domeccleston / sharegpt Goto Github PK

View Code? Open in Web Editor NEW
1.7K 1.7K 212.0 4.63 MB

Easily share permanent links to ChatGPT conversations with your friends

Home Page: https://sharegpt.com

License: MIT License

JavaScript 8.48% TypeScript 85.60% CSS 4.82% HTML 1.10%
ai chrome-extension

sharegpt's Introduction

ShareGPT – Share your wildest ChatGPT conversations with one click.

Share your wildest ChatGPT conversations with one click.

Twitter License

Introduction · Tech Stack · REST API


Introduction

ShareGPT is an open-source Chrome Extension for you to share your wildest ChatGPT conversations with one click.

Features

  • Share your ChatGPT conversations with one-click
  • Browse examples on sharegpt.com/explore
  • Save your favorite conversations for later
  • Leave comments on conversations

Tech Stack

ShareGPT is built with the following stack:

REST API

The ShareGPT API is a REST-styled API that allows you to write and read conversations from our database, exposed as HTTP endpoints.

Conversations Endpoint

POST: https://sharegpt.com/api/conversations

You can use this endpoint to add new conversations to our database.

First, if you haven't already, process the ShareGPT conversation using the following code:
function conversationData() {
  const threadContainer = document.querySelector(
    "#__next main div:nth-of-type(1) div:nth-of-type(1) div:nth-of-type(1) div:nth-of-type(1)"
  );

  var result = {
    avatarUrl: getAvatarImage(),
    items: [],
  };

  for (const node of threadContainer.children) {
    const markdownContent = node.querySelector(".markdown");

    // tailwind class indicates human or gpt
    if ([...node.classList].includes("dark:bg-gray-800")) {
      result.items.push({
        from: "human",
        value: node.textContent,
      });
      // if it's a GPT response, it might contain code blocks
    } else if ([...node.classList].includes("bg-gray-50")) {
      result.items.push({
        from: "gpt",
        value: markdownContent.outerHTML,
      });
    }
  }

  return result;
}

function getAvatarImage() {
  // Create a canvas element
  const canvas = document.createElement("canvas");

  const image = document.querySelectorAll("img")[1];

  // Set the canvas size to 30x30 pixels
  canvas.width = 30;
  canvas.height = 30;

  // Draw the img onto the canvas
  canvas.getContext("2d").drawImage(image, 0, 0);

  // Convert the canvas to a base64 string as a JPEG image
  const base64 = canvas.toDataURL("image/jpeg");

  return base64;
}

Then, send a POST request to the endpoint above with the following payload and request headers:

const res = await fetch("https://sharegpt.com/api/conversations", {
  body: JSON.stringify(conversationData),
  headers: {
    "Content-Type": "application/json",
  },
  method: "POST",
});

This will return an object with an id attribute which will be the unique identifier for the generated post:

const { id } = await res.json();
const url = `https://shareg.pt/${id}`; // short link to the ShareGPT post

GET: https://sharegpt.com/api/conversations

PLEASE NOTE: This endpoint is currently disabled due to excess traffic.

This endpoint takes 3 optional query parameters:

  • type:
    • Used for sorting the results.
    • Takes 2 string values: "new" | "top"
    • "new" sorts conversations by creation time
    • "top" sorts conversations by number of views
    • If undefined, defaults to "top"
  • page:
    • Used for pagination
    • Takes an integer value as a factor of the PAGINATION_LIMIT, which is set to 50.
    • E.g. to get posts 100 - 150, set page to 3
    • If undefined, defaults to 1
  • search
    • Used for filtering records by title.
    • E.g. search = "python" returns all records with the word "python" in the title
    • If undefined, search results are not filtered

Example:

await fetch(
  "https://sharegpt.com/api/conversations?type=new&page=2&search=python"
);

This returns a list of conversations with the following type:

interface ConversationMeta {
  id: string; // unique id for the conversation
  title: string; // title of the conversation (first user prompt)
  avatar: string; // base64 encoded URI of the user's avatar
  saves: number; // number of times the conversation is saved on ShareGPT
  comments: number; // number of comments the conversation has on ShareGPT
  views: number; // number of times the conversation has been viewed on ShareGPT
  createdAt: Date; // timestamp when the conversation was creataed
}
[];

sharegpt's People

Contributors

benwurth avatar chronark avatar cramforce avatar devnvll avatar domeccleston avatar rudeg avatar steven-tey avatar tianenpang avatar vicradon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharegpt's Issues

Create Firefox extension

You: Can you convert simple and basic Chrome extension into a firefox addon?
Chat GPT: Yes, it is possible to convert a simple and basic Chrome extension into a Firefox addon. To do this, you will need to follow these steps:

  1. Open your Chrome extension in a text editor and locate the manifest file. This file should be named manifest.json and contains information about your extension, such as its name and version number.

  2. Open the manifest file and modify the "browser_specific_settings" section to include the following code:

"browser_specific_settings": {
    "gecko": {
        "id": "your-addon-id-on-AMO",
        "strict_min_version": "48.0"
    }
},
  1. Save the changes to the manifest file.

  2. Use a tool such as the Web Extension Polyfill to convert the Chrome-specific APIs used in your extension to their Firefox equivalents.

  3. Test your extension in Firefox to make sure it works as expected.

  4. Submit your extension to the Firefox Add-ons website for review and publishing.

Keep in mind that the process of converting a Chrome extension to a Firefox addon can be more complex for extensions that use advanced features or APIs. It is always a good idea to consult the Firefox Add-ons Developer documentation for guidance and support.

404 error when I click on "View More" on home page

When I click on the "View More" link at the bottom of the home page, I get a black page with a "404 this page could not be found" error. I am viewing the website In Catalina OS, using Firefox 112.0b5 (64-bit),

ShareGPT + ChatGPTHistory = <3 !

Hi @domeccleston Hi @benf2004 (https://github.com/benf2004/ChatGPT-History)
please mingle and have software babies
thanks!

@domeccleston you could use the auto-history feature
@benf2004 you guys could use the vercel infa for easy sharing

should add OAuth for this, so we can sign in and sync to all our devices
so we can rerun bookmarked prompts, and potentially run macros from history threads

that would be amazing
hope you guys like this

(currently working on an extension to import an entire repo into chatgpt context)

private shares

allow the option for people to share privately, meaning the link doesn't show on the public feed. People would like that.

Need my convos deleted immediately please

I emailed you about a double post of my convos thinking the copy link would only copy the content, not auto post to the world. if I was you I would fix that immediately because you have no documentation to support anything of the sort. A copy link is just that, not a post. Very deceiving and the amount of PII and proprietary information you are exposing is extremely detrimental to you. Especially with 10K plus downloads. If nothing else, provide a way for users to delete and perhaps even a popup warning. None of this has been implemented.

I emailed you from jlk***307 at gmail. Twitter would not let me DM you for some reason but I tweeted you as well. Please remove this today and advise when done with proof of removal. I appreciate your urgent response.

Didn't work in latest chrome

when i upgrade my chrome in latest version, this extension not working now.
the Share button not display in conversation bottom

delete a shared chat?

hey, there have been a few other similar issues like this, but i was wondering if there was a way that i could get a chat deleted off of sharegpt? i wrote some furaffinity type shit that i would rather keep private, or have deleted entirely.

i would also recommend adding an 'are you sure' button to your share function hahaha

sharegpt is DEAD?

No way to browse anything?
What happened.
Are there alternatives?
Some other fork?

errors in lib/api.ts file

In the lib/api.ts file, we are getting an error message as shown below:

error message: 1
Property '_count' does not exist on type 'Conversation'.ts(2339)

error message: 2
Type '{ not: string; } | { search: string; }' is not assignable to type 'string | StringFilter | undefined'.
Object literal may only specify known properties, and 'search' does not exist in type 'StringFilter'.ts(2322)

and the count is not incremented when someone clicks on the bookmarks button on the home page at that time. 

Ability to Share Bing Conversation [enhancement]

Would it be OK if I used this in my Bing Chat History extension? I used the ShareGPT api for my ChatGPT chrome extension & I was wondering if I could use it for this new extension with the Bing Chat bot.

License question

Hi very nice plugin and very nicely coded front-end!
I want to ask what is the License of this repo. I would like to run my own server for hosting files for my android app.
Is it possible?
Thanks!

[BUG] - Non-functional on Linux

I tested the shareGPT extension on Linux using both Chromium and official Chrome.

In both cases when clicking the share button on ChatGPT it registers the click, changes to sharing and then hangs. No further action is taken after this.

Screenshot from 2023-02-09 12-08-44

Screenshot from 2023-02-09 12-09-18

Chrome console reported the follow errors:

index.js:54 undefined
index.js:61 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'children')
    at HTMLButtonElement.<anonymous> (index.js:61:40)
(anonymous) @ index.js:61

Deployment: a Helm chart for k8s

First of all, thanks for an awesome project!

This is not really an issue, but more like a question - has anyone deployed this to k8s already / is there a Helm chart version of the sharegpt already?

Would certainly be great to have an ability to deploy sharegpt on our own premises, since using a public instance of sharegpt is not easy to justify in environments, that are super strict about security / compliance.

user icons

export user avatar images like

https://chat.openai.com/_next/image?url=https%3A%2F%2Flh3.googleusercontent.com%2Fa%2FALm5wu1_Now_6DddClISvV6bjPRb4YfJYP50RkyHoc_6%3Ds96-c&w=32&q=75

Option to save chats as PNG/PDF

Would be nice to have alternate ways to save the chats like as a PNG or PDF. It helps with sharing on the OpenAI discord since they block urls

Cannot use REST API

I have been using the API for some time now. But today when I tried to get some new ID information by requesting https://sharegpt.com/api/conversations?type=new&page=, the response becomes

{
  "error": "Method not allowed"
}

Does this have something to do with the broken https://sharegpt.com/explore or did I mistakenly write something? Can anyone still access the API?

delete a shared chat?

any way to delete a shared chat? Let's just say some things get shared inadvertently since it's actually publishing live searchable to the internet, not just a unlisted link.

Need a license file

Nice project! Could you please add a license, such as MIT or Apache? Thank you!

Pagination is very slow

Hello,

I am writing about an issue that I encountered with the "ShareGPT" repository on GitHub. When attempting to retrieve conversations by page, I noticed that as the number of pages increases, the query becomes slower, eventually leading to a timeout on the Vercel Serverless Functions. Specifically, I found it almost impossible to retrieve conversations beyond page 200.

As an example, I tried to retrieve conversations from page 1000 using the following query:
https://sharegpt.com/api/conversations?page=1000

However, the query resulted in a 504 error with the message "GATEWAY_TIMEOUT" and the code "FUNCTION_INVOCATION_TIMEOUT."

Approval needed for Pull Request #48 to improve user privacy

Hello,

I would like to request approval for Pull Request #48, which modifies the code related to allowing users to share a conversation publicly. This change is aimed at improving user privacy and preventing accidental sharing.

The commit includes code changes that display a confirmation dialog to the user when they click the "Share" button. The dialog informs the user that they are about to share the conversation publicly and asks them to confirm their choice. Additionally, the dialog includes a notice telling the user that they need to click "OK" before sharing.

With these changes, it will be clearer to users that they are sharing their conversations publicly and give them an opportunity to reconsider their choice before sharing.

I believe this is an important improvement to the user experience and privacy of our platform, and I kindly request approval for the pull request.

Thank you.

Delete my conversation

Hello,

I have my number and email address for my conversation with ChatGPT and I used Sharegpt to save that conversation but is now in your database and its publicly available.
is there any way I can delete that ?? so that no one will see @domeccleston

ShareGPT loses the some css info about the code

The webpage generated by ShareGPT loses the information about the code, including the background and other css settings.

The original ChatGPT is as below.
Screenshot 2022-12-22 at 04 23 55
The webpage generated by ShareGPT is as below.
Screenshot 2022-12-22 at 04 24 42

After comparing these two webpage sources, I found that the generated webpage lose the css styles.
Screenshot 2022-12-22 at 04 28 06
Screenshot 2022-12-22 at 04 28 44

Save entire tree?

This only saves one leaf of the conversation
image
but sometimes there are multiple leaves with many paths.

Request for Firefox extension

Hello team,

thanks for the wonderful idea making world better than ever,
I am wondering to having this on my Firefox browser for sharing GPT idea !

Please help to build for Firefox users, appreciated !!

Change white-space styling for all chat messages

The CSS includes white-space: pre-wrap style for responses. But, human inputs could also contain code, and adding this for all messages in the chat would make the shared chat look better.

Message in ChatGPT UI
image

Message in ShareGPT
image

Message with additional CSS rule set in browser's debugger
image

avatarUrl doesn't work for the API

The webpage doesn't display the given avatarUrl no matter what you give it. It looks like an error with the optimizer, try

https://sharegpt.com/_next/image?url=https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png

Vercel 500 Internal Server Error Issue

I'm getting back 500 Internal Server error from Vercel with sharegpt url

Platform: macOS Edge Version 108.0.1462.54 (Official build) (arm64)
ShareGPT Version (commit): b122b13

Console logs the following:

tuZa2el:1 GET https://sharegpt.com/c/tuZa2el 500
main-58851298adf1f044.js:1

POST https://vitals.vercel-insights.com/v1/vitals net::ERR_BLOCKED_BY_CLIENT
l @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
i @ main-58851298adf1f044.js:1
P @ main-58851298adf1f044.js:1
s @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
uU @ framework-3b5a00d5d7e8d93b.js:9
oV @ framework-3b5a00d5d7e8d93b.js:9
o @ framework-3b5a00d5d7e8d93b.js:9
x @ framework-3b5a00d5d7e8d93b.js:33
T @ framework-3b5a00d5d7e8d93b.js:33
VM65 content_script.js:1

Uncaught SyntaxError: Identifier 'WBSAutoFillFormTypeUndetermined' has already been declared (at VM65 content_script.js:1:1)
main-58851298adf1f044.js:1

POST https://vitals.vercel-insights.com/v1/vitals net::ERR_BLOCKED_BY_CLIENT
l @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
setTimeout (async)
e @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
load (async)
e @ main-58851298adf1f044.js:1
G @ main-58851298adf1f044.js:1
s @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
uU @ framework-3b5a00d5d7e8d93b.js:9
oV @ framework-3b5a00d5d7e8d93b.js:9
o @ framework-3b5a00d5d7e8d93b.js:9
x @ framework-3b5a00d5d7e8d93b.js:33
T @ framework-3b5a00d5d7e8d93b.js:33
VM81 content_script.js:1

Uncaught SyntaxError: Identifier 'WBSAutoFillFormTypeUndetermined' has already been declared (at VM81 content_script.js:1:1)
VM84 content_script.js:1

Uncaught SyntaxError: Identifier 'WBSAutoFillFormTypeUndetermined' has already been declared (at VM84 content_script.js:1:1)
VM87 content_script.js:1

Uncaught SyntaxError: Identifier 'WBSAutoFillFormTypeUndetermined' has already been declared (at VM87 content_script.js:1:1)
main-58851298adf1f044.js:1

POST https://vitals.vercel-insights.com/v1/vitals net::ERR_BLOCKED_BY_CLIENT
l @ main-58851298adf1f044.js:1
a @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
r @ main-58851298adf1f044.js:1
main-58851298adf1f044.js:1

POST https://vitals.vercel-insights.com/v1/vitals net::ERR_BLOCKED_BY_CLIENT
l @ main-58851298adf1f044.js:1
(anonymous) @ main-58851298adf1f044.js:1
s @ main-58851298adf1f044.js:1
r @ main-58851298adf1f044.js:1
content_script.js:1

Uncaught SyntaxError: Identifier 'WBSAutoFillFormTypeUndetermined' has already been declared (at content_script.js:1:1)

XSS vulnerability

is the XSS attack a problem that be considered properly? it seems like that, the plugin will pass the raw html of the chatGPT conversations for generating the sharing page, and any entity like a javascript which can lead to XSS will be passed too.

here is a PoC XSS link: https://sharegpt.com/c/mHhUjtX, which triggers an alert popup "oooooooops"

it's easy to modify the frontpage html source code with a javascript embeded in it, and trigger it by clicking the share button, generating a sharing page with XSS.

I think there are serious privacy issues with this extension: No deletion, no public sharing consents!

This service desperately needs a function to delete what I shared. And it should ask for permission to make the chat world searchable instead of handing it to everybody without consents of the user!

It is just too easy to accidentally share credentials or private information, and sending DMs to a Twitter account should not be the solution here! It is not mandatory for a user to have a Twitter account in the first place. And I guess that the author also sometimes sleeps or has other things to do than to delete accidentally shared information.

There is no warning, anywhere, that the shared data is world searchable and readable. I thought that one gets a private URL, and I never intended to expose my conversation to more people than those I sent the link to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.