Skip to content
Merged
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
17 changes: 13 additions & 4 deletions lightrag_webui/src/features/DocumentManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ const formatMetadata = (metadata: Record<string, any>): 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 = `
Expand Down Expand Up @@ -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) && (
<div className="invisible group-hover:visible tooltip">
{doc.error_msg && (
<pre>{doc.error_msg}</pre>
{doc.track_id && (
<div className="mt-1">Track ID: {doc.track_id}</div>
)}
{doc.metadata && Object.keys(doc.metadata).length > 0 && (
<pre>{formatMetadata(doc.metadata)}</pre>
)}
{doc.error_msg && (
<pre>{doc.error_msg}</pre>
)}
</div>
)}
</div>
Expand Down