diff --git a/.github/gallery-agent/agent.go b/.github/gallery-agent/agent.go
index 687b5a1eb..a1a481c07 100644
--- a/.github/gallery-agent/agent.go
+++ b/.github/gallery-agent/agent.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
+ "regexp"
"slices"
"strings"
@@ -45,7 +46,7 @@ func cleanTextContent(text string) string {
}
// Remove trailing empty lines from the result
result := strings.Join(cleanedLines, "\n")
- return strings.TrimRight(result, "\n")
+ return stripThinkingTags(strings.TrimRight(result, "\n"))
}
// isModelExisting checks if a specific model ID exists in the gallery using text search
@@ -92,6 +93,16 @@ func getGalleryIndexPath() string {
return "gallery/index.yaml"
}
+func stripThinkingTags(content string) string {
+ // Remove content between and (including multi-line)
+ content = regexp.MustCompile(`(?s).*?`).ReplaceAllString(content, "")
+ // Remove content between and (including multi-line)
+ content = regexp.MustCompile(`(?s).*?`).ReplaceAllString(content, "")
+ // Clean up any extra whitespace
+ content = strings.TrimSpace(content)
+ return content
+}
+
func getRealReadme(ctx context.Context, repository string) (string, error) {
// Create a conversation fragment
fragment := cogito.NewEmptyFragment().