feat(web): update document title

This commit is contained in:
zhaoying
2026-04-14 16:38:59 +08:00
parent 9032f50a19
commit 1294aabbcc
10 changed files with 101 additions and 30 deletions

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 17:57:26
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-03-26 18:59:53
* @Last Modified time: 2026-04-14 16:38:21
*/
/**
* Neo4j User Memory Detail View
@@ -22,7 +22,7 @@ import InterestDistribution from './components/InterestDistribution'
import NodeStatistics from './components/NodeStatistics'
import RelationshipNetwork from './components/RelationshipNetwork'
import MemoryInsight from './components/MemoryInsight'
import type { EndUserProfileRef, MemoryInsightRef, AboutMeRef } from './types'
import type { EndUserProfileRef, MemoryInsightRef, AboutMeRef, EndUser } from './types'
import {
analyticsRefresh,
} from '@/api/memory'
@@ -39,8 +39,11 @@ const Neo4j: FC = () => {
const [selectedKey, setSelectedKey] = useState<string | null>(null)
/** Update displayed name */
const handleNameUpdate = (data: { other_name?: string; id: string }) => {
setName(data.other_name && data.other_name !== '' ? data.other_name : data.id)
const handleNameUpdate = (data?: EndUser) => {
if (!data) return
let name = data.other_name && data.other_name !== '' ? data.other_name : data.id || data.end_user_id
setName(name)
document.title = `${name} - ${t('memoryBear')}`;
}
/** Navigate back */
@@ -78,7 +81,7 @@ const Neo4j: FC = () => {
<Flex className="rb:h-full!" gap={12}>
<Flex gap={15} vertical justify="space-between" align="center" className="rb:h-full! rb:px-4! rb:pt-6! rb:pb-5! rb:bg-white rb:w-20 rb:rounded-xl">
<Flex gap={15} vertical>
<Popover
<Popover
content={t('userMemory.memoryWindow', { name: name })}
placement="right"
arrow={false}
@@ -87,7 +90,7 @@ const Neo4j: FC = () => {
<div className="rb:mb-4.25! rb:size-12 rb:rounded-xl rb:bg-cover rb:bg-[url('@/assets/images/userMemory/logo.png')]"></div>
</Popover>
<Flex
<Flex
align="center"
justify="center"
className={clsx("rb:cursor-pointer rb:size-12 rb:rounded-xl rb:group", {
@@ -155,7 +158,7 @@ const Neo4j: FC = () => {
<div className="rb:cursor-pointer rb:size-6 rb:bg-cover rb:bg-[url('@/assets/images/userMemory/logout.svg')]" onClick={goBack}></div>
</Flex>
</Flex>
<Flex vertical className="rb:flex-1">
<NodeStatistics />
<RelationshipNetwork />

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 17:57:11
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-03-31 15:29:45
* @Last Modified time: 2026-04-14 15:56:15
*/
/**
* RAG User Memory Detail View
@@ -97,6 +97,10 @@ const Rag: FC = () => {
}
const name = loading.detail ? '' : data?.name && data?.name !== '' ? data.name : id
useEffect(() => {
document.title = `${name} - ${t('memoryBear')}`;
}, [name])
const [refreshLoading, setRefreshLoading] = useState(false)
const handleRefresh = () => {
if (refreshLoading || !id) return