removes QUOTA_DISPLAY_MODE config as OpenAI no longer supports it
This commit is contained in:
+7
-13
@@ -10,7 +10,7 @@
|
||||
# REJECT_DISALLOWED=false
|
||||
# REJECT_MESSAGE="This content violates /aicg/'s acceptable use policy."
|
||||
# CHECK_KEYS=true
|
||||
# QUOTA_DISPLAY_MODE=full
|
||||
# TURBO_ONLY=false
|
||||
# BLOCKED_ORIGINS=reddit.com,9gag.com
|
||||
# BLOCK_MESSAGE="You must be over the age of majority in your country to use this service."
|
||||
# BLOCK_REDIRECT="https://roblox.com/"
|
||||
@@ -18,7 +18,8 @@
|
||||
# Note: CHECK_KEYS is disabled by default in local development mode, but enabled
|
||||
# by default in production mode.
|
||||
|
||||
# Optional settings for user management. See docs/user-management.md.
|
||||
# Optional settings for user management and access control. See
|
||||
# `docs/user-management.md` to learn how to use these.
|
||||
# GATEKEEPER=none
|
||||
# GATEKEEPER_STORE=memory
|
||||
# MAX_IPS_PER_USER=20
|
||||
@@ -27,7 +28,8 @@
|
||||
# PROMPT_LOGGING=false
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# The values below are secret -- make sure they are set securely.
|
||||
# The values below are secret -- make sure they are set securely. Do NOT set
|
||||
# them in the .env file of a public repository.
|
||||
# For Huggingface, set them via the Secrets section in your Space's config UI.
|
||||
# For Render, create a "secret file" called .env using the Environment tab.
|
||||
|
||||
@@ -35,24 +37,16 @@
|
||||
OPENAI_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
ANTHROPIC_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
# TEMPORARY: This will eventually be replaced by a more robust system.
|
||||
# You can adjust the models used when sending OpenAI prompts to /anthropic.
|
||||
# Refer to Anthropic's docs for more info (note that they don't list older
|
||||
# versions of the models, but they still work).
|
||||
# CLAUDE_SMALL_MODEL=claude-v1.2
|
||||
# CLAUDE_BIG_MODEL=claude-v1-100k
|
||||
|
||||
# You can require a Bearer token for requests when using proxy_token gatekeeper.
|
||||
# PROXY_KEY=your-secret-key
|
||||
|
||||
# You can set an admin key for user management when using user_token gatekeeper.
|
||||
# ADMIN_KEY=your-very-secret-key
|
||||
|
||||
# These are used for various persistence features. Refer to the docs for more
|
||||
# info.
|
||||
# These are used to persist user data to Firebase across restarts.
|
||||
# FIREBASE_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
# FIREBASE_RTDB_URL=https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.firebaseio.com
|
||||
|
||||
# This is only relevant if you want to use the prompt logging feature.
|
||||
# These are used to log prompts to Google Sheets.
|
||||
# GOOGLE_SHEETS_SPREADSHEET_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
# GOOGLE_SHEETS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
@@ -96,16 +96,6 @@ type Config = {
|
||||
googleSheetsSpreadsheetId?: string;
|
||||
/** Whether to periodically check keys for usage and validity. */
|
||||
checkKeys?: boolean;
|
||||
/**
|
||||
* How to display quota information on the info page.
|
||||
*
|
||||
* `none`: Hide quota information
|
||||
*
|
||||
* `partial`: (deprecated) Same as `full` because usage is no longer tracked
|
||||
*
|
||||
* `full`: Displays information about keys' quota limits
|
||||
*/
|
||||
quotaDisplayMode: "none" | "full";
|
||||
/**
|
||||
* Comma-separated list of origins to block. Requests matching any of these
|
||||
* origins or referers will be rejected.
|
||||
@@ -160,7 +150,6 @@ export const config: Config = {
|
||||
),
|
||||
logLevel: getEnvWithDefault("LOG_LEVEL", "info"),
|
||||
checkKeys: getEnvWithDefault("CHECK_KEYS", !isDev),
|
||||
quotaDisplayMode: getEnvWithDefault("QUOTA_DISPLAY_MODE", "full"),
|
||||
promptLogging: getEnvWithDefault("PROMPT_LOGGING", false),
|
||||
promptLoggingBackend: getEnvWithDefault("PROMPT_LOGGING_BACKEND", undefined),
|
||||
googleSheetsKey: getEnvWithDefault("GOOGLE_SHEETS_KEY", undefined),
|
||||
@@ -278,7 +267,6 @@ export const OMITTED_KEYS: (keyof Config)[] = [
|
||||
"proxyKey",
|
||||
"adminKey",
|
||||
"checkKeys",
|
||||
"quotaDisplayMode",
|
||||
"googleSheetsKey",
|
||||
"firebaseKey",
|
||||
"firebaseRtdbUrl",
|
||||
|
||||
@@ -107,21 +107,9 @@ function getOpenAIInfo() {
|
||||
const turboKeys = keys.filter((k) => !k.isGpt4);
|
||||
const gpt4Keys = keys.filter((k) => k.isGpt4);
|
||||
|
||||
const quota: Record<string, string> = { turbo: "", gpt4: "" };
|
||||
const turboQuota = keyPool.activeLimitInUsd("openai");
|
||||
const gpt4Quota = keyPool.activeLimitInUsd("openai", { gpt4: true });
|
||||
|
||||
// Don't invert this condition; some proxies may be using the now-deprecated
|
||||
// 'partial' option which we want to treat as 'full' here.
|
||||
if (config.quotaDisplayMode !== "none") {
|
||||
quota.turbo = turboQuota;
|
||||
quota.gpt4 = gpt4Quota;
|
||||
}
|
||||
|
||||
info.turbo = {
|
||||
activeKeys: turboKeys.filter((k) => !k.isDisabled).length,
|
||||
trialKeys: turboKeys.filter((k) => k.isTrial).length,
|
||||
// activeLimit: quota.turbo,
|
||||
revokedKeys: turboKeys.filter((k) => k.isRevoked).length,
|
||||
overQuotaKeys: turboKeys.filter((k) => k.isOverQuota).length,
|
||||
};
|
||||
@@ -130,16 +118,10 @@ function getOpenAIInfo() {
|
||||
info.gpt4 = {
|
||||
activeKeys: gpt4Keys.filter((k) => !k.isDisabled).length,
|
||||
trialKeys: gpt4Keys.filter((k) => k.isTrial).length,
|
||||
// activeLimit: quota.gpt4,
|
||||
revokedKeys: gpt4Keys.filter((k) => k.isRevoked).length,
|
||||
overQuotaKeys: gpt4Keys.filter((k) => k.isOverQuota).length,
|
||||
};
|
||||
}
|
||||
|
||||
if (config.quotaDisplayMode === "none") {
|
||||
// delete info.turbo?.activeLimit;
|
||||
// delete info.gpt4?.activeLimit;
|
||||
}
|
||||
} else {
|
||||
info.status = "Key checking is disabled." as any;
|
||||
info.turbo = { activeKeys: keys.filter((k) => !k.isDisabled).length };
|
||||
|
||||
Reference in New Issue
Block a user