This commit is contained in:
@@ -47,14 +47,17 @@ type cachedExpansionValue struct {
|
||||
}
|
||||
|
||||
type AIRecommendation struct {
|
||||
Title string `json:"title"`
|
||||
Link string `json:"link"`
|
||||
Snippet string `json:"snippet"`
|
||||
ThumbnailURL string `json:"thumbnailUrl"`
|
||||
PreviewVideoURL string `json:"previewVideoUrl"`
|
||||
Source string `json:"source"`
|
||||
Reason string `json:"reason"`
|
||||
Recommended bool `json:"recommended"`
|
||||
Title string `json:"title"`
|
||||
Link string `json:"link"`
|
||||
Snippet string `json:"snippet"`
|
||||
ThumbnailURL string `json:"thumbnailUrl"`
|
||||
PreviewVideoURL string `json:"previewVideoUrl"`
|
||||
Source string `json:"source"`
|
||||
Reason string `json:"reason"`
|
||||
Recommended bool `json:"recommended"`
|
||||
MediaMode string `json:"mediaMode,omitempty"`
|
||||
EmbedURL string `json:"embedUrl,omitempty"`
|
||||
PreviewBlockedReason string `json:"previewBlockedReason,omitempty"`
|
||||
}
|
||||
|
||||
type QueryExpansion struct {
|
||||
@@ -480,6 +483,14 @@ func (g *GeminiService) fetchCandidateVisualInlineData(candidate SearchResult) (
|
||||
}
|
||||
}
|
||||
if candidate.ThumbnailURL != "" {
|
||||
if isLowValueThumbnail(candidate.ThumbnailURL) {
|
||||
g.debug("gemini:vision_candidate_rejected_low_value", map[string]any{
|
||||
"link": candidate.Link,
|
||||
"source": candidate.Source,
|
||||
"thumbnailUrl": candidate.ThumbnailURL,
|
||||
})
|
||||
return "", "", fmt.Errorf("candidate thumbnail is low value")
|
||||
}
|
||||
cacheKey := "image\n" + candidate.ThumbnailURL
|
||||
if data, mimeType, ok := g.getCachedVisual(cacheKey); ok {
|
||||
return data, mimeType, nil
|
||||
|
||||
Reference in New Issue
Block a user