Skip to content

feat: 支持显示分享给我的知识库#809

Merged
qdaxb merged 1 commit intomainfrom
support_show_shared_knowledge
Mar 21, 2026
Merged

feat: 支持显示分享给我的知识库#809
qdaxb merged 1 commit intomainfrom
support_show_shared_knowledge

Conversation

@qdaxb
Copy link
Contributor

@qdaxb qdaxb commented Mar 21, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Added personal knowledge base management with distinct views for knowledge bases created by you versus those shared with you.
    • Improved knowledge base organization and filtering in the personal dashboard.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 84a1c28a-93c2-425f-a55b-baf0ef1c2012

📥 Commits

Reviewing files that changed from the base of the PR and between a3c628b and d3aada6.

📒 Files selected for processing (3)
  • frontend/src/features/knowledge/document/components/KnowledgeDocumentPageDesktop.tsx
  • frontend/src/features/knowledge/document/components/KnowledgeGroupListPage.tsx
  • frontend/src/features/knowledge/document/hooks/useKnowledgeSidebar.ts

📝 Walkthrough

Walkthrough

The PR adds "personal mode" support to the knowledge document UI, enabling display of knowledge bases created by or shared with the user in a distinct view. The parent component now extracts personal KB data from the sidebar hook, processes it through a helper function, and conditionally passes it to the group list component, which renders separate tables for created and shared personal bases.

Changes

Cohort / File(s) Summary
Sidebar Hook Extension
frontend/src/features/knowledge/document/hooks/useKnowledgeSidebar.ts
Exposes two new computed arrays (personalCreatedByMe, personalSharedWithMe) derived from sidebar personal KB data, enabling parent components to access segmented personal knowledge bases.
Parent Component Logic
frontend/src/features/knowledge/document/components/KnowledgeDocumentPageDesktop.tsx
Introduces toKnowledgeBase helper to convert sidebar KB objects into UI-compatible shape, refactors personal KB loading to source from sidebar personal arrays, and passes personal mode flag with related data to child component. Updates KB resolution fallback logic in edit/delete handlers.
Child Component Rendering
frontend/src/features/knowledge/document/components/KnowledgeGroupListPage.tsx
Extends props interface with personal mode fields, extracts sorting logic into reusable sortKbs callback, adds render helpers (renderTableHeader, renderTableRows, renderPersonalModeContent), and introduces conditional rendering path that displays separate tables for created and shared KBs in personal mode.

Sequence Diagram(s)

sequenceDiagram
    participant Desktop as KnowledgeDocumentPageDesktop
    participant Sidebar as useKnowledgeSidebar Hook
    participant GroupList as KnowledgeGroupListPage
    participant Renderer as React Render

    Desktop->>Sidebar: Read personalCreatedByMe & personalSharedWithMe
    Sidebar-->>Desktop: Return KB arrays
    
    Desktop->>Desktop: Process via toKnowledgeBase helper
    Desktop->>Desktop: Determine isPersonalMode flag
    
    Desktop->>GroupList: Pass isPersonalMode, personal arrays, props
    
    alt Personal Mode Enabled
        GroupList->>GroupList: Generate sortedCreatedByMe
        GroupList->>GroupList: Generate sortedSharedWithMe
        GroupList->>GroupList: renderPersonalModeContent()
        GroupList->>Renderer: Render two tables (created + shared)
    else Normal Mode
        GroupList->>GroupList: Filter & sort KBs
        GroupList->>Renderer: Render single table with group column
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A personal mode hops into view,
Where bases created and shared shine through,
Two tables dance where one used to play,
Sorted and rendered in rabbit-approved way! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch support_show_shared_knowledge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qdaxb qdaxb merged commit 64d3015 into main Mar 21, 2026
16 of 17 checks passed
@qdaxb qdaxb deleted the support_show_shared_knowledge branch March 21, 2026 19:15
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.

1 participant