Skip to content

Conversation

@CaralHsi
Copy link
Collaborator

@CaralHsi CaralHsi commented Nov 27, 2025

Description

Summary:

🎯 Overview

Implements a comprehensive multi-model memory reader system that extends SimpleStructMemReader to handle multimodal messages (text, files, images, audio, etc.) with a clean, modular parser architecture.

✨ Key Features

1. MultiModelStructMemReader

  • ✅ Inherits from SimpleStructMemReader for code reuse
  • ✅ Processes multimodal scene data in fast/fine modes
  • ✅ Aligned custom_tags and info handling with parent class

2. Modular Parser System

Each parser is responsible for its own message type:

  • UserParser: Multimodal user messages (text + file + image, etc.)
  • AssistantParser/SystemParser/ToolParser: Role-based messages
  • TextContentParser/FileContentParser: Raw content parts
  • StringParser: Simple string messages

3. Source Management Pattern

  • Each parser implements create_source() and rebuild_from_source()
  • Multimodal messages create one SourceMessage per content part
  • Preserves original_part for perfect reconstruction

📊 Changes

Core Files

  • multi_model_struct.py: Main reader implementation
  • multi_model_parser.py: Unified dispatcher
  • base.py: Abstract parser interface
  • 7 specific parsers: User, Assistant, System, Tool, Text, File, String

🔧 Technical Highlights

  1. Parser Responsibility: Each parser manages its own source creation/rebuilding
  2. Multimodal Support: One SourceMessage per content part with original_part preservation
  3. Inheritance: Reuses windowing, chunking, LLM infrastructure
  4. API Alignment: Consistent with SimpleStructMemReader patterns

🚀 Future Work

  • Implement parse_fine() in all parsers
  • Add image/audio parser support
  • Optimize parallel LLM calls
  • Complete message splitting logic

Fix: #(issue)

Docs Issue/PR: (docs-issue-or-pr-link)

Reviewer: @(reviewer)

Checklist:

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

CarltonXiang and others added 30 commits November 21, 2025 10:40
## Description

<!--
Please include a summary of the changes below;
Fill in the issue number that this PR addresses (if applicable);
Fill in the related MemOS-Docs repository issue or PR link (if
applicable);
Mention the person who will review this PR (if you know who it is);
Replace (summary), (issue), (docs-issue-or-pr-link), and (reviewer) with
the appropriate information.

请在下方填写更改的摘要;
填写此 PR 解决的问题编号(如果适用);
填写相关的 MemOS-Docs 仓库 issue 或 PR 链接(如果适用);
提及将审查此 PR 的人(如果您知道是谁);
替换 (summary)、(issue)、(docs-issue-or-pr-link) 和 (reviewer) 为适当的信息。
-->

Summary: (summary)

Fix: #(issue)

Docs Issue/PR: (docs-issue-or-pr-link)

Reviewer: @(reviewer)

## Checklist:

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人
## Description

<!--
Please include a summary of the changes below;
Fill in the issue number that this PR addresses (if applicable);
Fill in the related MemOS-Docs repository issue or PR link (if
applicable);
Mention the person who will review this PR (if you know who it is);
Replace (summary), (issue), (docs-issue-or-pr-link), and (reviewer) with
the appropriate information.

请在下方填写更改的摘要;
填写此 PR 解决的问题编号(如果适用);
填写相关的 MemOS-Docs 仓库 issue 或 PR 链接(如果适用);
提及将审查此 PR 的人(如果您知道是谁);
替换 (summary)、(issue)、(docs-issue-or-pr-link) 和 (reviewer) 为适当的信息。
-->

Summary: (summary)

Fix: #(issue)

Docs Issue/PR: (docs-issue-or-pr-link)

Reviewer: @(reviewer)

## Checklist:

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人
…emTensor#511)

## Summary
Updated
[docker/.env.example](cci:7://file:///Users/nowcoder/Desktop/MemOS/docker/.env.example:0:0-0:0)
to include all currently used environment variables in the codebase,
ensuring users have a complete reference for configuration.

## Source
- Related Issue: MemTensor#505

## Changes
- Added missing variables (e.g., `API_SCHEDULER_ON`, `MOS_CUBE_PATH`).
- Clarified comments and usage for existing variables.
- Verified against [src/memos/api/config.py] and other source files.

## Suggestion
To further improve the onboarding experience, I suggest we consider
providing multiple preset configuration files (e.g., `.env.simple`,
`.env.production`, `.env.dev`) or a `.env.sync` mechanism. This would
allow users to quickly choose a configuration that matches their use
case without needing to manually toggle every option in a single large
file.
@CaralHsi CaralHsi changed the title Feat/chat router feat: Multi-Model Memory Reader with Modular Parser Architecture Nov 27, 2025
@CaralHsi CaralHsi marked this pull request as ready for review November 27, 2025 07:46
@CaralHsi CaralHsi merged commit 9686810 into MemTensor:dev Nov 27, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants