From 5c42a84c3e343b70b74fda5a244498e37f7285db Mon Sep 17 00:00:00 2001 From: zhaoying Date: Tue, 3 Mar 2026 15:09:16 +0800 Subject: [PATCH] fix(web): Implicit detail add check data api --- web/src/api/memory.ts | 9 +++++++-- web/src/i18n/en.ts | 3 ++- web/src/i18n/zh.ts | 3 ++- .../UserMemoryDetail/pages/ImplicitDetail.tsx | 16 ++++++++++++++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/web/src/api/memory.ts b/web/src/api/memory.ts index 987ef358..cb917ec1 100644 --- a/web/src/api/memory.ts +++ b/web/src/api/memory.ts @@ -1,8 +1,8 @@ /* * @Author: ZhaoYing * @Date: 2026-02-03 14:00:06 - * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-02-03 14:00:06 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-03-03 14:58:32 */ import { request } from '@/utils/request' import type { @@ -163,9 +163,14 @@ export const getImplicitInterestAreas = (end_user_id: string) => { export const getImplicitHabits = (end_user_id: string) => { return request.get(`/memory/implicit-memory/habits/${end_user_id}`) } +// Implicit Memory - Generate user portrait export const generateProfile = (end_user_id: string) => { return request.post(`/memory/implicit-memory/generate_profile`, { end_user_id }) } +// Implicit Memory - Check if data exists +export const implicitCheckData = (end_user_id: string) => { + return request.get(`/memory/implicit-memory/check-data/${end_user_id}`) +} // Short-term memory export const getShortTerm = (end_user_id: string) => { return request.get(`/memory/short/short_term`, { end_user_id }) diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index f2b4eaa4..b17ad291 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -2522,7 +2522,8 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re context_details: 'Preference Details', supporting_evidence: 'Preference Source', specific_examples: 'Source', - wordEmpty: 'Click on a node in the left chart to view preference details' + wordEmpty: 'Click on a node in the left chart to view preference details', + noData: 'Portrait data does not exist, please click the refresh button in the top right corner to initialize', }, shortTermDetail: { title: 'Short-term memory is the "workbench" of the AI system, connecting instant conversations with long-term knowledge bases. Through real-time capture, deep retrieval, intelligent extraction and filtering transformation, temporary unstructured information is converted into valuable long-term knowledge.', diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts index e2e7082a..181173ff 100644 --- a/web/src/i18n/zh.ts +++ b/web/src/i18n/zh.ts @@ -2518,7 +2518,8 @@ export const zh = { context_details: '偏好详情', supporting_evidence: '偏好来源', specific_examples: '来源', - wordEmpty: '点击左侧图表中的节点查看偏好详情' + wordEmpty: '点击左侧图表中的节点查看偏好详情', + noData: '画像数据不存在,请点击右上角刷新进行初始化', }, shortTermDetail: { title: '短期记忆是AI系统的"工作台",连接即时对话与长期知识库。通过实时捕获、深度检索、智能提取和筛选转化,将临时的非结构化信息转化为有价值的长期知识。', diff --git a/web/src/views/UserMemoryDetail/pages/ImplicitDetail.tsx b/web/src/views/UserMemoryDetail/pages/ImplicitDetail.tsx index dfe5c1ee..351e5ed1 100644 --- a/web/src/views/UserMemoryDetail/pages/ImplicitDetail.tsx +++ b/web/src/views/UserMemoryDetail/pages/ImplicitDetail.tsx @@ -1,6 +1,6 @@ -import { forwardRef, useImperativeHandle, useRef } from 'react' +import { forwardRef, useImperativeHandle, useRef, useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { Row, Col } from 'antd' +import { Row, Col, App } from 'antd' import { useParams } from 'react-router-dom' import Preferences from '../components/Preferences' @@ -9,15 +9,27 @@ import InterestAreas from '../components/InterestAreas' import Habits from '../components/Habits' import { generateProfile, + implicitCheckData, } from '@/api/memory' const ImplicitDetail = forwardRef<{ handleRefresh: () => void; }>((_props, ref) => { const { t } = useTranslation() const { id } = useParams() + const { message } = App.useApp() const preferencesRef = useRef<{ handleRefresh: () => void; }>(null) const portraitRef = useRef<{ handleRefresh: () => void; }>(null) const interestAreasRef = useRef<{ handleRefresh: () => void; }>(null) const habitsRef = useRef<{ handleRefresh: () => void; }>(null) + + useEffect(() => { + if (!id) return + implicitCheckData(id) + .then(res => { + if (!(res as { exists: boolean }).exists) { + message.warning(t('implicitDetail.noData')) + } + }) + }, [id]) const handleRefresh = () => { if (!id) {