Merge branch 'develop' of github.com:SuanmoSuanyangTechnology/MemoryBear into develop

This commit is contained in:
Mark
2026-01-26 14:26:40 +08:00
5 changed files with 36 additions and 634 deletions

View File

@@ -116,20 +116,20 @@ export const getRagContent = (end_user_id: string) => {
return request.get(`/dashboard/rag_content`, { end_user_id, limit: 20 })
}
// Emotion distribution analysis
export const getWordCloud = (group_id: string) => {
return request.post(`/memory/emotion-memory/wordcloud`, { group_id, limit: 20 })
export const getWordCloud = (end_user_id: string) => {
return request.post(`/memory/emotion-memory/wordcloud`, { end_user_id, limit: 20 })
}
// High-frequency emotion keywords
export const getEmotionTags = (group_id: string) => {
return request.post(`/memory/emotion-memory/tags`, { group_id, limit: 20 })
export const getEmotionTags = (end_user_id: string) => {
return request.post(`/memory/emotion-memory/tags`, { end_user_id, limit: 20 })
}
// Emotion health index
export const getEmotionHealth = (group_id: string) => {
return request.post(`/memory/emotion-memory/health`, { group_id, limit: 20 })
export const getEmotionHealth = (end_user_id: string) => {
return request.post(`/memory/emotion-memory/health`, { end_user_id })
}
// Personalized suggestions
export const getEmotionSuggestions = (group_id: string) => {
return request.post(`/memory/emotion-memory/suggestions`, { group_id, limit: 20 })
export const getEmotionSuggestions = (end_user_id: string) => {
return request.post(`/memory/emotion-memory/suggestions`, { end_user_id })
}
export const generateSuggestions = (end_user_id: string) => {
return request.post(`/memory/emotion-memory/generate_suggestions`, { end_user_id })
@@ -138,8 +138,8 @@ export const analyticsRefresh = (end_user_id: string) => {
return request.post('/memory-storage/analytics/generate_cache', { end_user_id })
}
// Forgetting stats
export const getForgetStats = (group_id: string) => {
return request.get(`/memory/forget-memory/stats`, { group_id })
export const getForgetStats = (end_user_id: string) => {
return request.get(`/memory/forget-memory/stats`, { end_user_id })
}
// Implicit Memory - Preferences
export const getImplicitPreferences = (end_user_id: string) => {
@@ -165,20 +165,20 @@ export const getShortTerm = (end_user_id: string) => {
return request.get(`/memory/short/short_term`, { end_user_id })
}
// Perceptual Memory - Visual memory
export const getPerceptualLastVisual = (end_user: string) => {
return request.get(`/memory/perceptual/${end_user}/last_visual`)
export const getPerceptualLastVisual = (end_user_id: string) => {
return request.get(`/memory/perceptual/${end_user_id}/last_visual`)
}
// Perceptual Memory - Audio memory
export const getPerceptualLastListen = (end_user: string) => {
return request.get(`/memory/perceptual/${end_user}/last_listen`)
export const getPerceptualLastListen = (end_user_id: string) => {
return request.get(`/memory/perceptual/${end_user_id}/last_listen`)
}
// Perceptual Memory - Text memory
export const getPerceptualLastText = (end_user: string) => {
return request.get(`/memory/perceptual/${end_user}/last_text`)
export const getPerceptualLastText = (end_user_id: string) => {
return request.get(`/memory/perceptual/${end_user_id}/last_text`)
}
// Perceptual Memory - Perceptual memory timeline
export const getPerceptualTimeline = (end_user: string) => {
return request.get(`/memory/perceptual/${end_user}/timeline`)
export const getPerceptualTimeline = (end_user_id: string) => {
return request.get(`/memory/perceptual/${end_user_id}/timeline`)
}
// Episodic Memory - Overview
export const getEpisodicOverview = (data: { end_user_id: string; time_range: string; episodic_type: string; } ) => {
@@ -201,14 +201,14 @@ export const getExplicitMemory = (end_user_id: string) => {
export const getExplicitMemoryDetails = (data: { end_user_id: string, memory_id: string; }) => {
return request.post(`/memory/explicit-memory/details`, data)
}
export const getConversations = (end_user: string) => {
return request.get(`/memory/work/${end_user}/conversations`)
export const getConversations = (end_user_id: string) => {
return request.get(`/memory/work/${end_user_id}/conversations`)
}
export const getConversationMessages = (end_user: string, conversation_id: string) => {
return request.get(`/memory/work/${end_user}/messages`, { conversation_id })
export const getConversationMessages = (end_user_id: string, conversation_id: string) => {
return request.get(`/memory/work/${end_user_id}/messages`, { conversation_id })
}
export const getConversationDetail = (end_user: string, conversation_id: string) => {
return request.get(`/memory/work/${end_user}/detail`, { conversation_id })
export const getConversationDetail = (end_user_id: string, conversation_id: string) => {
return request.get(`/memory/work/${end_user_id}/detail`, { conversation_id })
}
export const forgetTrigger = (data: { max_merge_batch_size: number; min_days_since_access: number; end_user_id: string;}) => {
return request.post(`/memory/forget-memory/trigger`, data)

View File

@@ -45,7 +45,7 @@ const searchSwitchList = [
]
export interface TestParams {
group_id: string;
end_user_id: string;
message: string;
search_switch: string;
history: { role: string; content: string }[];
@@ -107,7 +107,7 @@ const MemoryConversation: FC = () => {
setLoading(true)
readService({
message: msg,
group_id: userId,
end_user_id: userId,
search_switch: search_switch,
history: [],
})
@@ -204,7 +204,7 @@ const MemoryConversation: FC = () => {
}
)}
>
<div className="rb:text-[16px] rb:font-medium rb:leading-[22px] rb:mb-6">{log.title}</div>
<div className="rb:text-[16px] rb:font-medium rb:leading-5.5 rb:mb-6">{log.title}</div>
{log.type === 'problem_split' && Array.isArray(log.data) && log.data.length > 0
? <Space size={12} direction="vertical" style={{width: '100%'}}>
{log.data.map(vo => (

View File

@@ -1093,606 +1093,4 @@ export const groupDataByType = (data: any[], groupKey: string) => {
})
return grouped
}
export const mockTestResult = {
"generated_at": "2025-12-12T09:48:43.389893",
"entities": {
"extracted_count": 148
},
"dedup": {
"total_merged_count": 39,
"breakdown": {
"exact": 30,
"fuzzy": 0,
"llm": 9
},
"impact": [
{
"name": "记忆熊",
"type": "Person",
"appear_count": 9,
"merge_count": 8
},
{
"name": "宋朝",
"type": "Organization",
"appear_count": 5,
"merge_count": 2
},
{
"name": "军费",
"type": "EconomicMetric",
"appear_count": 2,
"merge_count": 1
},
{
"name": "学生",
"type": "Person",
"appear_count": 6,
"merge_count": 5
},
{
"name": "废除丞相制度",
"type": "Event",
"appear_count": 6,
"merge_count": 3
},
{
"name": "六部",
"type": "Organization",
"appear_count": 4,
"merge_count": 3
},
{
"name": "六部缺乏协调机制",
"type": "Concept",
"appear_count": 2,
"merge_count": 1
},
{
"name": "丞相",
"type": "Position",
"appear_count": 4,
"merge_count": 1
},
{
"name": "总理",
"type": "Position",
"appear_count": 2,
"merge_count": 1
},
{
"name": "各部委",
"type": "Organization",
"appear_count": 2,
"merge_count": 1
},
{
"name": "六部直接对皇帝负责",
"type": "AdministrativeStructure",
"appear_count": 2,
"merge_count": 1
},
{
"name": "秦国",
"type": "Organization",
"appear_count": 5,
"merge_count": 2
},
{
"name": "文官集团",
"type": "Organization",
"appear_count": 2,
"merge_count": 1
}
]
},
"disambiguation": {
"block_count": 1,
"effects": [
{
"left": {
"name": "节度使",
"type": "Role"
},
"right": {
"name": "节度使",
"type": "Person"
},
"result": "成功区分"
}
]
},
"memory": {
"chunks": 2
},
"triplets": {
"count": 88
},
"core_entities": [
{
"type": "Organization",
"type_cn": "组织",
"count": 16,
"entities": [
"厂卫机构",
"西厂",
"东厂",
"工部",
"地方军阀"
]
},
{
"type": "Event",
"type_cn": "事件",
"count": 12,
"entities": [
"均田制瓦解",
"无法批阅完所有政务",
"废除丞相制度",
"持续战争",
"政令执行困难"
]
},
{
"type": "Condition",
"type_cn": "Condition",
"count": 9,
"entities": [
"缺乏协作机制",
"作战效率低下",
"厢军装备不足",
"军权分散",
"军事专业化难以提升"
]
},
{
"type": "Person",
"type_cn": "人物",
"count": 8,
"entities": [
"官员",
"宦官",
"节度使",
"皇帝",
"文士"
]
},
{
"type": "Concept",
"type_cn": "Concept",
"count": 8,
"entities": [
"行政紧张",
"军力不足",
"秦国统一六国的原因",
"六部缺乏协调机制",
"专业分工"
]
},
{
"type": "Action",
"type_cn": "Action",
"count": 6,
"entities": [
"再花钱募兵",
"建立军功爵制度",
"裁撤兵员",
"削减装备",
"建立法律制度"
]
},
{
"type": "Outcome",
"type_cn": "Outcome",
"count": 5,
"entities": [
"打仗更吃亏",
"提升国家组织能力",
"降低行政效率",
"士兵效忠个人而非国家",
"政令推行困难"
]
},
{
"type": "EconomicMetric",
"type_cn": "EconomicMetric",
"count": 4,
"entities": [
"财政",
"财政支出",
"支出",
"军费"
]
},
{
"type": "Statement",
"type_cn": "Statement",
"count": 3,
"entities": [
"没有银子",
"禁军由文官控制导致作战效率低下",
"武器没材料"
]
},
{
"type": "State",
"type_cn": "State",
"count": 3,
"entities": [
"军队更弱",
"理解不足",
"不足"
]
},
{
"type": "HistoricalPeriod",
"type_cn": "HistoricalPeriod",
"count": 3,
"entities": [
"春秋战国史",
"唐朝史",
"宋朝"
]
},
{
"type": "Attribute",
"type_cn": "Attribute",
"count": 3,
"entities": [
"资源丰富",
"易守难攻",
"政策连续性强"
]
},
{
"type": "Right",
"type_cn": "Right",
"count": 3,
"entities": [
"军事指挥权",
"财政调度权",
"募兵权"
]
},
{
"type": "Policy",
"type_cn": "Policy",
"count": 2,
"entities": [
"商鞅变法",
"禁军由文官控制"
]
},
{
"type": "MilitaryCondition",
"type_cn": "MilitaryCondition",
"count": 2,
"entities": [
"军力不足",
"缺乏战略纵深"
]
},
{
"type": "Role",
"type_cn": "Role",
"count": 2,
"entities": [
"节度使",
"协调中枢"
]
},
{
"type": "Position",
"type_cn": "Position",
"count": 2,
"entities": [
"总理",
"丞相"
]
},
{
"type": "PoliticalCharacteristic",
"type_cn": "PoliticalCharacteristic",
"count": 2,
"entities": [
"旧贵族势力弱",
"中央集权程度高"
]
},
{
"type": "Phenomenon",
"type_cn": "Phenomenon",
"count": 1,
"entities": [
"宋朝军事弱势"
]
},
{
"type": "Factor",
"type_cn": "Factor",
"count": 1,
"entities": [
"制度性因素"
]
},
{
"type": "EconomicFactor",
"type_cn": "EconomicFactor",
"count": 1,
"entities": [
"财政压力"
]
},
{
"type": "EconomicIndicator",
"type_cn": "EconomicIndicator",
"count": 1,
"entities": [
"财政支出"
]
},
{
"type": "MilitaryStrategy",
"type_cn": "MilitaryStrategy",
"count": 1,
"entities": [
"对外战略被动"
]
},
{
"type": "MilitaryCapability",
"type_cn": "MilitaryCapability",
"count": 1,
"entities": [
"机动能力弱"
]
},
{
"type": "PersonGroup",
"type_cn": "PersonGroup",
"count": 1,
"entities": [
"武将"
]
},
{
"type": "EconomicCondition",
"type_cn": "EconomicCondition",
"count": 1,
"entities": [
"财政压力"
]
},
{
"type": "InstitutionalPolicy",
"type_cn": "InstitutionalPolicy",
"count": 1,
"entities": [
"废除丞相制度"
]
},
{
"type": "StateOfAffairs",
"type_cn": "StateOfAffairs",
"count": 1,
"entities": [
"中央决策高度集中于皇帝"
]
},
{
"type": "Institution",
"type_cn": "Institution",
"count": 1,
"entities": [
"科举"
]
},
{
"type": "Function",
"type_cn": "Function",
"count": 1,
"entities": [
"统筹大事小情"
]
},
{
"type": "AdministrativeStructure",
"type_cn": "AdministrativeStructure",
"count": 1,
"entities": [
"六部直接对皇帝负责"
]
},
{
"type": "AdministrativeProblem",
"type_cn": "AdministrativeProblem",
"count": 1,
"entities": [
"皇帝一人批不完政务"
]
},
{
"type": "Behavior",
"type_cn": "Behavior",
"count": 1,
"entities": [
"互相推诿责任"
]
},
{
"type": "Resource",
"type_cn": "Resource",
"count": 1,
"entities": [
"银子"
]
},
{
"type": "Situation",
"type_cn": "Situation",
"count": 1,
"entities": [
"没人拍板"
]
},
{
"type": "HistoricalState",
"type_cn": "HistoricalState",
"count": 1,
"entities": [
"秦国"
]
},
{
"type": "Location",
"type_cn": "地点",
"count": 1,
"entities": [
"关中"
]
},
{
"type": "HistoricalEvent",
"type_cn": "HistoricalEvent",
"count": 1,
"entities": [
"安史之乱"
]
},
{
"type": "PoliticalAction",
"type_cn": "PoliticalAction",
"count": 1,
"entities": [
"中央整顿"
]
},
{
"type": "PoliticalPhenomenon",
"type_cn": "PoliticalPhenomenon",
"count": 1,
"entities": [
"藩镇割据加剧"
]
},
{
"type": "EconomicEntity",
"type_cn": "EconomicEntity",
"count": 1,
"entities": [
"中央财政"
]
},
{
"type": "System",
"type_cn": "System",
"count": 1,
"entities": [
"募兵制"
]
},
{
"type": "WorkRole",
"type_cn": "WorkRole",
"count": 1,
"entities": [
"掌控禁军"
]
}
],
"triplet_samples": [
{
"subject": "记忆熊",
"predicate": "MENTIONS",
"predicate_cn": "提到",
"object": "宋朝军事弱势"
},
{
"subject": "宋朝军事弱势",
"predicate": "RESULTED_IN",
"predicate_cn": "resulted in",
"object": "制度性因素"
},
{
"subject": "记忆熊",
"predicate": "MENTIONS",
"predicate_cn": "提到",
"object": "禁军由文官控制导致作战效率低下"
},
{
"subject": "禁军由文官控制",
"predicate": "RESULTED_IN",
"predicate_cn": "resulted in",
"object": "作战效率低下"
},
{
"subject": "记忆熊",
"predicate": "MENTIONS",
"predicate_cn": "提到",
"object": "厢军装备不足"
},
{
"subject": "记忆熊",
"predicate": "MENTIONS",
"predicate_cn": "提到",
"object": "宋朝"
},
{
"subject": "记忆熊",
"predicate": "MENTIONS",
"predicate_cn": "提到",
"object": "军费"
}
],
"self_reflexion": [
{
"conflict": {
"data": [
{
"id": "76be6d82d8804beda6baa3d3447d6cbc",
"statement": "学生对\"六部缺乏协调机制\"的具体影响表示理解不足。",
"group_id": "group_123",
"chunk_id": "4a0804127d35456f86d4f06e1fa458f7",
"created_at": "2025-12-12 09:48:00.166068",
"expired_at": null,
"valid_at": null,
"invalid_at": null,
"entity_ids": []
}
],
"conflict": true,
"conflict_memory": {
"id": "e268a6fff35543fab471986c188e023e",
"statement": "学生对\"六部缺乏协调机制\"的具体影响表示理解不足。",
"group_id": "group_123",
"chunk_id": "e6cb5f56020e4a8d925d148e1d2fbda0",
"created_at": "2025-12-12 09:48:00.166068",
"expired_at": null,
"valid_at": null,
"invalid_at": null,
"entity_ids": []
}
},
"reflexion": {
"reason": "同一学生在不同时间点重复提出对'六部缺乏协调机制'具体影响的理解困难,表明原有解释未能有效解决其认知障碍,存在记忆冗余与教学反馈失效的冲突。",
"solution": "保留后出现的记忆记录chunk_id为4a0804127d35456f86d4f06e1fa458f7作为最新学习状态将其设为有效将前次相同内容的记忆id为e268a6fff35543fab471986c188e023e标记为失效避免重复干预并基于后续完整解释优化知识呈现逻辑。"
},
"resolved": {
"original_memory_id": "e268a6fff35543fab471986c188e023e",
"resolved_memory": {
"id": "e268a6fff35543fab471986c188e023e",
"statement": "学生对\"六部缺乏协调机制\"的具体影响表示理解不足。",
"group_id": "group_123",
"chunk_id": "e6cb5f56020e4a8d925d148e1d2fbda0",
"created_at": "2025-12-12 09:48:00.166068",
"expired_at": null,
"valid_at": null,
"invalid_at": "2025-12-12 09:48:00.166068",
"entity_ids": []
}
}
}
]
}
}

View File

@@ -23,7 +23,6 @@ export interface Memory {
include_dialogue_context: boolean;
max_context: string;
lambda_mem: string;
lambda_mem: string;
offset: string;
state: boolean;
created_at: string;

View File

@@ -59,6 +59,11 @@ const PerceptualLastInfo: FC<{ type: 'last_visual' | 'last_listen' | 'last_text'
})
}
const handleDownload = () => {
if (!data.file_path) return
window.open(data.file_path, '_blank')
}
return (
<RbCard
title={t(`perceptualDetail.${type}`)}
@@ -78,17 +83,17 @@ const PerceptualLastInfo: FC<{ type: 'last_visual' | 'last_listen' | 'last_text'
<Image src={data.file_path} alt={data.file_name} />
// <img src={data.file_path} alt={data.file_name} className="rb:max-w-full rb:max-h-full rb:object-contain" />
) : (
<div className="rb:text-gray-500">{data.file_name}</div>
<div className="rb:text-[#5B6167]">{data.file_name}</div>
)
) : type === 'last_listen' && /\.(mp3|wav|ogg|m4a|aac)$/i.test(data.file_name) ? (
<audio controls className="rb:w-full">
<source src={data.file_path} />
</audio>
) : (
<div className="rb:text-gray-500">{data.file_name}</div>
<div className="rb:text-[#5B6167] rb:cursor-pointer" onClick={handleDownload}>{data.file_name}</div>
)
) : (
<div className="rb:text-gray-400">No file</div>
<div className="rb:text-[#5B6167]">{t('empty.tableEmpty')}</div>
)}
</div>
<Space size={4} direction="vertical" className="rb:w-full rb:mt-3">