Expand search breadth and modal action metadata
build-push / docker (push) Has been cancelled

This commit is contained in:
AI Assistant
2026-03-16 17:07:53 +09:00
parent 794aec1496
commit 19425c9503
8 changed files with 60 additions and 28 deletions
+21 -12
View File
@@ -88,7 +88,7 @@ func (s *SearchService) SearchMediaWithDeadline(queries []string, enabledPlatfor
results := make([]SearchResult, 0, 90)
var lastErr error
baseQueries := limitQueries(queries, 6)
baseQueries := limitQueries(queries, 8)
shuffleStrings(baseQueries)
primaryQueries := baseQueries[:minInt(len(baseQueries), 3)]
runSearchPass := func(bases []string, onlyMissing bool) {
@@ -190,7 +190,7 @@ func (s *SearchService) EnrichResults(results []SearchResult) []SearchResult {
}
func (s *SearchService) EnrichResultsWithDeadline(results []SearchResult, deadline time.Time) []SearchResult {
limit := minInt(len(results), 14)
limit := minInt(len(results), 18)
if limit == 0 {
return results
}
@@ -722,13 +722,10 @@ func defaultMediaMode(source, link, previewURL, thumbnailURL string) (string, st
embedURL := buildEmbedURL(source, link)
switch source {
case "Google Video":
if embedURL != "" {
return "embed", embedURL, ""
}
if hasUsableThumbnail(thumbnailURL) {
return "thumbnail", "", "missing_google_embed"
return "thumbnail", embedURL, "webpage_like_preview_preferred"
}
return "none", "", "missing_google_embed"
return "none", embedURL, "webpage_like_preview_preferred"
case "Envato":
if strings.TrimSpace(previewURL) != "" {
return "preview_video", embedURL, "provider_embed_blocked"
@@ -741,12 +738,12 @@ func defaultMediaMode(source, link, previewURL, thumbnailURL string) (string, st
}
return "none", "", "provider_embed_blocked"
case "Artgrid":
if hasUsableThumbnail(thumbnailURL) {
return "thumbnail", embedURL, "provider_preview_unavailable"
}
if strings.TrimSpace(previewURL) != "" {
return "preview_video", embedURL, "provider_preview_unavailable"
}
if hasUsableThumbnail(thumbnailURL) {
return "thumbnail", embedURL, "provider_preview_unavailable"
}
if embedURL != "" {
return "embed", embedURL, ""
}
@@ -774,6 +771,18 @@ func DecorateRecommendationMedia(item AIRecommendation) AIRecommendation {
if item.MediaMode == "thumbnail" && !hasUsableThumbnail(item.ThumbnailURL) && strings.TrimSpace(item.PreviewVideoURL) != "" {
item.MediaMode = "preview_video"
}
switch item.Source {
case "Google Video":
item.ActionType = "download"
item.ActionLabel = "Direct Download"
item.SecondaryActionLabel = "Open Source"
case "Envato", "Artgrid":
item.ActionType = "open_source"
item.ActionLabel = "Open Source"
default:
item.ActionType = "open_source"
item.ActionLabel = "Open Source"
}
return item
}
@@ -1380,9 +1389,9 @@ func limitCollectorQueries(collector string, queries []string, onlyMissing bool)
limit := 2
switch collector {
case "Envato", "Artgrid":
limit = 3
limit = 4
case "Google Video":
limit = 2
limit = 3
}
if onlyMissing {
limit--