reverts default quotaDisplay to partial; removes rejectSampleRate
This commit is contained in:
parent
7382bdc92e
commit
5238aff378
|
@ -7,7 +7,6 @@
|
|||
# LOG_LEVEL=info
|
||||
# REJECT_DISALLOWED=false
|
||||
# REJECT_MESSAGE="This content violates /aicg/'s acceptable use policy."
|
||||
# REJECT_SAMPLE_RATE=0.2
|
||||
# CHECK_KEYS=false
|
||||
# QUOTA_DISPLAY_MODE=full
|
||||
# QUEUE_MODE=fair
|
||||
|
|
|
@ -19,8 +19,6 @@ type Config = {
|
|||
maxOutputTokens: number;
|
||||
/** Whether requests containing disallowed characters should be rejected. */
|
||||
rejectDisallowed?: boolean;
|
||||
/** Rejection sample rate (0 - 1). Higher values are more strict but increase server load. */
|
||||
rejectSampleRate?: number;
|
||||
/** Message to return when rejecting requests. */
|
||||
rejectMessage?: string;
|
||||
/** Pino log level. */
|
||||
|
@ -38,10 +36,10 @@ type Config = {
|
|||
/**
|
||||
* How to display quota information on the info page.
|
||||
* 'none' - Hide quota information
|
||||
* 'simple' - Display quota information as a percentage
|
||||
* 'partial' - Display quota information only as a percentage
|
||||
* 'full' - Display quota information as usage against total capacity
|
||||
*/
|
||||
quotaDisplayMode: "none" | "simple" | "full";
|
||||
quotaDisplayMode: "none" | "partial" | "full";
|
||||
/**
|
||||
* Which request queueing strategy to use when keys are over their rate limit.
|
||||
* 'fair' - Requests are serviced in the order they were received (default)
|
||||
|
@ -60,14 +58,13 @@ export const config: Config = {
|
|||
modelRateLimit: getEnvWithDefault("MODEL_RATE_LIMIT", 4),
|
||||
maxOutputTokens: getEnvWithDefault("MAX_OUTPUT_TOKENS", 300),
|
||||
rejectDisallowed: getEnvWithDefault("REJECT_DISALLOWED", false),
|
||||
rejectSampleRate: getEnvWithDefault("REJECT_SAMPLE_RATE", 0.2),
|
||||
rejectMessage: getEnvWithDefault(
|
||||
"REJECT_MESSAGE",
|
||||
"This content violates /aicg/'s acceptable use policy."
|
||||
),
|
||||
logLevel: getEnvWithDefault("LOG_LEVEL", "info"),
|
||||
checkKeys: getEnvWithDefault("CHECK_KEYS", !isDev),
|
||||
quotaDisplayMode: getEnvWithDefault("QUOTA_DISPLAY_MODE", "full"),
|
||||
quotaDisplayMode: getEnvWithDefault("QUOTA_DISPLAY_MODE", "partial"),
|
||||
promptLogging: getEnvWithDefault("PROMPT_LOGGING", false),
|
||||
promptLoggingBackend: getEnvWithDefault("PROMPT_LOGGING_BACKEND", undefined),
|
||||
googleSheetsKey: getEnvWithDefault("GOOGLE_SHEETS_KEY", undefined),
|
||||
|
|
|
@ -155,7 +155,7 @@ function getQueueInformation() {
|
|||
(waitMs % 60000) / 1000
|
||||
)}sec`;
|
||||
return {
|
||||
proomptersWaiting: getQueueLength(),
|
||||
estimatedWaitTime: waitMs > 1000 ? waitTime : "no wait",
|
||||
proomptersInQueue: getQueueLength(),
|
||||
estimatedQueueTime: waitMs > 2000 ? waitTime : "no wait",
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ const DISALLOWED_REGEX =
|
|||
// each 15k character request ten times a second. So we'll just sample 20% of
|
||||
// the characters and hope that's enough.
|
||||
const containsDisallowedCharacters = (text: string) => {
|
||||
const sampleSize = Math.ceil(text.length * (config.rejectSampleRate || 0.2));
|
||||
const sampleSize = Math.ceil(text.length * 0.2);
|
||||
const sample = text
|
||||
.split("")
|
||||
.sort(() => 0.5 - Math.random())
|
||||
|
|
Loading…
Reference in New Issue