fix(web): document title support i18n

This commit is contained in:
zhaoying
2026-04-14 17:03:22 +08:00
parent 1294aabbcc
commit 5e6490213d
11 changed files with 60 additions and 17 deletions

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 17:57:26
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-04-14 16:38:21
* @Last Modified time: 2026-04-14 16:57:59
*/
/**
* Neo4j User Memory Detail View
@@ -10,7 +10,7 @@
* Shows profile, interests, node statistics, relationships, and insights
*/
import { type FC, useRef, useState, type MouseEvent } from 'react'
import { type FC, useRef, useState, type MouseEvent, useEffect } from 'react'
import clsx from 'clsx'
import { useParams, useNavigate } from 'react-router-dom'
import { Flex, Popover } from 'antd'
@@ -26,6 +26,7 @@ import type { EndUserProfileRef, MemoryInsightRef, AboutMeRef, EndUser } from '.
import {
analyticsRefresh,
} from '@/api/memory'
import { useI18n } from '@/store/locale'
const Neo4j: FC = () => {
const { id } = useParams()
@@ -33,6 +34,7 @@ const Neo4j: FC = () => {
const navigate = useNavigate();
const [loading, setLoading] = useState(false)
const [name, setName] = useState('')
const { language } = useI18n()
const ref = useRef<EndUserProfileRef>(null)
const memoryInsightRef = useRef<MemoryInsightRef>(null)
const aboutMeRef = useRef<AboutMeRef>(null)
@@ -43,8 +45,10 @@ const Neo4j: FC = () => {
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')}`;
}
useEffect(() => {
document.title = `${name} - ${t('memoryBear')}`;
}, [name, language])
/** Navigate back */
const goBack = () => {

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 17:57:11
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-04-14 15:56:15
* @Last Modified time: 2026-04-14 16:56:36
*/
/**
* RAG User Memory Detail View
@@ -26,6 +26,7 @@ import {
} from '@/api/memory'
import Empty from '@/components/Empty'
import ConversationMemory from './components/ConversationMemory'
import { useI18n } from '@/store/locale'
/**
* Title component props
@@ -45,6 +46,7 @@ const Title: FC<TitleProps> = ({ title, iconClassName }) => (
const Rag: FC = () => {
const { t } = useTranslation()
const { id } = useParams()
const { language } = useI18n()
const [data, setData] = useState<Data | null>(null)
const [summary, setSummary] = useState<string | null>('')
const [loading, setLoading] = useState<Record<string, boolean>>({
@@ -99,7 +101,7 @@ const Rag: FC = () => {
useEffect(() => {
document.title = `${name} - ${t('memoryBear')}`;
}, [name])
}, [name, language])
const [refreshLoading, setRefreshLoading] = useState(false)
const handleRefresh = () => {