Summary
When the model registry fails to load (bad config, provider error, stale cache), the /api/models route currently returns an empty success-like payload. The UI therefore shows an empty model list with no explanation, making provider/config failures invisible and hard to diagnose.
Problem
A downstream wrapper currently has to patch app/api/models/route.ts (via withSafeModelLoadFailure) to append a modelError field so the UI can show a safe, actionable message instead of a silent empty list. This is a generic UX improvement that should live upstream.
Suggested fix
When model loading fails, return a modelError field (a safe, non-sensitive message such as "模型列表暂时不可用,请检查配置后重试") alongside the (possibly empty) models payload, and have the UI render it. The message must not leak config paths, tokens, or provider-specific error details.
Value
- Surfaces provider/config failures instead of masking them as an empty success.
- Useful for all users, not just downstream wrappers.
- Small, self-contained change.
Environment
Summary
When the model registry fails to load (bad config, provider error, stale cache), the
/api/modelsroute currently returns an empty success-like payload. The UI therefore shows an empty model list with no explanation, making provider/config failures invisible and hard to diagnose.Problem
A downstream wrapper currently has to patch
app/api/models/route.ts(viawithSafeModelLoadFailure) to append amodelErrorfield so the UI can show a safe, actionable message instead of a silent empty list. This is a generic UX improvement that should live upstream.Suggested fix
When model loading fails, return a
modelErrorfield (a safe, non-sensitive message such as "模型列表暂时不可用,请检查配置后重试") alongside the (possibly empty) models payload, and have the UI render it. The message must not leak config paths, tokens, or provider-specific error details.Value
Environment