Skip to content

[Feature Request] 知识库 List 接口 - list knowledgebases / list kb documents #1382

Closed

Description

@hermes-ma

Pre-submission checklist | 提交前检查

  • I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
  • I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
  • This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题

Bug Description | 问题描述

There is currently no api for listing for the KB, which is a dependency in many use cases for fetching and deleting documents.

How to Reproduce | 如何重现

NA

Environment | 环境信息

NA

Additional Context | 其他信息

No response

Willingness to Implement | 实现意愿

  • I'm willing to implement this myself | 我愿意自己解决
  • I would like someone else to implement this | 我希望其他人来解决

Activity

  1. added
    ai:taskDispatched to AI coding agent | 已派发给 AI 编码任务
    on Jun 29, 2026
  2. self-assigned this
    on Jun 30, 2026
  3. Memtensor-AI commented on Jun 30, 2026

    @Memtensor-AI
    Collaborator

    🤖 AutoDev has picked up this issue and started working on it.

    Task ID: afe3ca6374e84991
    Working branch: bugfix/autodev-1382
    Target branch: latest dev* branch
    Workflow: 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.

  4. Memtensor-AI commented on Jun 30, 2026

    @Memtensor-AI
    Collaborator

    ✅ AutoDev task afe3ca6374e84991 completed.

    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.

    Base branch: main
    Branch: bugfix/autodev-1382
    Commit: 0013b17
    PR: #1981
    Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
    Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller

  5. added
    ai:testingAI agent is running tests | AI 正在运行测试
    ai:pr-readyAI-created PR is ready for review | AI 生成的 PR 已等待评审
    and removed
    ai:codingAI agent is coding | AI 正在编码
    ai:testingAI agent is running tests | AI 正在运行测试
    ai:taskDispatched to AI coding agent | 已派发给 AI 编码任务
    on Jun 30, 2026
  6. added
    area:api云服务 / FastAPI / OpenAPI / MCP
    status:needs-designNeeds design discussion before implementation | 开发前需要方案设计
    and removed
    ai:pr-readyAI-created PR is ready for review | AI 生成的 PR 已等待评审
    types:bugSomething isn't working | 功能异常
    area:coreMOS 编排层 / 框架底座 / 跨模块问题
    on Jul 2, 2026
  7. added
    status:needs-product-reviewRequires product owner confirmation before deciding public repo, transfer, or internal backlog.
    and removed
    status:needs-designNeeds design discussion before implementation | 开发前需要方案设计
    on Jul 7, 2026
  8. shinetata commented on Jul 8, 2026

    @shinetata
    Collaborator

    感谢您的反馈!

    经过产品 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 里继续留言讨论。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:api云服务 / FastAPI / OpenAPI / MCPstatus:needs-product-reviewRequires product owner confirmation before deciding public repo, transfer, or internal backlog.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions