feat: admin-configurable default AI providers/models (v0.30.0)
Add DEFAULT_{TEXT,VISION,MEAL_PLAN}_{PROVIDER,MODEL} site settings,
editable from Settings -> Admin (new AdminDefaultModelForm, mirroring
the per-user model-prefs UI). getDefaultProviderWithKey now accepts
the use case and checks the admin default (after the user's own BYOK
key, before the old "first configured site key" heuristic) so admins
can pin a specific provider/model per feature instead of it being
whichever key happens to exist.
Wired into scale/substitute/batch-cook/meal-plan generation routes,
which previously called getDefaultProviderWithKey() without a use
case and so never had visibility into per-feature routing at all.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,13 @@ export type SiteSettingKey =
|
||||
| "OLLAMA_BASE_URL"
|
||||
| "NEXT_PUBLIC_VAPID_PUBLIC_KEY"
|
||||
| "VAPID_PRIVATE_KEY"
|
||||
| "SIGNUPS_DISABLED";
|
||||
| "SIGNUPS_DISABLED"
|
||||
| "DEFAULT_TEXT_PROVIDER"
|
||||
| "DEFAULT_TEXT_MODEL"
|
||||
| "DEFAULT_VISION_PROVIDER"
|
||||
| "DEFAULT_VISION_MODEL"
|
||||
| "DEFAULT_MEAL_PLAN_PROVIDER"
|
||||
| "DEFAULT_MEAL_PLAN_MODEL";
|
||||
|
||||
const SECRET_KEYS: SiteSettingKey[] = [
|
||||
"OPENAI_API_KEY",
|
||||
@@ -46,6 +52,12 @@ export async function getAllSiteSettings(): Promise<Record<string, { value: stri
|
||||
"OLLAMA_BASE_URL",
|
||||
"NEXT_PUBLIC_VAPID_PUBLIC_KEY",
|
||||
"VAPID_PRIVATE_KEY",
|
||||
"DEFAULT_TEXT_PROVIDER",
|
||||
"DEFAULT_TEXT_MODEL",
|
||||
"DEFAULT_VISION_PROVIDER",
|
||||
"DEFAULT_VISION_MODEL",
|
||||
"DEFAULT_MEAL_PLAN_PROVIDER",
|
||||
"DEFAULT_MEAL_PLAN_MODEL",
|
||||
];
|
||||
|
||||
const result: Record<string, { value: string | null; isSecret: boolean; fromDb: boolean }> = {};
|
||||
|
||||
Reference in New Issue
Block a user