diff --git a/info-page.md b/info-page.md new file mode 100644 index 0000000..7bbffaf --- /dev/null +++ b/info-page.md @@ -0,0 +1,8 @@ + + +# OAI Reverse Proxy + +This is a simple reverse proxy for the OpenAI API. To use it, refer to the `appUrls` listed in the Service Info section below and paste them into your preferred front-end. + +[https://github.com/nai-degen/oai-reverse-proxy](https://github.com/nai-degen/oai-reverse-proxy) diff --git a/src/info-page.ts b/src/info-page.ts index 9378088..36e8107 100644 --- a/src/info-page.ts +++ b/src/info-page.ts @@ -37,9 +37,7 @@ function getInfoPageHtml(host: string) { const info = { uptime: process.uptime(), timestamp: Date.now(), - // Describes the URLs each client app and adapter should use to connect appUrls: { - baseUrl: host, tavern: { kobold: host, openai: host + "/proxy/openai/v1", @@ -50,12 +48,12 @@ function getInfoPageHtml(host: string) { }, }, proompts: keys.reduce((acc, k) => acc + k.promptCount, 0), - ...(config.modelRateLimit ? { proomptingNow: getUniqueIps() } : {}), + ...(config.modelRateLimit ? { proomptersNow: getUniqueIps() } : {}), keyInfo, config: listConfig(), }; - const readme = require("fs").readFileSync("README.md", "utf8"); + const readme = require("fs").readFileSync("info-page.md", "utf8"); const readmeBody = readme.split("---")[2] || readme; const converter = new showdown.Converter(); const html = converter.makeHtml(readmeBody); diff --git a/src/key-management/key-checker.ts b/src/key-management/key-checker.ts index 6319262..ba397f9 100644 --- a/src/key-management/key-checker.ts +++ b/src/key-management/key-checker.ts @@ -26,14 +26,16 @@ type GetUsageResponse = { total_usage: number; }; +type UpdateFn = typeof KeyPool.prototype.update; + export class KeyChecker { private readonly keys: Key[]; private log = logger.child({ module: "KeyChecker" }); private timeout?: NodeJS.Timeout; - private updateKey: typeof KeyPool.prototype.update; + private updateKey: UpdateFn; private lastCheck = 0; - constructor(keys: Key[], updateKey: typeof KeyPool.prototype.update) { + constructor(keys: Key[], updateKey: UpdateFn) { this.keys = keys; this.updateKey = updateKey; }