diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index e6a4e48a..9360cb81 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -2074,7 +2074,11 @@ export default { deleteKBConfirm: 'Delete knowledge base "{name}"? This will also remove {raws} raw materials and {pages} wiki pages. This action cannot be undone.', deleteKBSuccess: 'Deleted knowledge base "{name}"', deleteKBFailed: 'Failed to delete knowledge base', + manageKB: 'Manage knowledge base', + toManage: 'Manage', + toReading: 'View wiki', }, + manageBadge: 'Management', 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 cab06d6a..2117f14f 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -2086,7 +2086,11 @@ export default { deleteKBConfirm: '确认删除知识库「{name}」?将一并清除 {raws} 个原始材料和 {pages} 个 Wiki 页面,此操作不可撤销。', deleteKBSuccess: '已删除知识库「{name}」', deleteKBFailed: '删除知识库失败', + manageKB: '管理知识库', + toManage: '管理', + toReading: '查看 Wiki', }, + manageBadge: '管理', selectPage: '从左侧选择一个页面查看', pageKicker: '知识页面', confirmDelete: '确认删除页面「{title}」?此操作不可撤销。', diff --git a/mateclaw-ui/src/stores/useWikiStore.ts b/mateclaw-ui/src/stores/useWikiStore.ts index 93b9b888..68f9f951 100644 --- a/mateclaw-ui/src/stores/useWikiStore.ts +++ b/mateclaw-ui/src/stores/useWikiStore.ts @@ -126,6 +126,11 @@ export interface WikiLintJob { export const useWikiStore = defineStore('wiki', () => { const knowledgeBases = ref([]) const currentKB = ref(null) + // Which face of an opened KB to show: 'browse' = reading surfaces (pages + + // graph), 'manage' = build/config surfaces (raw materials, config, + // transformations, advanced, hot cache). Both views share the data loaded by + // selectKB, so switching between them is a flag flip with no refetch. + const workspaceMode = ref<'browse' | 'manage'>('browse') const rawMaterials = ref([]) const pages = ref([]) const currentPage = ref(null) @@ -172,7 +177,8 @@ export const useWikiStore = defineStore('wiki', () => { } } - async function selectKB(id: number) { + async function selectKB(id: number, mode: 'browse' | 'manage' = 'browse') { + workspaceMode.value = mode const res: any = await wikiApi.getKB(id) currentKB.value = res.data || res // pageRefs refresh in parallel with materials + pages — the viewer needs @@ -239,9 +245,16 @@ export const useWikiStore = defineStore('wiki', () => { } } + // Switch between reading/management faces of an already-open KB without + // refetching — both share the data selectKB already loaded. + function setWorkspaceMode(mode: 'browse' | 'manage') { + workspaceMode.value = mode + } + function backToLibrary() { currentKB.value = null currentPage.value = null + workspaceMode.value = 'browse' rawMaterials.value = [] pages.value = [] pageRefs.value = [] @@ -440,6 +453,7 @@ export const useWikiStore = defineStore('wiki', () => { return { knowledgeBases, currentKB, + workspaceMode, rawMaterials, pages, currentPage, @@ -456,6 +470,7 @@ export const useWikiStore = defineStore('wiki', () => { selectKB, createKB, deleteKB, + setWorkspaceMode, backToLibrary, fetchRawMaterials, fetchPages, diff --git a/mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue b/mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue index e9a9c8c4..7ff99a05 100644 --- a/mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue +++ b/mateclaw-ui/src/views/Wiki/components/WikiKBCard.vue @@ -11,7 +11,22 @@ +