You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] 知识库 List 接口 - list knowledgebases / list kb documents #1382
Summary: Adds the missing knowledgebase list APIs to MemOSClient (issue #1382). Two new client methods — list_knowledgebases(page, size) calling POST /list/knowledgebase, and list_knowledgebase_documents(knowledgebase_id, page, size) calling POST /list/knowledgebase-file — fill the previously missing enumeration capability that the SDK needed for downstream bulk-delete and UI-picker flows. Endpoint naming mirrors the existing create/, delete/, add/, get/ verbs already used by the SaaS contract; pagination follows the 1-based page + size pattern from get_memory with 1 <= size <= 100 validated before any HTTP call. Two new Pydantic response models (MemOSListKnowledgebaseResponse and MemOSListKnowledgebaseFileResponse) wrap loose extra="allow" data containers so server-side schema additions never break the SDK, and they reuse the existing FileDetail for KB document entries.
Implementation lives in src/memos/api/product_models.py (4 new classes, 66 lines) and src/memos/api/client.py (2 new methods + shared _validate_page_size helper, 100 lines). A new 17-case pytest suite at tests/api/test_client_knowledgebase_list.py (242 lines) was written TDD-first: it covers happy paths, request-shape verification (URL, JSON body, auth header), validation rejection of knowledgebase_id="", out-of-range page/size, retry recovery after two transient requests.ConnectionErrors, and final-retry exhaustion. All 17 tests pass; running them alongside tests/api/test_server_router.py and tests/api/test_cube_endpoints.py yields 45 passed / 0 failed. Pre-existing failures in tests/api/test_mcp_serve.py (missing pytest-asyncio in this environment) reproduce on the untouched base branch and are unrelated. ruff check + ruff format clean. make openapi regeneration is not needed — the change is purely client-side; no FastAPI router under src/memos/api/routers/ was touched.
OPSP path: Feature Quick-Change (additive, no API surface beyond the SDK methods, no migration, no architectural impact). Artifacts archived to memos-autodev-specs/2026-06-29-1382-... (commit c9b58de on main). Branch bugfix/autodev-1382 pushed to origin at commit 0013b17b; reviewers @MatthewZhuang@CarltonXiang@syzsunshine219@World-controller.
Activity
Memtensor-AI commentedon Jun 30, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
afe3ca6374e84991Working branch:
bugfix/autodev-1382Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
feat(api): add list knowledgebases / list kb documents client APIs
Memtensor-AI commentedon Jun 30, 2026
✅ AutoDev task
afe3ca6374e84991completed.Summary: Adds the missing knowledgebase list APIs to
MemOSClient(issue #1382). Two new client methods —list_knowledgebases(page, size)callingPOST /list/knowledgebase, andlist_knowledgebase_documents(knowledgebase_id, page, size)callingPOST /list/knowledgebase-file— fill the previously missing enumeration capability that the SDK needed for downstream bulk-delete and UI-picker flows. Endpoint naming mirrors the existingcreate/,delete/,add/,get/verbs already used by the SaaS contract; pagination follows the 1-basedpage+sizepattern fromget_memorywith1 <= size <= 100validated before any HTTP call. Two new Pydantic response models (MemOSListKnowledgebaseResponseandMemOSListKnowledgebaseFileResponse) wrap looseextra="allow"data containers so server-side schema additions never break the SDK, and they reuse the existingFileDetailfor KB document entries.Implementation lives in
src/memos/api/product_models.py(4 new classes, 66 lines) andsrc/memos/api/client.py(2 new methods + shared_validate_page_sizehelper, 100 lines). A new 17-case pytest suite attests/api/test_client_knowledgebase_list.py(242 lines) was written TDD-first: it covers happy paths, request-shape verification (URL, JSON body, auth header), validation rejection ofknowledgebase_id="", out-of-rangepage/size, retry recovery after two transientrequests.ConnectionErrors, and final-retry exhaustion. All 17 tests pass; running them alongsidetests/api/test_server_router.pyandtests/api/test_cube_endpoints.pyyields 45 passed / 0 failed. Pre-existing failures intests/api/test_mcp_serve.py(missing pytest-asyncio in this environment) reproduce on the untouched base branch and are unrelated.ruff check+ruff formatclean.make openapiregeneration is not needed — the change is purely client-side; no FastAPI router undersrc/memos/api/routers/was touched.OPSP path: Feature Quick-Change (additive, no API surface beyond the SDK methods, no migration, no architectural impact). Artifacts archived to
memos-autodev-specs/2026-06-29-1382-...(commitc9b58deonmain). Branchbugfix/autodev-1382pushed tooriginat commit0013b17b; reviewers @MatthewZhuang @CarltonXiang @syzsunshine219 @World-controller.Base branch:
mainBranch:
bugfix/autodev-1382Commit:
0013b17PR: #1981
Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
shinetata commentedon Jul 8, 2026
感谢您的反馈!
经过产品 review,知识库(KB)后续会作为 MemOS Cloud 的商用能力演进,暂不在开源版 SDK 路线内,所以这个 issue 我们先不在开源仓库推进,望理解。
也同步一下 Cloud 后端的实际现状,方便你按需使用:
列出 KB 内文件:Cloud 公开 API POST /v1/get/knowledgebase-file 已支持按 knowledgebase_id + page + page_size 分页列表(pageSize 1–100),后端能力已具备;开源 SDK 暂未暴露这一调用模式,Cloud 用户可直接按文档调用。
列出某个用户/项目下的所有 KB:目前在 Cloud Dashboard API(/dashboard/knowledgebase/list)提供,未通过公开 SaaS API 暴露。
此前 AutoDev 自动接手并提了 PR #1982,已被关闭——该 PR 提议的 /list/knowledgebase 端点与 Cloud 后端实际路由并不一致,所以没有合入。
本 issue 暂先关闭。如果你是 Cloud 用户,KB 列举/管理能力可以通过 Dashboard 使用;后续若有更多需求,欢迎通过 Cloud 产品侧反馈,也可以在 issue 里继续留言讨论。