|
@@ -95,6 +95,7 @@ def _serialize_search_candidate(row: VideoDiscoveryCandidate) -> dict[str, Any]:
|
|
|
"temporal_status": row.temporal_status,
|
|
"temporal_status": row.temporal_status,
|
|
|
"gate_status": row.gate_status,
|
|
"gate_status": row.gate_status,
|
|
|
"reject_reason_code": row.reject_reason_code,
|
|
"reject_reason_code": row.reject_reason_code,
|
|
|
|
|
+ "decision_reason": row.decision_reason,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -178,6 +179,9 @@ def _serialize_candidate(row: VideoDiscoveryCandidate) -> dict[str, Any]:
|
|
|
"elder_score": _number(row.elder_score),
|
|
"elder_score": _number(row.elder_score),
|
|
|
"share_score": _number(row.share_score),
|
|
"share_score": _number(row.share_score),
|
|
|
"value_score": _number(row.value_score),
|
|
"value_score": _number(row.value_score),
|
|
|
|
|
+ "detail_fetch_status": row.detail_fetch_status,
|
|
|
|
|
+ "content_portrait_fetch_status": row.content_portrait_fetch_status,
|
|
|
|
|
+ "account_portrait_fetch_status": row.account_portrait_fetch_status,
|
|
|
"decision_reason": row.decision_reason,
|
|
"decision_reason": row.decision_reason,
|
|
|
"decision_bucket": row.decision_bucket,
|
|
"decision_bucket": row.decision_bucket,
|
|
|
"aigc_crawler_plan_id": row.aigc_crawler_plan_id,
|
|
"aigc_crawler_plan_id": row.aigc_crawler_plan_id,
|
|
@@ -235,6 +239,7 @@ def list_video_discovery_runs(
|
|
|
biz_dt: str | None = None,
|
|
biz_dt: str | None = None,
|
|
|
status: str | None = None,
|
|
status: str | None = None,
|
|
|
keyword: str | None = None,
|
|
keyword: str | None = None,
|
|
|
|
|
+ aweme_id: str | None = None,
|
|
|
limit: int = 20,
|
|
limit: int = 20,
|
|
|
offset: int = 0,
|
|
offset: int = 0,
|
|
|
) -> dict[str, Any]:
|
|
) -> dict[str, Any]:
|
|
@@ -257,6 +262,16 @@ def list_video_discovery_runs(
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
|
|
+ normalized_aweme_id = (aweme_id or "").strip()
|
|
|
|
|
+ if normalized_aweme_id:
|
|
|
|
|
+ conditions.append(
|
|
|
|
|
+ select(VideoDiscoveryCandidate.id)
|
|
|
|
|
+ .where(
|
|
|
|
|
+ VideoDiscoveryCandidate.run_id == VideoDiscoveryRun.run_id,
|
|
|
|
|
+ VideoDiscoveryCandidate.aweme_id == normalized_aweme_id,
|
|
|
|
|
+ )
|
|
|
|
|
+ .exists()
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
total_stmt = select(func.count(VideoDiscoveryRun.id))
|
|
total_stmt = select(func.count(VideoDiscoveryRun.id))
|
|
|
rows_stmt = select(VideoDiscoveryRun)
|
|
rows_stmt = select(VideoDiscoveryRun)
|
|
@@ -372,6 +387,7 @@ def list_video_discovery_searches(
|
|
|
VideoDiscoveryCandidate.temporal_status,
|
|
VideoDiscoveryCandidate.temporal_status,
|
|
|
VideoDiscoveryCandidate.gate_status,
|
|
VideoDiscoveryCandidate.gate_status,
|
|
|
VideoDiscoveryCandidate.reject_reason_code,
|
|
VideoDiscoveryCandidate.reject_reason_code,
|
|
|
|
|
+ VideoDiscoveryCandidate.decision_reason,
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
.where(VideoDiscoveryCandidate.search_id.in_(candidates_by_search))
|
|
.where(VideoDiscoveryCandidate.search_id.in_(candidates_by_search))
|
|
@@ -399,6 +415,7 @@ def list_video_discovery_candidates(
|
|
|
*,
|
|
*,
|
|
|
bucket: str | None = None,
|
|
bucket: str | None = None,
|
|
|
keyword: str | None = None,
|
|
keyword: str | None = None,
|
|
|
|
|
+ aweme_id: str | None = None,
|
|
|
limit: int = 20,
|
|
limit: int = 20,
|
|
|
offset: int = 0,
|
|
offset: int = 0,
|
|
|
) -> dict[str, Any] | None:
|
|
) -> dict[str, Any] | None:
|
|
@@ -415,6 +432,9 @@ def list_video_discovery_candidates(
|
|
|
conditions = [VideoDiscoveryCandidate.run_id == run_id]
|
|
conditions = [VideoDiscoveryCandidate.run_id == run_id]
|
|
|
if bucket:
|
|
if bucket:
|
|
|
conditions.append(VideoDiscoveryCandidate.decision_bucket == bucket)
|
|
conditions.append(VideoDiscoveryCandidate.decision_bucket == bucket)
|
|
|
|
|
+ normalized_aweme_id = (aweme_id or "").strip()
|
|
|
|
|
+ if normalized_aweme_id:
|
|
|
|
|
+ conditions.append(VideoDiscoveryCandidate.aweme_id == normalized_aweme_id)
|
|
|
normalized_keyword = (keyword or "").strip().lower()
|
|
normalized_keyword = (keyword or "").strip().lower()
|
|
|
if normalized_keyword:
|
|
if normalized_keyword:
|
|
|
pattern = f"%{normalized_keyword}%"
|
|
pattern = f"%{normalized_keyword}%"
|