fix monitoring manual mark attribution
Frontend CI / Frontend (push) Successful in 2m56s
Backend CI / Backend (push) Successful in 14m47s

This commit is contained in:
2026-06-25 09:31:18 +08:00
parent bdfe79c921
commit cbbec8da85
10 changed files with 436 additions and 66 deletions
@@ -3454,18 +3454,15 @@ func (s *MonitoringService) loadCitationRanking(
fr.ai_platform_id,
COUNT(cf.id)::bigint AS citation_source_count,
COUNT(cf.id) FILTER (
WHERE fr.ai_platform_id <> 'qwen'
AND cf.content_source_type IS NOT NULL
WHERE cf.content_source_type IS NOT NULL
AND cf.content_source_id IS NOT NULL
)::bigint AS saas_source_count,
COUNT(DISTINCT cf.run_id) FILTER (
WHERE fr.ai_platform_id <> 'qwen'
AND cf.content_source_type IS NOT NULL
WHERE cf.content_source_type IS NOT NULL
AND cf.content_source_id IS NOT NULL
)::bigint AS cited_answer_count,
COUNT(DISTINCT cf.content_source_type || ':' || cf.content_source_id::text) FILTER (
WHERE fr.ai_platform_id <> 'qwen'
AND cf.content_source_type IS NOT NULL
WHERE cf.content_source_type IS NOT NULL
AND cf.content_source_id IS NOT NULL
)::bigint AS cited_article_count
FROM filtered_runs fr
@@ -3658,7 +3655,6 @@ func (s *MonitoringService) loadCitedArticleSourceRows(
AND r.id = cf.run_id
WHERE cf.tenant_id = $1
AND ($2::bigint = 0 OR cf.brand_id = $2)
AND cf.ai_platform_id <> 'qwen'
AND cf.business_date BETWEEN $4::date AND $5::date
AND cf.content_source_type IS NOT NULL
AND cf.content_source_id IS NOT NULL
@@ -4278,7 +4274,7 @@ func (s *MonitoringService) loadQuestionCitationAnalysis(ctx context.Context, te
}
}
item.CitationCount++
if platformID != "qwen" && sourceType.Valid && strings.TrimSpace(sourceType.String) != "" && sourceID.Valid {
if sourceType.Valid && strings.TrimSpace(sourceType.String) != "" && sourceID.Valid {
item.ContentCitationCount++
}
aggregates[key] = item
@@ -4324,7 +4320,6 @@ func (s *MonitoringService) loadQuestionContentCitations(ctx context.Context, te
ON cf.tenant_id = r.tenant_id AND cf.run_id = r.id
WHERE r.tenant_id = $1
AND r.status = 'succeeded'
AND r.ai_platform_id <> 'qwen'
AND r.id = ANY($2)
`, tenantID, runIDs)
if err != nil {