Improve 3D gallery and debug checkup workflow for image curation.
Add parquet floor, museum-style exit, movement-tinted walls, and gold/black frames with gallery sync after Fix it. Debug panel gets Checked and Fix it buttons; documentation and image-fetch reliability updates included. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
4c6acd5a3a
commit
019ce4e136
@@ -30,6 +30,19 @@ export function galleryImageUrl(painting: {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function galleryImageUrlWithRevision(
|
||||
painting: {
|
||||
id?: number;
|
||||
thumbnail_path?: string | null;
|
||||
image_path?: string | null;
|
||||
},
|
||||
revision?: number
|
||||
): string | null {
|
||||
const base = galleryImageUrl(painting);
|
||||
if (!base || !revision) return base;
|
||||
return `${base}${base.includes('?') ? '&' : '?'}v=${revision}`;
|
||||
}
|
||||
|
||||
export function paintingImageUrl(painting: {
|
||||
id: number;
|
||||
image_path?: string | null;
|
||||
@@ -46,6 +59,13 @@ export async function preloadArtistImages(artistId: number): Promise<{ fetched:
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export interface FixPaintingImageResult {
|
||||
imagePath: string;
|
||||
thumbnailPath: string;
|
||||
fixed?: boolean;
|
||||
checked?: boolean;
|
||||
}
|
||||
|
||||
export interface DebugImageSearchResult {
|
||||
query: string;
|
||||
imageUrl: string | null;
|
||||
@@ -100,17 +120,21 @@ export const api = {
|
||||
getPaintingDebugImageSearch: (id: number) =>
|
||||
fetchJson<DebugImageSearchResult>(`${API}/paintings/${id}/debug-image-search`),
|
||||
|
||||
fixPaintingImage: (id: number, imageUrl: string) =>
|
||||
fixPaintingImage: (
|
||||
id: number,
|
||||
imageUrl: string,
|
||||
context?: { searchUrl?: string; source?: string; pageUrl?: string; thumbUrl?: string }
|
||||
) =>
|
||||
fetch(`${API}/paintings/${id}/fix-image`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ imageUrl }),
|
||||
body: JSON.stringify({ imageUrl, ...context }),
|
||||
}).then(async (res) => {
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({}));
|
||||
throw new Error(body.error || `Fix failed: ${res.status}`);
|
||||
}
|
||||
return res.json() as Promise<{ imagePath: string; thumbnailPath: string; fixed?: boolean; checked?: boolean }>;
|
||||
return res.json() as Promise<FixPaintingImageResult>;
|
||||
}),
|
||||
|
||||
getPaintingCheckup: () => fetchJson<PaintingCheckupData>(`${API}/paintings/checkup`),
|
||||
@@ -132,6 +156,12 @@ export const api = {
|
||||
}),
|
||||
};
|
||||
|
||||
export function debugImageProxyUrl(imageUrl: string): string {
|
||||
return `${API}/debug/image-proxy?url=${encodeURIComponent(imageUrl)}`;
|
||||
export function debugImageProxyUrl(
|
||||
imageUrl: string,
|
||||
context?: { searchUrl?: string; source?: string }
|
||||
): string {
|
||||
const params = new URLSearchParams({ url: imageUrl });
|
||||
if (context?.searchUrl) params.set('searchUrl', context.searchUrl);
|
||||
if (context?.source) params.set('source', context.source);
|
||||
return `${API}/debug/image-proxy?${params.toString()}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user