From 5bf87646ebe6a5c771a6f7c5f70037d7312cb821 Mon Sep 17 00:00:00 2001 From: nai-degen <44111-khanon@users.noreply.gitgud.io> Date: Sun, 9 Apr 2023 18:55:24 -0500 Subject: [PATCH] adds preliminary replit support --- .replit | 27 +++++++++++++++++++++++++++ .replit.nix | 9 +++++++++ README.md | 5 +++++ package.json | 5 +++++ 4 files changed, 46 insertions(+) create mode 100644 .replit create mode 100644 .replit.nix diff --git a/.replit b/.replit new file mode 100644 index 0000000..ee956ee --- /dev/null +++ b/.replit @@ -0,0 +1,27 @@ +run = "npm run start:replit" +hidden = [".build", ".config"] + +[packager] +language = "nodejs" + +[packager.features] +enabledForHosting = false +packageSearch = true +guessImports = true + +[nix] +channel = "stable-22_11" + +[gitHubImport] +requiredFiles = [".replit", "replit.nix", ".config"] + +[languages] + +[languages.typescript] +pattern = "**/{*.ts,*.js,*.tsx,*.jsx}" + +[languages.typescript.languageServer] +start = "typescript-language-server --stdio" + +[deployment] +run = ["sh", "-c", "npm run start:replit"] diff --git a/.replit.nix b/.replit.nix new file mode 100644 index 0000000..5ef0cb2 --- /dev/null +++ b/.replit.nix @@ -0,0 +1,9 @@ +{ pkgs }: { + deps = [ + pkgs.nodejs-18_x + pkgs.yarn + pkgs.esbuild + pkgs.nodePackages.typescript + pkgs.nodePackages.typescript-language-server + ]; +} diff --git a/README.md b/README.md index 8fbae57..c16a66c 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ pinned: false Simple reverse proxy server for the OpenAI API. +[![Run on Repl.it](https://replit.com/badge/github/nai-degen/oai-reverse-proxy)](https://replit.com/new/github/nai-degen/oai-reverse-proxy) + ## What is this? If you have an API key you want to share with a friend, you can use this to keep your key safe while still allowing them to generate text with the API. @@ -51,3 +53,6 @@ If you still want to share access to your key, you can put it behind this proxy - However, if you want to protect access to the server, you can add another secret called `PROXY_KEY`. This key will need to be passed in the Authentication header of every request to the server, just like an OpenAI API key. **Note:** The `keys` section in the serverinfo screen may not correctly identify keys as trial/paid/GPT-4 unless you use the more advanced configuration described in `.env.example`. + + + diff --git a/package.json b/package.json index 30c1cda..3493929 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,12 @@ "scripts": { "build": "tsc", "start:dev": "nodemon --watch src --exec ts-node src/server.ts", + "start:replit": "tsc && node build/server.js", "start": "node build/server.js" }, + "engines": { + "node": ">=18.0.0" + }, "author": "", "license": "MIT", "dependencies": { @@ -14,6 +18,7 @@ "dotenv": "^16.0.3", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", + "pino": "^8.11.0", "pino-http": "^8.3.3", "showdown": "^2.1.0", "zlib": "^1.0.5"