fix(knowledge-graph): improve tooltip styling and text wrapping

- Add max-width constraint to node and edge tooltip containers
- Enable word breaking and preserve whitespace formatting for edge descriptions
- Prevent tooltip overflow and improve readability of long description text
This commit is contained in:
yujiangping
2026-01-15 17:33:47 +08:00
parent 925d539174
commit d1f44ef650

View File

@@ -292,7 +292,7 @@ const KnowledgeGraph: FC<KnowledgeGraphProps> = ({ data, loading = false }) => {
if (params.dataType === 'node') {
const node = params.data as KnowledgeNode
return `
<div>
<div class="rb:max-w-[560px]">
<div><strong>${node.entity_name}</strong></div>
<div>类型: ${node.entity_type}</div>
<div>重要度: ${(node.pagerank * 100).toFixed(2)}%</div>
@@ -301,10 +301,10 @@ const KnowledgeGraph: FC<KnowledgeGraphProps> = ({ data, loading = false }) => {
} else if (params.dataType === 'edge') {
const edge = params.data as KnowledgeEdge
return `
<div>
<div class="rb:max-w-[560px]">
<div><strong>关系</strong></div>
<div>权重: ${edge.weight}</div>
<div>${edge.description}</div>
<div class="rb:break-words rb:whitespace-pre-wrap">${edge.description}</div>
</div>
`
}