Spaces:
Sleeping
Sleeping
fix(flags, providers): update default model and provider; adjust rate limit for no-login usage
cb2ed63
| // Centralized feature flags and defaults for embed/lite mode | |
| // Use NEXT_PUBLIC_* for values read in client components | |
| // Avoid Node type dependency | |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| declare const process: any; | |
| export const EMBED_MODE = (process.env.NEXT_PUBLIC_EMBED_MODE ?? "false") === "true"; | |
| export const DISABLE_AUTH = EMBED_MODE || (process.env.NEXT_PUBLIC_DISABLE_AUTH ?? process.env.DISABLE_AUTH ?? "false") === "true"; | |
| // Default model/provider for simplified UI | |
| // Choose a responsive general-purpose coding model from the existing list | |
| export const DEFAULT_MODEL = process.env.NEXT_PUBLIC_DEFAULT_MODEL | |
| || process.env.DEFAULT_MODEL | |
| || "deepseek-ai/DeepSeek-V3.1"; // budget-strong default via Novita | |
| export const DEFAULT_PROVIDER = process.env.NEXT_PUBLIC_DEFAULT_PROVIDER | |
| || process.env.DEFAULT_PROVIDER | |
| || "novita"; // validated against model/providers list | |
| // Anonymous/IP rate limit for no-login usage | |
| export const MAX_REQUESTS_PER_IP_ENV = Number( | |
| process.env.NEXT_PUBLIC_MAX_REQUESTS_PER_IP | |
| || process.env.MAX_REQUESTS_PER_IP | |
| || 3 | |
| ); | |
| // Hard cap on model output tokens to control cost in demo/embed mode | |
| export const MAX_OUTPUT_TOKENS = Number( | |
| process.env.NEXT_PUBLIC_MAX_OUTPUT_TOKENS | |
| || process.env.MAX_OUTPUT_TOKENS | |
| || (EMBED_MODE ? 1000 : 2000) | |
| ); | |
| // UI toggles derived from flags | |
| export const HIDE_LOGIN = DISABLE_AUTH || EMBED_MODE; | |
| export const HIDE_DEPLOY = EMBED_MODE; // hide deploy/save in embedded demo | |