diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index 2e2a24c8..bf0d89c0 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -1090,7 +1090,11 @@ export const en = { memoryContent: 'Memory Content', created_at: 'Created At', - memoryWindow: "{{name}}'s Window of Memory" + memoryWindow: "{{name}}'s Window of Memory", + memory_insight: 'Overall Overview', + key_findings: 'Key Findings', + behavior_pattern: 'Behavior Pattern', + growth_trajectory: 'Growth Trajectory', }, space: { createSpace: 'Create Space', diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts index f52d7328..6784ed97 100644 --- a/web/src/i18n/zh.ts +++ b/web/src/i18n/zh.ts @@ -1172,7 +1172,11 @@ export const zh = { updated_at: '最后更新时间', fullScreen: '全屏', - memoryWindow: "{{name}}的记忆之窗" + memoryWindow: "{{name}}的记忆之窗", + memory_insight: '总体概述', + key_findings: '关键发现', + behavior_pattern: '行为模式', + growth_trajectory: '成长轨迹', }, space: { createSpace: '创建空间', @@ -1657,6 +1661,8 @@ export const zh = { 'question-classifier': '问题分类器', iteration: '迭代 (Iteration)', loop: '循环 (Loop)', + 'cycle-start': '', + 'cycle-end': '退出循环', parallel: '并行执行', 'var-aggregator': '变量聚合器', externalInteraction: '外部交互', @@ -1802,9 +1808,14 @@ export const zh = { class_name: '分类', addClassName: '添加分类' }, + loop: { + cycle_vars: '循环变量', + condition: '循环终止条件', + }, name: '键', type: '类型', value: '值', + addCase: '添加条件', }, clear: '清空', diff --git a/web/src/views/UserMemoryDetail/components/MemoryInsight.tsx b/web/src/views/UserMemoryDetail/components/MemoryInsight.tsx index 0c0751f3..608ad01d 100644 --- a/web/src/views/UserMemoryDetail/components/MemoryInsight.tsx +++ b/web/src/views/UserMemoryDetail/components/MemoryInsight.tsx @@ -1,7 +1,8 @@ -import { type FC, useEffect, useState, forwardRef, useImperativeHandle } from 'react' +import { useEffect, useState, forwardRef, useImperativeHandle } from 'react' +import clsx from 'clsx' import { useTranslation } from 'react-i18next' import { useParams } from 'react-router-dom' -import { Skeleton } from 'antd'; +import { Skeleton, Space } from 'antd'; import RbCard from '@/components/RbCard/Card' import Empty from '@/components/Empty'; import { @@ -9,11 +10,20 @@ import { } from '@/api/memory' import type { MemoryInsightRef } from '../types' +interface Data { + memory_insight?: string; + behavior_pattern?: string; + key_findings?: string[]; + growth_trajectory?: string; + updated_at?: number; + is_cached: boolean; +} + const MemoryInsight = forwardRef((_props, ref) => { const { t } = useTranslation() const { id } = useParams() const [loading, setLoading] = useState(false) - const [report, setReport] = useState(null) + const [data, setData] = useState({} as Data) useEffect(() => { if (!id) return @@ -25,7 +35,7 @@ const MemoryInsight = forwardRef((_props, ref) => { if (!id) return setLoading(true) getMemoryInsightReport(id).then((res) => { - setReport((res as { report?: string }).report || null) + setData((res as Data) || {}) setLoading(false) }) .finally(() => { @@ -43,10 +53,35 @@ const MemoryInsight = forwardRef((_props, ref) => { > {loading ? - : report - ?
- {report || '-'} -
+ : Object.keys(data).length > 0 + ? + {['memory_insight', 'key_findings', 'behavior_pattern', 'growth_trajectory'].map(key => { + if (data[key as keyof Data]) { + return ( +
+
{t(`userMemory.${key}`)}
+
+ {Array.isArray(data[key as keyof Data]) + ? <> + {(data[key as keyof Data] as string[])?.map((item: string, index: number) => ( +
+ - {item} +
+ ))} + + : data[key as keyof Data] as string + } +
+
+ ) + } + return null + })} + +
: }