${category ? escapeHtml(category) : ''}
${vendor ? ' | ' + escapeHtml(vendor) : ''}
@@ -458,16 +458,17 @@ function formatDebugNumber(value, digits = 4) {
}
function renderMetricList(items) {
- const rows = items
+ const lines = items
.filter((item) => item && item.value !== undefined && item.value !== null && item.value !== '')
- .map((item) => `
-
-
${escapeHtml(item.label)}
-
${escapeHtml(String(item.value))}
+ .map(
+ (item) => `
+
+ ${escapeHtml(item.label)}:${escapeHtml(String(item.value))}
- `)
+ `
+ )
.join('');
- return rows ? `
${rows}
` : '';
+ return lines ? `
${lines}
` : '';
}
function renderScorePills(items) {
@@ -495,6 +496,21 @@ function renderJsonDetails(title, payload, open = false) {
`;
}
+/** Multilingual title/brief/vendor from per-result debug; shown under image/price/title on the left. */
+function buildMultilingualFieldsHtml(debug) {
+ if (!debug || typeof debug !== 'object') {
+ return '';
+ }
+ const titlePayload = {};
+ if (debug.title_multilingual) titlePayload.title = debug.title_multilingual;
+ if (debug.brief_multilingual) titlePayload.brief = debug.brief_multilingual;
+ if (debug.vendor_multilingual) titlePayload.vendor = debug.vendor_multilingual;
+ if (Object.keys(titlePayload).length === 0) {
+ return '';
+ }
+ return `
${renderJsonDetails('Multilingual Fields', titlePayload, true)}
`;
+}
+
function buildProductDebugHtml({ debug, result, spuId, tenantId }) {
const resultJson = customStringify(result);
const rawUrl = `${API_BASE_URL}/search/es-doc/${encodeURIComponent(spuId)}?tenant_id=${encodeURIComponent(tenantId)}`;
@@ -527,7 +543,7 @@ function buildProductDebugHtml({ debug, result, spuId, tenantId }) {
{ label: 'rank', value: esStage.rank ?? debug.initial_rank ?? 'N/A' },
{ label: 'es_score', value: formatDebugNumber(esStage.score ?? debug.es_score) },
{ label: 'es_norm', value: formatDebugNumber(esStage.normalized_score ?? debug.es_score_normalized) },
- ], renderJsonDetails('Matched Queries', esStage.matched_queries ?? debug.matched_queries, false))}
+ ], renderJsonDetails('Matched Queries', esStage.matched_queries ?? debug.matched_queries, true))}
${buildStageCard('Coarse Rank', 'Text + vector fusion', [
{ label: 'rank', value: coarseStage.rank ?? 'N/A' },
{ label: 'rank_change', value: coarseStage.rank_change ?? 'N/A' },
@@ -542,7 +558,7 @@ function buildProductDebugHtml({ debug, result, spuId, tenantId }) {
{ label: 'image_knn', value: formatDebugNumber(coarseStage.signals?.image_knn_score ?? debug.image_knn_score) },
{ label: 'text_factor', value: formatDebugNumber(coarseStage.text_factor ?? debug.coarse_text_factor) },
{ label: 'knn_factor', value: formatDebugNumber(coarseStage.knn_factor ?? debug.coarse_knn_factor) },
- ], renderJsonDetails('Coarse Signals', coarseStage.signals, false))}
+ ], renderJsonDetails('Coarse Signals', coarseStage.signals, true))}
${buildStageCard('Fine Rank', 'Lightweight reranker output', [
{ label: 'rank', value: fineStage.rank ?? 'N/A' },
{ label: 'rank_change', value: fineStage.rank_change ?? 'N/A' },
@@ -550,7 +566,7 @@ function buildProductDebugHtml({ debug, result, spuId, tenantId }) {
{ label: 'fine_score', value: formatDebugNumber(fineStage.fine_score ?? debug.fine_score) },
{ label: 'text_score', value: formatDebugNumber(fineStage.text_score ?? debug.text_score) },
{ label: 'knn_score', value: formatDebugNumber(fineStage.knn_score ?? debug.knn_score) },
- ], `${renderJsonDetails('Fine Fusion', fineStage.fusion_summary || debug.fusion_summary || fineStage.fusion_factors, false)}${renderJsonDetails('Fine Input', fineStage.rerank_input ?? debug.rerank_input, false)}`)}
+ ], `${renderJsonDetails('Fine Fusion', fineStage.fusion_summary || debug.fusion_summary || fineStage.fusion_factors, true)}${renderJsonDetails('Fine Input', fineStage.rerank_input ?? debug.rerank_input, true)}`)}
${buildStageCard('Final Rerank', 'Heavy reranker + final fusion', [
{ label: 'rank', value: rerankStage.rank ?? finalPageStage.rank ?? debug.final_rank ?? 'N/A' },
{ label: 'rank_change', value: rerankStage.rank_change ?? finalPageStage.rank_change ?? 'N/A' },
@@ -568,11 +584,6 @@ function buildProductDebugHtml({ debug, result, spuId, tenantId }) {
`;
- const titlePayload = {};
- if (debug.title_multilingual) titlePayload.title = debug.title_multilingual;
- if (debug.brief_multilingual) titlePayload.brief = debug.brief_multilingual;
- if (debug.vendor_multilingual) titlePayload.vendor = debug.vendor_multilingual;
-
return `