Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat(kb-list): group pinned knowledge bases into a labeled section

wizardchen0be4572bd53d
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 74e67e20e..47ba24199 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -1548,6 +1548,10 @@ export default {
unpinSuccess: 'Unpinned',
failed: 'Operation failed',
},
+ sections: {
+ pinned: 'Pinned',
+ others: 'Others',
+ },
messages: {
deleted: 'Knowledge base deleted',
deleteFailed: 'Failed to delete knowledge base',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index eaf8ae5d5..8d3390bac 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -2146,6 +2146,10 @@ export default {
unpinSuccess: "고정 해제됨",
failed: "작업 실패",
},
+ sections: {
+ pinned: "고정됨",
+ others: "기타",
+ },
detail: {
title: "공유 지식베이스",
overview: "개요",
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index ef1a39521..6e98cf360 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -1753,6 +1753,10 @@ export default {
unpinSuccess: 'Откреплено',
failed: 'Операция не удалась'
},
+ sections: {
+ pinned: 'Закреплённые',
+ others: 'Другие'
+ },
messages: {
deleted: 'База знаний удалена',
deleteFailed: 'Не удалось удалить базу знаний',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index c82def074..9ad2ca054 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -2119,6 +2119,10 @@ export default {
unpinSuccess: "已取消置顶",
failed: "操作失败",
},
+ sections: {
+ pinned: "置顶",
+ others: "其他",
+ },
detail: {
title: "共享知识库",
overview: "概览",
diff --git a/frontend/src/views/knowledge/KnowledgeBaseList.vue b/frontend/src/views/knowledge/KnowledgeBaseList.vue
index f6feaaa06..ec01a67f1 100644
--- a/frontend/src/views/knowledge/KnowledgeBaseList.vue
+++ b/frontend/src/views/knowledge/KnowledgeBaseList.vue
@@ -95,8 +95,26 @@
<!-- 卡片网格:全部 -->
<div v-if="spaceSelection === 'all' && filteredKnowledgeBases.length > 0" class="kb-card-wrap">
+ <!-- 置顶分组标题 -->
+ <div
+ v-if="filteredKnowledgeBases[0] && filteredKnowledgeBases[0].isMine && filteredKnowledgeBases[0].is_pinned"
+ class="kb-section-header kb-section-header-pinned"
+ >
+ <t-icon name="pin-filled" size="14px" />
+ <span>{{ $t('knowledgeList.sections.pinned') }}</span>
+ </div>
<!-- 全部:我的知识库 + 共享给我的知识库 -->
- <template v-for="kb in filteredKnowledgeBases" :key="kb.id">
+ <template v-for="(kb, index) in filteredKnowledgeBases" :key="kb.id">
+ <!-- 「其他」分组标题:从置顶过渡到非置顶时插入 -->
+ <div
+ v-if="index > 0
+ && filteredKnowledgeBases[index - 1].isMine
+ && filteredKnowledgeBases[index - 1].is_pinned
+ && !(kb.isMine && kb.is_pinned)"
+ class="kb-section-header"
+ >
+ <span>{{ $t('knowledgeList.sections.others') }}</span>
+ </div>
<!-- 我的知识库卡片 -->
<div
v-if="kb.isMine"
@@ -262,10 +280,21 @@
</div>
<div v-if="spaceSelection === 'mine' && kbs.length > 0" class="kb-card-wrap">
+ <!-- 置顶分组标题 -->
+ <div v-if="kbs[0] && kbs[0].is_pinned" class="kb-section-header kb-section-header-pinned">
+ <t-icon name="pin-filled" size="14px" />
+ <span>{{ $t('knowledgeList.sections.pinned') }}</span>
+ </div>
<!-- 我的知识库 -->
+ <template v-for="(kb, index) in kbs" :key="kb.id">
+ <!-- 「其他」分组标题:从置顶过渡到非置顶时插入 -->
+ <div
+ v-if="index > 0 && kbs[index - 1].is_pinned && !kb.is_pinned"
+ class="kb-section-header"
+ >
+ <span>{{ $t('knowledgeList.sections.others') }}</span>
+ </div>
<div
- v-for="(kb, index) in kbs"
- :key="kb.id"
class="kb-card"
:class="{
'uninitialized': !isInitialized(kb),
@@ -367,6 +396,7 @@
</div>
</div>
</div>
+ </template>
</div>
<!-- 卡片网格:共享给我 -->
@@ -1615,6 +1645,27 @@ const handleUploadFinishedEvent = (event: Event) => {
animation: contentFadeIn 0.32s ease-out;
}
+.kb-section-header {
+ grid-column: 1 / -1;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 4px 0 4px;
+ color: var(--td-text-color-secondary);
+ font-family: var(--app-font-family);
+ font-size: 13px;
+ font-weight: 600;
+ line-height: 20px;
+
+ .t-icon {
+ color: var(--td-brand-color);
+ }
+
+ &.kb-section-header-pinned {
+ color: var(--td-brand-color);
+ }
+}
+
.kb-card {
border: .5px solid var(--td-component-stroke);
border-radius: 12px;