From 34dde34e610354743839e2b21180869edcecb444 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Wed, 24 Dec 2025 15:45:11 +0800 Subject: [PATCH] fix(web): user memory detail --- web/src/views/SelfReflectionEngine/index.tsx | 7 ++--- .../components/EndUserProfile.tsx | 2 +- .../components/EndUserProfileModal.tsx | 2 +- .../components/RelationshipNetwork.tsx | 31 ++++++++++++------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/web/src/views/SelfReflectionEngine/index.tsx b/web/src/views/SelfReflectionEngine/index.tsx index 2c0eea86..12196163 100644 --- a/web/src/views/SelfReflectionEngine/index.tsx +++ b/web/src/views/SelfReflectionEngine/index.tsx @@ -140,15 +140,12 @@ const SelfReflectionEngine: React.FC = () => { .then((res) => { setResult(res as Result) }) - .catch(() => { - setRunLoading(false) - }) .finally(() => { setRunLoading(false) }) }) - .finally(() => { - setLoading(false) + .catch(() => { + setRunLoading(false) }) } diff --git a/web/src/views/UserMemoryDetail/components/EndUserProfile.tsx b/web/src/views/UserMemoryDetail/components/EndUserProfile.tsx index 95d40d42..8138231a 100644 --- a/web/src/views/UserMemoryDetail/components/EndUserProfile.tsx +++ b/web/src/views/UserMemoryDetail/components/EndUserProfile.tsx @@ -40,7 +40,7 @@ const EndUserProfile:FC = () => { return ['name', 'position', 'department', 'contact', 'phone', 'hire_date'].map(key => ({ key, label: t(`userMemory.${key}`), - children: key === 'hire_date' ? dayjs(data[key as keyof EndUser]).format('YYYY-MM-DD') : String(data[key as keyof EndUser] || ''), + children: key === 'hire_date' && data[key] ? dayjs(data[key as keyof EndUser]).format('YYYY-MM-DD') : String(data[key as keyof EndUser] || ''), })) }, [data]) const handleEdit = () => { diff --git a/web/src/views/UserMemoryDetail/components/EndUserProfileModal.tsx b/web/src/views/UserMemoryDetail/components/EndUserProfileModal.tsx index 947cf3c4..37bca368 100644 --- a/web/src/views/UserMemoryDetail/components/EndUserProfileModal.tsx +++ b/web/src/views/UserMemoryDetail/components/EndUserProfileModal.tsx @@ -35,7 +35,7 @@ const EndUserProfileModal = forwardRef { const { t } = useTranslation() const { id } = useParams() @@ -30,7 +31,7 @@ const RelationshipNetwork:FC = () => { const [categories, setCategories] = useState<{ name: string }[]>([]) const [selectedNode, setSelectedNode] = useState(null) - + console.log('categories', categories) // 关系网络 const getEdgeData = useCallback(() => { if (!id) return @@ -39,7 +40,7 @@ const RelationshipNetwork:FC = () => { const { nodes, edges, statistics } = res as GraphData const curNodes: Node[] = [] const curEdges: Edge[] = [] - const curNodeTypes = Object.keys(statistics.node_types) + const curNodeTypes = Object.keys(statistics.node_types).filter(vo => vo !== 'Dialogue') // 计算每个节点的连接数 const connectionCount: Record = {} @@ -49,22 +50,22 @@ const RelationshipNetwork:FC = () => { }) // 处理节点数据 - nodes.forEach(node => { + nodes.filter(vo => vo.label !== 'Dialogue').forEach(node => { const connections = connectionCount[node.id] || 0 const categoryIndex = curNodeTypes.indexOf(node.label) // 根据节点类型获取显示名称 let displayName = '' switch (node.label) { - case 'Statement': - displayName = 'statement' in node.properties ? node.properties.statement?.slice(0, 5) || '' : '' - break + // case 'Statement': + // displayName = 'statement' in node.properties ? node.properties.statement?.slice(0, 5) || '' : '' + // break case 'ExtractedEntity': displayName = 'name' in node.properties ? node.properties.name || '' : '' break - default: - displayName = 'content' in node.properties ? node.properties.content?.slice(0, 5) || '' : '' - break + // default: + // displayName = 'content' in node.properties ? node.properties.content?.slice(0, 5) || '' : '' + // break } let symbolSize = 0 if (connections <= 1) { @@ -85,7 +86,7 @@ const RelationshipNetwork:FC = () => { category: categoryIndex >= 0 ? categoryIndex : 0, symbolSize: symbolSize, // 根据连接数调整节点大小 itemStyle: { - color: ['#155EEF', '#4DA8FF', '#9C6FFF', '#8BAEF7', '#369F21', '#FF5D34', '#FF8A4C', '#FFB048'][categoryIndex % 8] + color: colors[categoryIndex % 8] } }) }) @@ -150,17 +151,23 @@ const RelationshipNetwork:FC = () => { ) : ( ({ + name: t(`userMemory.${vo.name}`) + })) || [], roam: true, label: { show: true,