Fix #1317: fix: /add/message和/search/memory接口端点被移除了,导致cloud插件不可用#1973
Open
Memtensor-AI wants to merge 1 commit into
Open
Fix #1317: fix: /add/message和/search/memory接口端点被移除了,导致cloud插件不可用#1973Memtensor-AI wants to merge 1 commit into
Memtensor-AI wants to merge 1 commit into
Conversation
…pat endpoints (#1317) The MemOS Cloud OpenClaw plugin, the openwork desktop integration, and the Python MemOSClient SDK all POST to `/add/message`, `/search/memory`, and `/get/memory`. The server side only exposed `/product/search` and `/product/add` after the API consolidation in #1344, so every plugin call returned 404. Add a thin compatibility router under `src/memos/api/routers/cloud_compat_router.py` that: - Registers the three cloud-shape paths at the FastAPI app root. - Translates cloud-plugin snake_case payloads (with both snake_case and legacy camelCase async_mode aliases) into the internal APISearchRequest / APIADDRequest / GetMemoryRequest models. - Folds plugin metadata (source / app_id / agent_id / allow_public) into APIADDRequest.info instead of dropping it. - Delegates to the existing AddHandler, SearchHandler, and memory_handler -- no handler logic is duplicated. Wire the compat router into both `server_api.py` and `server_api_ext.py`. Add `tests/api/test_cloud_compat_router.py` (11 new cases) covering endpoint registration, payload mapping, validation errors, and the async_mode bool/literal conversion. Targeted regression suite `tests/api/test_server_router.py` still passes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Restores the /add/message, /search/memory, and /get/memory HTTP endpoints that the MemOS Cloud OpenClaw plugin, the openwork desktop integration, and the Python MemOSClient SDK have always called. After the API consolidation in PR #1344, the server only exposed /product/search and /product/add, so every plugin call returned 404 (issue #1317). The fix adds a thin compatibility router (src/memos/api/routers/cloud_compat_router.py) that registers the three cloud-shape paths at the FastAPI app root, translates the cloud plugin's snake_case payload (with both snake_case and legacy camelCase async_mode aliases) into the internal APISearchRequest / APIADDRequest / GetMemoryRequest models, and delegates to the existing AddHandler / SearchHandler / memory_handler -- no internal handler logic is duplicated. The compat router is wired into both server_api.py and server_api_ext.py. Verification: 11 new tests in tests/api/test_cloud_compat_router.py cover endpoint registration, payload field mapping, validation errors, and the async_mode bool/literal conversion; all pass. The targeted regression suite tests/api/test_server_router.py (15 cases) still passes, confirming the /product/* contract is unchanged. ruff check + ruff format clean on all changed files. 4 pre-existing failures in tests/api/test_mcp_serve.py (missing pytest-asyncio in sandbox) confirmed unrelated via git stash baseline check.
Related Issue (Required): Fixes #1317
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Automated tests are pending.
Checklist
@MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller please review this PR.
Reviewer Checklist