Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/ai-server/src/services/raw_posts/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ async def insert_vision_filter_log(
platform: str,
external_id: str,
source_identifier: Optional[str],
image_url: Optional[str],
verdict: str,
confidence: Optional[float],
reason: Optional[str],
Expand All @@ -1097,8 +1098,8 @@ async def insert_vision_filter_log(
"""
INSERT INTO public.vision_filter_log
(platform, external_id, source_identifier, verdict,
confidence, reason, model)
VALUES ($1, $2, $3, $4, $5, $6, $7)
confidence, reason, model, image_url)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
""",
platform,
external_id,
Expand All @@ -1107,6 +1108,7 @@ async def insert_vision_filter_log(
confidence,
(reason or None),
model,
image_url,
)

# ---- #368 cycle running indicator -----------------------------------
Expand Down
1 change: 1 addition & 0 deletions packages/ai-server/src/services/raw_posts/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ async def _vision_filter_cycle(self) -> None:
platform=row.platform,
external_id=row.external_id,
source_identifier=row.external_id, # pin 일 경우 동일
image_url=row.image_url,
verdict=verdict,
confidence=judgment.confidence,
reason=judgment.reason,
Expand Down
1 change: 1 addition & 0 deletions packages/api-server/src/domains/raw_posts/dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ pub struct VisionFilterLogEntry {
pub platform: String,
pub external_id: String,
pub source_identifier: Option<String>,
pub image_url: Option<String>,
pub verdict: String,
pub confidence: Option<f64>,
pub reason: Option<String>,
Expand Down
7 changes: 5 additions & 2 deletions packages/api-server/src/domains/raw_posts/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ pub async fn list_vision_filter_log(
Statement::from_sql_and_values(
sea_orm::DatabaseBackend::Postgres,
"SELECT id, platform, external_id, source_identifier, verdict, \
confidence, reason, model, judged_at \
image_url, confidence, reason, model, judged_at \
FROM public.vision_filter_log \
WHERE verdict = $1 \
ORDER BY judged_at DESC \
Expand All @@ -1068,7 +1068,7 @@ pub async fn list_vision_filter_log(
Statement::from_sql_and_values(
sea_orm::DatabaseBackend::Postgres,
"SELECT id, platform, external_id, source_identifier, verdict, \
confidence, reason, model, judged_at \
image_url, confidence, reason, model, judged_at \
FROM public.vision_filter_log \
ORDER BY judged_at DESC \
LIMIT $1",
Expand All @@ -1090,6 +1090,9 @@ pub async fn list_vision_filter_log(
source_identifier: row
.try_get("", "source_identifier")
.map_err(AppError::DatabaseError)?,
image_url: row
.try_get("", "image_url")
.map_err(AppError::DatabaseError)?,
verdict: row
.try_get("", "verdict")
.map_err(AppError::DatabaseError)?,
Expand Down
1 change: 1 addition & 0 deletions packages/web/lib/api/admin/raw-post-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export interface VisionFilterLogEntry {
platform: string;
external_id: string;
source_identifier: string | null;
image_url: string | null;
verdict: "pass" | "skip";
confidence: number | null;
reason: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function postUrl(platform: string, externalId: string): string | null {
}

function previewSrc(entry: VisionFilterLogEntry): string | null {
if (entry.platform === "instagram" && entry.image_url) {
return entry.image_url;
}
if (entry.platform === "pinterest" && /^\d+$/.test(entry.external_id)) {
return `/api/admin/raw-post-sources/preview?platform=pinterest&pin=${encodeURIComponent(
entry.external_id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Preserve the judged image URL for vision filter audit cards (#368).
--
-- Instagram skip decisions may delete the raw_post row while the audit row stays.
-- Store the image URL at judgment time so admin thumbnails do not depend on
-- re-scraping Instagram OG metadata after deletion.

ALTER TABLE public.vision_filter_log
ADD COLUMN IF NOT EXISTS image_url text;

COMMENT ON COLUMN public.vision_filter_log.image_url IS
'Image URL used at judgment time. Preserves audit thumbnails after raw_post deletion.';
Loading