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:
dayuan.jiang
2026-06-11 18:08:02 +09:00
parent 8ca628a872
commit b0a96c23a3
5 changed files with 103 additions and 22 deletions

View File

@@ -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 })
}