This commit is contained in:
+18
-1
@@ -267,7 +267,7 @@ func (a *App) searchMedia(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enabledPlatforms := normalizePlatforms(req.Platforms)
|
enabledPlatforms := normalizePlatforms(req.Platforms)
|
||||||
a.Hub.Broadcast("progress", gin.H{"type": "search", "status": "searching Google Video, Envato, and Artgrid", "progress": 35})
|
a.Hub.Broadcast("progress", gin.H{"type": "search", "status": "searching " + selectedPlatformLabel(enabledPlatforms), "progress": 35})
|
||||||
results, err := a.SearchService.SearchMedia(queryVariants, enabledPlatforms)
|
results, err := a.SearchService.SearchMedia(queryVariants, enabledPlatforms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.Hub.Broadcast("progress", gin.H{"type": "search", "status": "search failed", "progress": 100, "message": err.Error()})
|
a.Hub.Broadcast("progress", gin.H{"type": "search", "status": "search failed", "progress": 100, "message": err.Error()})
|
||||||
@@ -372,6 +372,23 @@ func normalizePlatforms(platforms []string) map[string]bool {
|
|||||||
return normalized
|
return normalized
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func selectedPlatformLabel(platforms map[string]bool) string {
|
||||||
|
labels := make([]string, 0, len(platforms))
|
||||||
|
if platforms["envato"] {
|
||||||
|
labels = append(labels, "Envato")
|
||||||
|
}
|
||||||
|
if platforms["artgrid"] {
|
||||||
|
labels = append(labels, "Artgrid")
|
||||||
|
}
|
||||||
|
if platforms["google video"] {
|
||||||
|
labels = append(labels, "Google Video")
|
||||||
|
}
|
||||||
|
if len(labels) == 0 {
|
||||||
|
return "selected platforms"
|
||||||
|
}
|
||||||
|
return strings.Join(labels, ", ")
|
||||||
|
}
|
||||||
|
|
||||||
func evaluateAllCandidatesWithGemini(service *services.GeminiService, query string, ranked []services.SearchResult) []services.AIRecommendation {
|
func evaluateAllCandidatesWithGemini(service *services.GeminiService, query string, ranked []services.SearchResult) []services.AIRecommendation {
|
||||||
const chunkSize = 8
|
const chunkSize = 8
|
||||||
merged := make([]services.AIRecommendation, 0, len(ranked))
|
merged := make([]services.AIRecommendation, 0, len(ranked))
|
||||||
|
|||||||
Reference in New Issue
Block a user