From 0c1cb7b731b5df4babcd0706ce40aa95b4e78f29 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 5 Oct 2025 10:13:11 +0800 Subject: [PATCH] Improve document tooltip display with track ID and better formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Add track ID to tooltip display • Remove JSON braces from metadata • Reorder tooltip content layout • Clean up metadata indentation • Show track ID before metadata --- lightrag_webui/src/features/DocumentManager.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lightrag_webui/src/features/DocumentManager.tsx b/lightrag_webui/src/features/DocumentManager.tsx index a7fe4c86..c5ce516a 100644 --- a/lightrag_webui/src/features/DocumentManager.tsx +++ b/lightrag_webui/src/features/DocumentManager.tsx @@ -77,7 +77,13 @@ const formatMetadata = (metadata: Record): string => { } } - return JSON.stringify(formattedMetadata, null, 2); + // Format JSON and remove outer braces and indentation + const jsonStr = JSON.stringify(formattedMetadata, null, 2); + const lines = jsonStr.split('\n'); + // Remove first line ({) and last line (}), and remove leading indentation (2 spaces) + return lines.slice(1, -1) + .map(line => line.replace(/^ {2}/, '')) + .join('\n'); }; const pulseStyle = ` @@ -1422,14 +1428,17 @@ export default function DocumentManager() { )} {/* Tooltip rendering logic */} - {(doc.error_msg || (doc.metadata && Object.keys(doc.metadata).length > 0)) && ( + {(doc.error_msg || (doc.metadata && Object.keys(doc.metadata).length > 0) || doc.track_id) && (
- {doc.error_msg && ( -
{doc.error_msg}
+ {doc.track_id && ( +
Track ID: {doc.track_id}
)} {doc.metadata && Object.keys(doc.metadata).length > 0 && (
{formatMetadata(doc.metadata)}
)} + {doc.error_msg && ( +
{doc.error_msg}
+ )}
)}