Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(ui): compact resource list headers in Lite mode (#4316)
lyingbug33b77f844014
diff --git a/frontend/src/components/ResourceListToolbar.vue b/frontend/src/components/ResourceListToolbar.vueindex d89520170..412cdc56f 100644--- a/frontend/src/components/ResourceListToolbar.vue+++ b/frontend/src/components/ResourceListToolbar.vue@@ -1,5 +1,5 @@<template>- <div class="resource-toolbar">+ <div class="resource-toolbar" :class="{ 'resource-toolbar-compact': hideScopes }"><div v-if="!hideScopes" class="scope-filters"><div class="category-tabs" role="group" :aria-label="$t('listSpaceSidebar.all')"><button v-for="item in scopes" :key="item.value" type="button"@@ -98,6 +98,11 @@ onMounted(() => { if (!props.hideScopes) orgStore.fetchOrganizations() }).space-filter { width: 180px; }.space-filter-icon-active { color: var(--td-brand-color); }.search-input { width: 260px; max-width: 100%; margin-left: auto; }+.resource-toolbar-compact {+ max-width: 100%;+ padding-bottom: 0;+ border-bottom: 0;+}@media (max-width: 720px) {.search-input { width: 100%; }.space-filter { max-width: 100%; }diff --git a/frontend/src/components/css/resource-card.less b/frontend/src/components/css/resource-card.lessindex f85facec1..94225ec5f 100644--- a/frontend/src/components/css/resource-card.less+++ b/frontend/src/components/css/resource-card.less@@ -197,6 +197,14 @@.header-title { width: 100%; gap: 4px; }.title-row { flex-wrap: wrap; gap: 12px; }h2 { margin-right: auto; }+ .header-actions-lite {+ max-width: 100%;+ flex-wrap: wrap;+ @media (max-width: 720px) {+ width: 100%;+ .resource-toolbar { width: 100%; }+ }+ }.header-subtitle { color: var(--td-text-color-secondary); font-size: var(--app-text-base); }.header-action-btn {width: auto;diff --git a/frontend/src/views/agent/AgentList.vue b/frontend/src/views/agent/AgentList.vueindex 926de38b5..19e31de0a 100644--- a/frontend/src/views/agent/AgentList.vue+++ b/frontend/src/views/agent/AgentList.vue@@ -1,5 +1,5 @@<template>- <div class="agent-list-container">+ <div class="agent-list-container" :class="{ 'is-lite': authStore.isLiteMode }"><div class="agent-list-content"><div class="header" style="--wails-draggable: drag"><div class="header-title" style="--wails-draggable: drag">@@ -8,7 +8,8 @@<ResourceIcon type="agent" :size="24" />{{ $t('agent.title') }}</h2>- <div class="header-actions" style="--wails-draggable: no-drag">+ <div class="header-actions" :class="{ 'header-actions-lite': authStore.isLiteMode }" style="--wails-draggable: no-drag">+ <ResourceListToolbar v-if="authStore.isLiteMode" hide-scopes v-model="spaceSelection" v-model:query="keyword" /><ResourceSortControl v-model="selectedResourceSort" /><t-tooltip v-if="authStore.hasRole('contributor')" :content="$t('agent.createAgent')" placement="bottom"><t-button variant="text" theme="default" size="small" class="header-action-btn"@@ -40,7 +41,7 @@<p class="header-subtitle" style="--wails-draggable: drag">{{ $t('agent.subtitle') }}</p></div></div>- <ResourceListToolbar :hide-scopes="authStore.isLiteMode" v-model="spaceSelection" v-model:query="keyword" :count-all="allAgentsCount"+ <ResourceListToolbar v-if="!authStore.isLiteMode" v-model="spaceSelection" v-model:query="keyword" :count-all="allAgentsCount":count-mine="agents.length" :count-by-org="effectiveSharedCountByOrg" :count-favorites="agentFavoritesCount":count-recents="agentRecentsCount" /><div class="agent-list-main">@@ -95,8 +96,8 @@</div><!-- 我创建的:当前 agent 是本空间 + 非内置 + 我亲手创建,且前一张要么不存在、要么不是本空间、要么是内置(builtin → mine 过渡)、- 要么是同事创建。与 KB 列表对齐。 -->- <div v-if="agent.isMine+ 要么是同事创建。与 KB 列表对齐,Lite 隐藏该分组标题。 -->+ <div v-if="!authStore.isLiteMode && agent.isMine&& !agent.is_builtin&& isMyAgent(agent)&& (index === 0@@ -311,8 +312,8 @@<t-icon class="agent-section-toggle":name="isAgentSectionCollapsed('builtin') ? 'chevron-right' : 'chevron-down'" size="14px" /></div>- <!-- 我创建的:第一张非内置且我亲手创建的卡片前打标题 -->- <div v-if="!agent.is_builtin+ <!-- 我创建的:非 Lite 在第一张非内置且我亲手创建的卡片前打标题 -->+ <div v-if="!authStore.isLiteMode && !agent.is_builtin&& isMyAgent(agent)&& (index === 0|| sortedMineAgents[index - 1].is_builtin@@ -1357,7 +1358,11 @@ const tenantSectionIconName = computed(() =>// 思路——空 Set = 全展开,避免新增分段还得维护默认值。type AgentSectionKey = 'builtin' | 'mine' | 'tenantOthers' | 'sharedByMe' | 'sharedEditable' | 'sharedReadonly'const collapsedAgentSections = ref<Set<AgentSectionKey>>(new Set())-const isAgentSectionCollapsed = (key: AgentSectionKey) => collapsedAgentSections.value.has(key)+const isAgentSectionCollapsed = (key: AgentSectionKey) => {+ // Lite 隐藏了「我创建的」折叠入口,对应卡片始终展开。+ if (authStore.isLiteMode && key === 'mine') return false+ return collapsedAgentSections.value.has(key)+}const toggleAgentSection = (key: AgentSectionKey) => {const next = new Set(collapsedAgentSections.value)if (next.has(key)) next.delete(key)@@ -1680,6 +1685,10 @@ watch(keyword, () => { collapsedAgentSections.value = new Set() })}// 共享给我 · 可编辑 / 仅查看 分组标题,与 KB 列表 .kb-section-header 对齐。+.is-lite .agent-card.is-builtin + .agent-card:not(.is-builtin) {+ grid-column-start: 1;+}+.agent-section-header {.resource-section-header();}diff --git a/frontend/src/views/knowledge/KnowledgeBaseList.vue b/frontend/src/views/knowledge/KnowledgeBaseList.vueindex 260cec4c7..a4ebb9785 100644--- a/frontend/src/views/knowledge/KnowledgeBaseList.vue+++ b/frontend/src/views/knowledge/KnowledgeBaseList.vue@@ -8,7 +8,8 @@<ResourceIcon type="knowledge" :size="24" />{{ $t('knowledgeBase.title') }}</h2>- <div class="header-actions" style="--wails-draggable: no-drag">+ <div class="header-actions" :class="{ 'header-actions-lite': authStore.isLiteMode }" style="--wails-draggable: no-drag">+ <ResourceListToolbar v-if="authStore.isLiteMode" hide-scopes v-model="spaceSelection" v-model:query="keyword" /><ResourceSortControl v-model="selectedResourceSort" /><t-tooltip v-if="authStore.hasRole('contributor')" :content="$t('knowledgeList.create')" placement="bottom"><t-button variant="text" theme="default" size="small" class="header-action-btn"@@ -22,7 +23,7 @@<p class="header-subtitle" style="--wails-draggable: drag">{{ $t('knowledgeList.subtitle') }}</p></div></div>- <ResourceListToolbar :hide-scopes="authStore.isLiteMode" v-model="spaceSelection" v-model:query="keyword" :count-all="allKnowledgeBases"+ <ResourceListToolbar v-if="!authStore.isLiteMode" v-model="spaceSelection" v-model:query="keyword" :count-all="allKnowledgeBases":count-mine="kbs.length" :count-by-org="effectiveSharedCountByOrg" :count-favorites="kbFavoritesCount":count-recents="kbRecentsCount" /><div class="kb-list-main">@@ -83,9 +84,8 @@仅查看 / 共享给我)各自打自己的标题;原本的「其他」过渡标题在 per-user 置顶模型下已无意义,删除以免和具体子段标题叠加。 --><template v-for="(kb, index) in filteredKnowledgeBases" :key="kb.id">- <!-- 我创建的:第一张「我创建」非置顶卡片前打标题,- 对所有角色显示,不受上方是否存在「已置顶」分组影响。 -->- <div v-if="kb.isMine+ <!-- Lite 无需区分创建者;其他版本在第一张非置顶的我创建卡片前显示分组。 -->+ <div v-if="!authStore.isLiteMode && kb.isMine&& isMyKb(kb as KB)&& !kb.is_pinned&& (index === 0@@ -359,10 +359,8 @@<!-- 我的知识库。「已置顶」由顶部 header 接管;其余各分段各打各的标题——见「全部」tab 同处注释。 --><template v-for="(kb, index) in sortedMineKbs" :key="kb.id">- <!-- 我创建的:第一张非置顶的我创建卡片前打标题,无论上方是否- 有「已置顶」段都要显示,和「本空间 · 仅查看」对齐——见- 「全部」tab 同处注释。 -->- <div v-if="isMyKb(kb)+ <!-- Lite 无需区分创建者;其他版本与「全部」视图保持一致。 -->+ <div v-if="!authStore.isLiteMode && isMyKb(kb)&& !kb.is_pinned&& (index === 0 || sortedMineKbs[index - 1].is_pinned)" class="kb-section-header" role="button"tabindex="0" :aria-expanded="!isKbSectionCollapsed('mine')" @click="toggleKbSection('mine')"@@ -1014,7 +1012,11 @@ const tenantSectionIconName = computed(() =>// 即表示初始的全展开状态,避免每次新加分段还得回头维护默认值。type KbSectionKey = 'pinned' | 'mine' | 'tenantOthers' | 'sharedByMe' | 'sharedEditable' | 'sharedReadonly'const collapsedKbSections = ref<Set<KbSectionKey>>(new Set())-const isKbSectionCollapsed = (key: KbSectionKey) => collapsedKbSections.value.has(key)+const isKbSectionCollapsed = (key: KbSectionKey) => {+ // Lite 隐藏了「我创建的」折叠入口,对应卡片始终展开。+ if (authStore.isLiteMode && key === 'mine') return false+ return collapsedKbSections.value.has(key)+}const toggleKbSection = (key: KbSectionKey) => {// 重新赋一个新的 Set 是为了让 ref 的 .value 身份变化触发模板重渲染;// 直接 .add/.delete 在 Vue 3 的 reactive Set 里也能 work,但 ref(Set) 的