improve language-model compatibility error messages with docs URL

This commit is contained in:
leonardotrapani
2026-02-01 13:34:50 +01:00
parent 811ca71c08
commit 170ac22e3c
6 changed files with 70 additions and 12 deletions
+12 -5
View File
@@ -212,16 +212,23 @@ func ValidateModelLanguageCompatibility(registryProvider, modelID, langCode stri
// truncate supported languages for error message
supported := model.SupportedLanguages
suffix := ""
if len(supported) > 10 {
supported = supported[:10]
if len(supported) > 5 {
supported = supported[:5]
suffix = "..."
}
// build error with docs URL if available
docsHint := ""
if model.DocsURL != "" {
docsHint = fmt.Sprintf(" See %s for full list.", model.DocsURL)
}
return fmt.Errorf(
"model %s does not support language '%s' (%s). Either change model, select auto-detect, or choose a supported language: %s%s",
modelID,
langCode,
"model %s does not support %s (%s).%s Supported: %s%s",
model.Name,
langName,
langCode,
docsHint,
strings.Join(supported, ", "),
suffix,
)