chore(gallery agent): try fixing linting errors

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-10-16 09:44:04 +02:00
parent 1208fb6fa1
commit b0eb1ab2a1
+17 -3
View File
@@ -43,7 +43,19 @@ func generateYAMLEntry(model ProcessedModel, familyAnchor string) string {
description = cleanTextContent(description)
// Format description for YAML (indent each line and ensure no trailing spaces)
formattedDescription := strings.ReplaceAll(description, "\n", "\n ")
// Handle empty lines properly to avoid spaces-only lines
lines := strings.Split(description, "\n")
var formattedLines []string
for _, line := range lines {
if strings.TrimSpace(line) == "" {
// Empty line - don't add spaces
formattedLines = append(formattedLines, "")
} else {
// Non-empty line - add proper indentation
formattedLines = append(formattedLines, " "+line)
}
}
formattedDescription := strings.Join(formattedLines, "\n")
// Remove any trailing spaces from the formatted description
formattedDescription = strings.TrimRight(formattedDescription, " \t")
yamlTemplate := ""
@@ -60,7 +72,8 @@ func generateYAMLEntry(model ProcessedModel, familyAnchor string) string {
files:
- filename: %s
sha256: %s
uri: huggingface://%s/%s`
uri: huggingface://%s/%s
`
return fmt.Sprintf(yamlTemplate,
familyAnchor,
modelName,
@@ -81,7 +94,8 @@ func generateYAMLEntry(model ProcessedModel, familyAnchor string) string {
%s
overrides:
parameters:
model: %s`
model: %s
`
return fmt.Sprintf(yamlTemplate,
familyAnchor,
modelName,