mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-03 01:50:23 +08:00
fix: block global-credential providers already managed via env
Bedrock, Vertex AI, and Ollama credentials live in fixed env vars with no apiKeyEnv redirection, so a panel instance of one of these would silently override the credentials that env-configured models rely on. The API now rejects saving such a provider when the env config already uses that type, and the Add Provider dropdown disables it with a 'managed via env' note.
This commit is contained in:
@@ -72,8 +72,7 @@ export async function PUT(req: Request) {
|
||||
const merged = mergeSecrets(parsed.data, stored)
|
||||
|
||||
const envConfig = await loadEnvServerModelsConfig()
|
||||
const envNames = envConfig?.providers.map((p) => p.name) ?? []
|
||||
const validationError = validateAdminProviders(merged, envNames)
|
||||
const validationError = validateAdminProviders(merged, envConfig)
|
||||
if (validationError) {
|
||||
return Response.json({ error: validationError }, { status: 400 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user