improves service info page
This commit is contained in:
parent
de5833e1e5
commit
111fb1a7c5
|
@ -0,0 +1,8 @@
|
|||
<!-- This file is loaded by the server's status page. It is a good place to put
|
||||
friendly welcome messages and instructions for connecting to your deployment. -->
|
||||
|
||||
# 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)
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue