hn-chatgpt-plugin

所属分类:GPT/ChatGPT
开发工具:Python
文件大小:314KB
下载次数:0
上传日期:2023-05-23 02:10:51
上 传 者sh-1993
说明:  黑客新闻的ChatGPT插件
(ChatGPT plugin for Hacker News)

文件列表:
.vscode (0, 2023-05-23)
.vscode\settings.json (132, 2023-05-23)
algolia (0, 2023-05-23)
algolia\app.py (1451, 2023-05-23)
algolia\requirements.txt (49, 2023-05-23)
algolia\static (0, 2023-05-23)
algolia\static\ai-plugin.json (691, 2023-05-23)
algolia\static\logo.png (2075, 2023-05-23)
algolia\static\openapi.yaml (7120, 2023-05-23)
api-server (0, 2023-05-23)
api-server\main.py (10621, 2023-05-23)
api-server\requirements.txt (156, 2023-05-23)
api-server\schema.py (10207, 2023-05-23)
api-server\search.py (6620, 2023-05-23)
api-server\static (0, 2023-05-23)
api-server\static\ai-plugin.json (1851, 2023-05-23)
api-server\static\hn.jpg (1484, 2023-05-23)
api-server\static\index.html (13091, 2023-05-23)
api-server\static\legal.html (7555, 2023-05-23)
api-server\static\openapi.yaml (9572, 2023-05-23)
api-server\utils.py (7652, 2023-05-23)
datasette (0, 2023-05-23)
datasette\app.py (2621, 2023-05-23)
datasette\static (0, 2023-05-23)
datasette\static\ai-plugin.json (1289, 2023-05-23)
datasette\static\openapi.yaml (1070, 2023-05-23)
datasette\static\yc.jpg (1484, 2023-05-23)
embeddings (0, 2023-05-23)
embeddings\embedder.py (12999, 2023-05-23)
embeddings\health.html (2235, 2023-05-23)
embeddings\main.py (4730, 2023-05-23)
embeddings\requirements.txt (199, 2023-05-23)
embeddings\search.py (2723, 2023-05-23)
embeddings\updater.py (11099, 2023-05-23)
embeddings\utils.py (4311, 2023-05-23)
hn-to-sqlite (0, 2023-05-23)
... ...

# Hacker News ¤ ChatGPT Plugin This is a ChatGPT plugin to query, analyze, and summarize insights from the [Hacker News](https://news.ycombinator.com) community! ## Demo If you have access to [ChatGPT plugins](https://openai.com/blog/chatgpt-plugins), just add this as an unverified plugin using the URL: https://hn.kix.in/ If you don't have plugins access, you can try out a [basic approximation of the experience here](https://hn.kix.in/). The full REST API exposed to ChatGPT is documented [here](https://hn.kix.in/docs), where you can also interact with it. ‘‰ [Video and detailed explanation of the code](https://www.kix.in/2023/05/05/hacker-news-chatgpt-plugin/) ‘ ## Running locally [**Download the SQLite DB from**](https://huggingface.co/datasets/anantn/hacker-news/tree/main) ¤— Assuming you have 32GB of RAM, take a look at [playground.ipynb](playground.ipynb) for quick and dirty ways to run analysis on the sqlite dataset loaded into memory. You'll need atleast 30G of free disk space and >20G RAM to run the semantic search engine and ChatGPT plugin API. An NVIDIA GPU is highly recommended, embedding generation on CPU is painfully slow and untested on non-NVIDIA GPUs. Clone the repo and install pre-requisites. ```bash git clone https://github.com/anantn/hn-chatgpt-plugin.git cd hn-chatgpt-plugin/api-server pip install -r requirements.txt cd ../embeddings pip install -r requirements.txt # Install zstd with your favorite package manager (brew, apt, etc) sudo apt install zstd ``` Grab the datasets [from HuggingFace](https://huggingface.co/datasets/anantn/hacker-news/tree/main) and decompress them: ```bash wget https://huggingface.co/datasets/anantn/hacker-news/resolve/main/hn-sqlite-20230429.db.zst pzstd -d hn-sqlite-20230429.db.zst wget https://huggingface.co/datasets/anantn/hacker-news/resolve/main/hn-sqlite-20230429_embeddings.db.zst pzstd -d hn-sqlite-20230429_embeddings.db.zst ``` Run the embedding server first. The embedding server will by default try to "catch up" on all the latest data changes since the snapshot was generated. You can disable all data updates (recommended for your first run): ```bash DB_PATH=hn-sqlite-20230429.db OPTS=nosync,noembedcu,noembedrt python main.py ``` If you want to generate embeddings and keep your local SQLite database up to date, just run `main.py` with no `OPTS` environment variable. Once the embedding server is running, start the API server: ```bash cd hn-chatgpt-plugin/api-server DB_PATH=hn-sqlite-20230429.db python main.py ``` Fire up `localhost:8000` in your browser! ## Algolia Search Plugin Earlier attempt, but still useful: integrates [Algolia's Hacker News search API](https://hn.algolia.com/api) with [ChatGPT plugins](https://openai.com/blog/chatgpt-plugins) to have conversations about content on hacker news. If you have plugin access, you can try it: ```bash $ cd algolia $ pip install -r requirements.txt $ python app.py ``` [Open a chat](https://chat.openai.com/) with plugins enabled, then: `Plugin store > Develop your own plugin > localhost:3333 > Fetch manifest`. ChatGPT seems to hallucinate some parameters to the API, particularly the `sortBy` and `sortOrder` arguments — which may make sense to implement. ## Datasette Plugin [Datasette](https://datasette.io/) exposes a REST API to any SQLite database. I [experimented with](datasette/) using it to interace with ChatGPT. You can try it in the same way as the algolia plugin.

近期下载者

相关文件


收藏者