mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-08 10:47:48 +08:00
refactor: drop request-body token override, keep env-only config
The unauthenticated /api/validate-model endpoint should not let callers raise the token budget; the env var / admin setting alone fixes #883. Also import the shared constants in the settings registry instead of duplicating them, and move the setting to the Features group alongside the other validation settings.
This commit is contained in:
@@ -10,6 +10,11 @@
|
||||
// - ADMIN_PASSWORD / SETTINGS_FILE: bootstrap values, env-only to avoid lockout
|
||||
// - Per-provider reasoning/thinking tuning vars: env-only (see env.example)
|
||||
|
||||
import {
|
||||
DEFAULT_MODEL_VALIDATION_MAX_TOKENS,
|
||||
MAX_MODEL_VALIDATION_MAX_TOKENS,
|
||||
} from "@/lib/model-validation"
|
||||
|
||||
export type SettingType = "string" | "secret" | "number" | "boolean" | "enum"
|
||||
|
||||
export interface SettingDef {
|
||||
@@ -88,17 +93,6 @@ export const SETTINGS_REGISTRY: SettingDef[] = [
|
||||
label: "Max Output Tokens",
|
||||
min: 1,
|
||||
},
|
||||
{
|
||||
key: "MODEL_VALIDATION_MAX_TOKENS",
|
||||
group: "generation",
|
||||
type: "number",
|
||||
label: "Model Validation Max Tokens",
|
||||
description:
|
||||
"Token budget for model test requests. Increase for reasoning models that may emit thinking tokens first.",
|
||||
min: 1,
|
||||
max: 64000,
|
||||
default: "1000",
|
||||
},
|
||||
|
||||
// ── Access Control ───────────────────────────────────────────────
|
||||
{
|
||||
@@ -134,6 +128,17 @@ export const SETTINGS_REGISTRY: SettingDef[] = [
|
||||
label: "Validation Timeout (ms)",
|
||||
min: 1000,
|
||||
},
|
||||
{
|
||||
key: "MODEL_VALIDATION_MAX_TOKENS",
|
||||
group: "features",
|
||||
type: "number",
|
||||
label: "Model Validation Max Tokens",
|
||||
description:
|
||||
"Token budget for model test requests. Increase for reasoning models that may emit thinking tokens first.",
|
||||
min: 1,
|
||||
max: MAX_MODEL_VALIDATION_MAX_TOKENS,
|
||||
default: String(DEFAULT_MODEL_VALIDATION_MAX_TOKENS),
|
||||
},
|
||||
{
|
||||
key: "ENABLE_HISTORY_XML_REPLACE",
|
||||
group: "features",
|
||||
|
||||
Reference in New Issue
Block a user