From 6e57f78fc2198d0e7f97b8d3f89d09c75f815015 Mon Sep 17 00:00:00 2001 From: matevip Date: Sun, 10 May 2026 19:16:22 +0800 Subject: [PATCH] feat(wiki-ui): library home + workspace split for Wiki page --- mateclaw-ui/src/i18n/locales/en-US.ts | 16 + mateclaw-ui/src/i18n/locales/zh-CN.ts | 16 + mateclaw-ui/src/stores/useWikiStore.ts | 9 + .../src/views/Wiki/components/WikiKBCard.vue | 177 ++++ .../src/views/Wiki/components/WikiLibrary.vue | 254 ++++++ .../views/Wiki/components/WikiPageSidebar.vue | 599 +++++++++++++ .../views/Wiki/components/WikiWorkspace.vue | 118 +++ .../Wiki/components/WikiWorkspaceHeader.vue | 148 ++++ mateclaw-ui/src/views/Wiki/index.vue | 813 +----------------- mateclaw-ui/src/views/Wiki/utils/kbVisual.ts | 72 ++ 10 files changed, 1428 insertions(+), 794 deletions(-) create mode 100644 mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue create mode 100644 mateclaw-ui/src/views/Wiki/components/WikiLibrary.vue create mode 100644 mateclaw-ui/src/views/Wiki/components/WikiPageSidebar.vue create mode 100644 mateclaw-ui/src/views/Wiki/components/WikiWorkspace.vue create mode 100644 mateclaw-ui/src/views/Wiki/components/WikiWorkspaceHeader.vue create mode 100644 mateclaw-ui/src/views/Wiki/utils/kbVisual.ts diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index 4f31a350..e8a94e33 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -1767,6 +1767,22 @@ export default { knowledgeBases: 'Knowledge Bases', noKB: 'No knowledge bases yet', selectKB: 'Select a knowledge base', + library: { + countLabel: '{count} knowledge bases', + searchPlaceholder: 'Search knowledge bases...', + empty: 'No knowledge bases yet', + emptyHint: 'Click "New Knowledge Base" in the top right to start organizing your knowledge.', + noMatch: 'No matching knowledge bases', + open: 'Open', + pages: '{count} pages', + raws: '{count} materials', + noDescription: 'No description', + updatedAt: 'Updated {time}', + sortRecent: 'Recently updated', + sortName: 'Name', + sortPages: 'Pages', + backToLibrary: 'Back to library', + }, selectPage: 'Select a page from the sidebar', pageKicker: 'Knowledge Page', confirmDelete: 'Delete page "{title}"? This cannot be undone.', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index 9a340bae..e765063e 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -1779,6 +1779,22 @@ export default { knowledgeBases: '知识库', noKB: '暂无知识库', selectKB: '请选择一个知识库', + library: { + countLabel: '{count} 个知识库', + searchPlaceholder: '搜索知识库...', + empty: '还没有知识库', + emptyHint: '点击右上角"新建知识库"开始组织你的知识', + noMatch: '没有匹配的知识库', + open: '进入', + pages: '{count} 页', + raws: '{count} 材料', + noDescription: '暂无描述', + updatedAt: '更新于 {time}', + sortRecent: '最近更新', + sortName: '名称', + sortPages: '页面数', + backToLibrary: '返回库', + }, selectPage: '从左侧选择一个页面查看', pageKicker: '知识页面', confirmDelete: '确认删除页面「{title}」?此操作不可撤销。', diff --git a/mateclaw-ui/src/stores/useWikiStore.ts b/mateclaw-ui/src/stores/useWikiStore.ts index 86ba8e6d..774db087 100644 --- a/mateclaw-ui/src/stores/useWikiStore.ts +++ b/mateclaw-ui/src/stores/useWikiStore.ts @@ -109,6 +109,14 @@ export const useWikiStore = defineStore('wiki', () => { } } + function backToLibrary() { + currentKB.value = null + currentPage.value = null + rawMaterials.value = [] + pages.value = [] + selectedRawId.value = null + } + async function fetchRawMaterials(kbId: number) { const res: any = await wikiApi.listRaw(kbId) rawMaterials.value = res.data || [] @@ -183,6 +191,7 @@ export const useWikiStore = defineStore('wiki', () => { selectKB, createKB, deleteKB, + backToLibrary, fetchRawMaterials, fetchPages, filterPagesByRaw, diff --git a/mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue b/mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue new file mode 100644 index 00000000..bcfb7621 --- /dev/null +++ b/mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue @@ -0,0 +1,177 @@ + + + + + diff --git a/mateclaw-ui/src/views/Wiki/components/WikiLibrary.vue b/mateclaw-ui/src/views/Wiki/components/WikiLibrary.vue new file mode 100644 index 00000000..b59de633 --- /dev/null +++ b/mateclaw-ui/src/views/Wiki/components/WikiLibrary.vue @@ -0,0 +1,254 @@ + + + + + diff --git a/mateclaw-ui/src/views/Wiki/components/WikiPageSidebar.vue b/mateclaw-ui/src/views/Wiki/components/WikiPageSidebar.vue new file mode 100644 index 00000000..a35c6ee1 --- /dev/null +++ b/mateclaw-ui/src/views/Wiki/components/WikiPageSidebar.vue @@ -0,0 +1,599 @@ + + + + + diff --git a/mateclaw-ui/src/views/Wiki/components/WikiWorkspace.vue b/mateclaw-ui/src/views/Wiki/components/WikiWorkspace.vue new file mode 100644 index 00000000..7b11af0f --- /dev/null +++ b/mateclaw-ui/src/views/Wiki/components/WikiWorkspace.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/mateclaw-ui/src/views/Wiki/components/WikiWorkspaceHeader.vue b/mateclaw-ui/src/views/Wiki/components/WikiWorkspaceHeader.vue new file mode 100644 index 00000000..ccb7b39b --- /dev/null +++ b/mateclaw-ui/src/views/Wiki/components/WikiWorkspaceHeader.vue @@ -0,0 +1,148 @@ + + + + + diff --git a/mateclaw-ui/src/views/Wiki/index.vue b/mateclaw-ui/src/views/Wiki/index.vue index 23a1089e..8e017f9d 100644 --- a/mateclaw-ui/src/views/Wiki/index.vue +++ b/mateclaw-ui/src/views/Wiki/index.vue @@ -2,297 +2,21 @@
-
-
-
{{ t('wiki.kicker') }}
-

{{ t('nav.wiki') }}

-

{{ t('wiki.desc') }}

-
- -
- -
- -
- - - - - - -
- - -
-
- - - -

{{ t('wiki.selectKB') }}

-
- -
-
- -
- -
- -
- -
- -
- - - -

{{ t('wiki.selectPage') }}

-
-
- -
- -
- -
- -
- -
- -
-
-
-
+ +
-