refactor(scene-fusion): always run agent subject detection for prompt enrichment
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-03-05 21:23:01 +08:00
parent cd451c8f9a
commit d2070d93e1

View File

@ -289,19 +289,21 @@ async function enrichSceneLabelsWithAgent(params: {
})),
};
if (!resolvedProductName) {
try {
const productDetected = await detectProductNameWithAgent(params.productImageUrl);
if (productDetected?.name) {
try {
const productDetected = await detectProductNameWithAgent(params.productImageUrl);
if (productDetected?.name) {
if (!resolvedProductName) {
resolvedProductName = productDetected.name;
meta.productName = productDetected.name;
meta.productSource = "agent";
meta.productConfidence = productDetected.confidence;
meta.productModel = productDetected.model;
} else {
meta.productSource = "user";
}
} catch (error) {
console.warn(`[SceneFusion][${params.requestId}] Product detect skipped:`, error);
meta.productName = resolvedProductName || productDetected.name;
meta.productConfidence = productDetected.confidence;
meta.productModel = productDetected.model;
}
} catch (error) {
console.warn(`[SceneFusion][${params.requestId}] Product detect skipped:`, error);
}
const unresolvedIndexes = clonedScenes