moves keys.ts into keys/key-pool.ts

This commit is contained in:
nai-degen 2023-04-09 21:26:58 -07:00 committed by nai-degen
parent 05ba17e65a
commit 39cdb2e1e8
7 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import { Request, Response } from "express";
import showdown from "showdown";
import { config, listConfig } from "./config";
import { keys } from "./keys";
import { keys } from "./keys/key-pool";
import { getUniqueIps } from "./proxy/rate-limit";
export const handleInfoPage = (req: Request, res: Response) => {

0
src/keys/index.ts Normal file
View File

View File

@ -2,8 +2,8 @@
round-robin access to keys. Keys are stored in the OPENAI_KEY environment
variable, either as a single key, or a base64-encoded JSON array of keys.*/
import crypto from "crypto";
import { config } from "./config";
import { logger } from "./logger";
import { config } from "../config";
import { logger } from "../logger";
/** Represents a key stored in the OPENAI_KEY environment variable. */
type KeySchema = {

View File

@ -4,7 +4,7 @@ import util from "util";
import zlib from "zlib";
import * as httpProxy from "http-proxy";
import { logger } from "../logger";
import { keys } from "../keys";
import { keys } from "../keys/key-pool";
export const QUOTA_ROUTES = ["/v1/chat/completions"];

View File

@ -1,5 +1,5 @@
import type { ExpressHttpProxyReqCallback } from ".";
import { Key, keys } from "../../keys";
import { Key, keys } from "../../keys/key-pool";
/** Add an OpenAI key from the pool to the request. */
export const addKey: ExpressHttpProxyReqCallback = (proxyReq, req) => {

View File

@ -3,7 +3,7 @@ import express from "express";
import cors from "cors";
import pinoHttp from "pino-http";
import { logger } from "./logger";
import { keys } from "./keys";
import { keys } from "./keys/key-pool";
import { proxyRouter, rewriteTavernRequests } from "./proxy/routes";
import { handleInfoPage } from "./info-page";

View File

@ -1,5 +1,5 @@
import { Express } from "express-serve-static-core";
import { Key } from "../keys";
import { Key } from "../keys/key-pool";
declare global {
namespace Express {