Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/domeccleston/sharegpt
Easily share permanent links to ChatGPT conversations with your friends
https://github.com/domeccleston/sharegpt
ai chrome-extension
Last synced: about 2 months ago
JSON representation
Easily share permanent links to ChatGPT conversations with your friends
- Host: GitHub
- URL: https://github.com/domeccleston/sharegpt
- Owner: domeccleston
- License: mit
- Created: 2022-12-04T19:52:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-18T15:16:44.000Z (10 months ago)
- Last Synced: 2024-06-19T03:11:10.578Z (3 months ago)
- Topics: ai, chrome-extension
- Language: TypeScript
- Homepage: https://sharegpt.com
- Size: 4.52 MB
- Stars: 1,701
- Watchers: 19
- Forks: 212
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- License: license.md
Awesome Lists containing this project
- awesome-AIGC-tools - 分享你与 ChatGPT 的对话:ShareGPT
- Awesome-ChatGPT - shareGPT - permenent links to your conversations
- awesome-chatgpt-tools - shareGPT - permenent links to your conversations
- awesome-ChatGPT-resource-zh - shareGPT - 一键分享你与ChatGPT对话记录
- awesome - domeccleston/sharegpt - Easily share permanent links to ChatGPT conversations with your friends (TypeScript)
- awesome-open-gpt - sharegpt
- awesome-llmops - sharegpt - ![Repo stars of domeccleston/sharegpt](https://img.shields.io/github/stars/domeccleston/sharegpt?style=social) - An open-source Chrome Extension for you to share your wildest ChatGPT conversations with one click. (Tools (GitHub) / LLMOps vs MLOps)
- awesome-chatgpt - ShareGPT - Share permanent links to ChatGPT conversations. (Web apps / Hosted and self-hosted)
- awesome-chatgpt - Share your wildest ChatGPT conversations with one click
- fucking-awesome-chatgpt - shareGPT - permenent links to your conversations
- awesome-chatgpt - shareGPT - permenent links to your conversations
- awesome-ChatGPT-repositories - sharegpt - Easily share permanent links to ChatGPT conversations with your friends (Browser-extensions)
- awesome-chatgpt - shareGPT - permenent links to your conversations
- awesome-chatgpt - Chrome Add Share Button
- awesome-chatgpt - sharegpt
- StarryDivineSky - domeccleston/sharegpt
- awesome-chatgpt-zh - shareGPT - 对话的永久链接
- awesome-chatgpt - ShareGPT - Share permanent links to ChatGPT conversations. (Web apps / Hosted and self-hosted)
- awesome-chatgpt - domeccleston/sharegpt - Easily share permanent links to ChatGPT conversations with your friends (UIs / Browser extensions)
- awesome-gpt - shareGPT
- project-awesome - domeccleston/sharegpt - Easily share permanent links to ChatGPT conversations with your friends (TypeScript)
README
Share your wildest ChatGPT conversations with one click.
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:
- [Next.js](https://nextjs.org/) – framework
- [Typescript](https://www.typescriptlang.org/) – language
- [Tailwind](https://tailwindcss.com/) – CSS
- [Upstash](https://upstash.com/) – redis
- [Planetscale](https://planetscale.com/) – database
- [NextAuth.js](https://next-auth.js.org/) – auth
- [Vercel](https://vercel.com/) – hosting## 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:
```ts
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:
```ts
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:
```ts
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 filteredExample:
```ts
await fetch(
"https://sharegpt.com/api/conversations?type=new&page=2&search=python"
);
```This returns a list of conversations with the following type:
```ts
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
}
[];
```