forked from all-in-aigc/gpts-works
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4683743
Showing
78 changed files
with
16,081 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"git.ignoreLimitWarning": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
# GPTs Works | ||
|
||
GPTs Works is a Third-party GPTs store. | ||
|
||
## Introduction | ||
|
||
This project consists of the following three parts👇 | ||
|
||
1. Website | ||
|
||
code located in the `web` directory. | ||
|
||
you can view a live demo at: [https://gpts.works](https://gpts.works) | ||
|
||
![Website](https://ph-files.imgix.net/45d5eb41-849f-415b-91da-079b6e32946e.png?auto=compress&codec=mozjpeg&cs=strip&auto=format&fit=max&dpr=2) | ||
|
||
2. Index System | ||
|
||
code located in the `index` directory. | ||
|
||
index system is used for searching GPTs with vector. | ||
|
||
there is a GPTs built with index system: [https://chat.openai.com/g/g-EBKM6RsBl-gpts-works](https://chat.openai.com/g/g-EBKM6RsBl-gpts-works) | ||
|
||
![GPTs](https://ph-files.imgix.net/f12174a9-085c-42d0-8f0d-06013cd17c7b.png?auto=compress&codec=mozjpeg&cs=strip&auto=format&fit=max&dpr=2) | ||
|
||
3. Browser Extension | ||
|
||
code located in the `extension` directory. | ||
|
||
browser extension is used to show Third-party GPTs beside ChatGPT Explore page. | ||
|
||
![Extension](https://ph-files.imgix.net/e43df90d-f55f-4dee-b121-5051710397bd.png?auto=compress&codec=mozjpeg&cs=strip&auto=format&fit=max&dpr=2) | ||
|
||
## Dependencies | ||
|
||
- [Vercel](https://vercel.com/): used for deploying website | ||
- [Vercel Storage Postgres](https://vercel.com/docs/storage/vercel-postgres): used for storing data. | ||
- [Zilliz Cloud](https://cloud.zilliz.com/): used for vector storing and searching | ||
|
||
## Quick start | ||
|
||
### Clone project | ||
|
||
```shell | ||
git clone https://github.com/all-in-aigc/gpts-works.git path-to-project | ||
``` | ||
|
||
### Prepare data | ||
|
||
1. create table in your postgres database with sql: | ||
|
||
```sql | ||
CREATE TABLE gpts ( | ||
id SERIAL PRIMARY KEY, | ||
uuid VARCHAR(255) UNIQUE NOT NULL, | ||
org_id VARCHAR(255), | ||
name VARCHAR(255), | ||
description TEXT, | ||
avatar_url TEXT, | ||
short_url VARCHAR(255), | ||
author_id VARCHAR(255), | ||
author_name VARCHAR(255), | ||
created_at timestamptz, | ||
updated_at timestamptz, | ||
detail JSON, | ||
index_updated_at INT NOT NULL DEFAULT 0 | ||
); | ||
``` | ||
|
||
2. insert your own GPTs data into your postgres database | ||
|
||
### Start with Website | ||
|
||
1. locate a .env file in dir `path-to-project/web` with content: | ||
|
||
``` | ||
POSTGRES_URL="postgres://default:[email protected]/verceldb" | ||
INDEX_API_BASE_URI="http://127.0.0.1:8068" | ||
INDEX_API_KEY="gsk-xxx" | ||
``` | ||
|
||
2. install dependencies | ||
|
||
```shell | ||
pnpm install | ||
``` | ||
|
||
3. start web server | ||
|
||
``` | ||
make dev | ||
``` | ||
|
||
4. preview website | ||
|
||
open `http://localhost:8067` | ||
|
||
### Start with Index System | ||
|
||
1. locate a .env file in `path-to-project/index` with content | ||
|
||
``` | ||
DATABASE_URL=postgres://default:[email protected]:5432/verceldb | ||
AZURE_API_KEY=xxx | ||
AZURE_API_BASE=https://xxx.openai.azure.com/ | ||
AZURE_API_VERSION=2023-07-01-preview | ||
AZURE_LLM_MODEL=gpt-35-turbo-16k | ||
AZURE_EMBED_MODEL=text-embedding-ada-002 | ||
STORE_TYPE=zilliz | ||
STORE_URI=https://xxx.zillizcloud.com | ||
STORE_TOKEN=xxx | ||
STORE_DIM=1536 | ||
STORE_COLLECTION=gpts | ||
INDEX_API_KEY=gsk-xxx | ||
``` | ||
|
||
2. install dependencies | ||
|
||
```shell | ||
pip install -r requirements.txt | ||
``` | ||
|
||
3. start api server | ||
|
||
``` | ||
make dev | ||
``` | ||
|
||
4. build index for gpts data | ||
|
||
``` | ||
curl -X POST -H "Authorization: Bearer gsk-xxx" http://127.0.0.1:8068/gpts/index | ||
``` | ||
|
||
5. search gpts from index | ||
|
||
``` | ||
curl -X POST -H "Authorization: Bearer gsk-xxx" -H "Content-Type: application/json" -d '{"question": "What GPTs are used for coding?"}' http://127.0.0.1:8068/gpts/index | ||
``` | ||
|
||
### Start with Extension | ||
|
||
goto `path-to-project/extension` | ||
|
||
1. install dependencies | ||
|
||
``` | ||
pnpm install | ||
``` | ||
|
||
2. start server | ||
|
||
``` | ||
make dev | ||
``` | ||
|
||
3. debug extension | ||
|
||
open `chrome://extensions/`, click `Load unpacked` | ||
|
||
## Thanks to | ||
|
||
- [@airyland](https://github.com/airyland) for sharing gpts-data | ||
- [next.js](https://github.com/vercel/next.js) for web deployment | ||
- [fastapi](https://github.com/tiangolo/fastapi) for building index system | ||
- [plasmo](https://github.com/PlasmoHQ/plasmo) for browser extension development | ||
|
||
> if this project is helpful to you, you can buy me a coffee😄 | ||
[![Buy Me A Coffee](https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=idoubi&button_colour=FF5F5F&font_colour=ffffff&font_family=Cookie&outline_colour=000000&coffee_colour=FFDD00)](https://www.buymeacoffee.com/idoubi) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CREATE TABLE gpts ( | ||
id SERIAL PRIMARY KEY, | ||
uuid VARCHAR(255) UNIQUE NOT NULL, | ||
org_id VARCHAR(255), | ||
name VARCHAR(255), | ||
description TEXT, | ||
avatar_url TEXT, | ||
short_url VARCHAR(255), | ||
author_id VARCHAR(255), | ||
author_name VARCHAR(255), | ||
created_at timestamptz, | ||
updated_at timestamptz, | ||
detail JSON, | ||
index_updated_at INT NOT NULL DEFAULT 0 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: "Submit to Web Store" | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Cache pnpm modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: latest | ||
run_install: true | ||
- name: Use Node.js 16.x | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 16.x | ||
cache: "pnpm" | ||
- name: Build the extension | ||
run: pnpm build | ||
- name: Package the extension into a zip artifact | ||
run: pnpm package | ||
- name: Browser Platform Publish | ||
uses: PlasmoHQ/bpp@v3 | ||
with: | ||
keys: ${{ secrets.SUBMIT_KEYS }} | ||
artifact: build/chrome-mv3-prod.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
#cache | ||
.turbo | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env* | ||
|
||
out/ | ||
build/ | ||
dist/ | ||
|
||
# plasmo - https://www.plasmo.com | ||
.plasmo | ||
|
||
# bpp - http://bpp.browser.market/ | ||
keys.json | ||
|
||
# typescript | ||
.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @type {import('prettier').Options} | ||
*/ | ||
export default { | ||
printWidth: 80, | ||
tabWidth: 2, | ||
useTabs: false, | ||
semi: false, | ||
singleQuote: false, | ||
trailingComma: "none", | ||
bracketSpacing: true, | ||
bracketSameLine: true, | ||
plugins: ["@ianvs/prettier-plugin-sort-imports"], | ||
importOrder: [ | ||
"<BUILTIN_MODULES>", // Node.js built-in modules | ||
"<THIRD_PARTY_MODULES>", // Imports not matched by other special words or groups. | ||
"", // Empty line | ||
"^@plasmo/(.*)$", | ||
"", | ||
"^@plasmohq/(.*)$", | ||
"", | ||
"^~(.*)$", | ||
"", | ||
"^[./]" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dev: | ||
pnpm dev |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "gpts-works", | ||
"displayName": "GPTs Works", | ||
"version": "1.0.2", | ||
"description": "This extension is used to show Third-party GPTs in ChatGPT explore page.", | ||
"author": "idoubi<[email protected]>", | ||
"scripts": { | ||
"dev": "plasmo dev", | ||
"build": "plasmo build", | ||
"package": "plasmo package" | ||
}, | ||
"dependencies": { | ||
"@plasmohq/messaging": "^0.6.0", | ||
"plasmo": "0.84.0", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@ianvs/prettier-plugin-sort-imports": "4.1.1", | ||
"@types/chrome": "0.0.251", | ||
"@types/node": "20.9.0", | ||
"@types/react": "18.2.37", | ||
"@types/react-dom": "18.2.15", | ||
"autoprefixer": "^10.4.16", | ||
"daisyui": "^3.9.4", | ||
"postcss": "^8.4.31", | ||
"prettier": "3.0.3", | ||
"tailwindcss": "^3.3.5", | ||
"typescript": "5.2.2" | ||
}, | ||
"manifest": { | ||
"host_permissions": [ | ||
"https://gpts.works/*" | ||
], | ||
"permissions": [] | ||
} | ||
} |
Oops, something went wrong.