Skip to content

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

fix(ui): keep knowledge folders readable and shrink tag editing (#4765)

lyingbugd25fed4ba295
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 1d47bf4c0..ce625dd3f 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -945,6 +945,8 @@ export default {
countHint: '{direct} documents in this folder; {total} including subfolders',
filteredCount: '{count} matching documents',
title: 'Folders',
+ folderSection: 'Folders',
+ documentSection: 'Documents',
rootRow: 'Root',
rootRowTip: 'Knowledge base root; documents not in a subfolder live here',
folderCardCount: '{count} document | {count} documents',
@@ -6660,6 +6662,7 @@ export default {
chooseAction: "Choose an action, or describe what you need.",
create: {
agentTitle: "Describe your agent",
+ agentAction: "Create with assistant",
agentHint: "Describe who it serves and what it should do. The assistant will choose resources and create it.",
agentPlaceholder: "For example: a support agent that answers product questions using our knowledge base, cites sources and acknowledges missing information.",
automationTitle: "Create a task with the assistant",
diff --git a/frontend/src/i18n/locales/ja-JP.ts b/frontend/src/i18n/locales/ja-JP.ts
index 55bbc5c23..c630009e7 100644
--- a/frontend/src/i18n/locales/ja-JP.ts
+++ b/frontend/src/i18n/locales/ja-JP.ts
@@ -945,6 +945,8 @@ export default {
countHint: 'このフォルダ内 {direct} 件、サブフォルダを含めて {total} 件',
filteredCount: '{count} 件一致',
title: 'フォルダ',
+ folderSection: 'フォルダ',
+ documentSection: 'ドキュメント',
rootRow: 'ルート',
rootRowTip: 'ナレッジベースのルート。サブフォルダに属さないドキュメントはここに置かれます',
folderCardCount: '{count}件のドキュメント',
@@ -6660,6 +6662,7 @@ export default {
chooseAction: "機能を選ぶか、希望する内容を入力してください。",
create: {
agentTitle: "自然言語でエージェントを作成",
+ agentAction: "アシスタントで作成",
agentHint: "利用者と目的を説明してください。アシスタントがリソースを選び、作成します。",
agentPlaceholder: "例:製品ナレッジベースから質問に回答し、出典を示し、不明な点は説明するサポート担当。",
automationTitle: "アシスタントでタスクを作成",
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index b1ab5711d..2f7e76d22 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -2871,6 +2871,7 @@ export default {
chooseAction: "기능을 선택하거나 원하는 작업을 입력하세요.",
create: {
agentTitle: "자연어로 에이전트 만들기",
+ agentAction: "어시스턴트로 만들기",
agentHint: "누구를 위해 어떤 일을 해야 하는지 설명하면 어시스턴트가 리소스를 선택하고 생성합니다.",
agentPlaceholder: "예: 제품 지식 베이스로 질문에 답하고 출처를 제시하며 정보가 없으면 알려주는 고객 지원 에이전트.",
automationTitle: "어시스턴트로 작업 만들기",
@@ -8337,6 +8338,8 @@ export default {
countHint: '현재 폴더 문서 {direct}개, 하위 폴더 포함 {total}개',
filteredCount: '일치하는 문서 {count}개',
title: '폴더',
+ folderSection: '폴더',
+ documentSection: '문서',
rootRow: '루트',
rootRowTip: '지식 베이스 루트 디렉터리, 하위 폴더에 없는 문서가 여기에 있습니다',
folderCardCount: '문서 {count}개',
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 9b73bac98..9da87388c 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -2871,6 +2871,7 @@ export default {
chooseAction: "Выберите действие или опишите свою задачу.",
create: {
agentTitle: "Опишите своего агента",
+ agentAction: "Создать с помощником",
agentHint: "Опишите пользователей и задачи. Помощник подберёт ресурсы и создаст агента.",
agentPlaceholder: "Например: агент поддержки, который отвечает по базе знаний о продукте, указывает источники и сообщает о недостающих данных.",
automationTitle: "Создать задачу с помощником",
@@ -8337,6 +8338,8 @@ export default {
countHint: 'В этой папке: {direct}, с подпапками: {total}',
filteredCount: 'Найдено документов: {count}',
title: 'Папки',
+ folderSection: 'Папки',
+ documentSection: 'Документы',
rootRow: 'Корень',
rootRowTip: 'Корневая папка базы знаний; документы без подпапки находятся здесь',
folderCardCount: 'Документов: {count}',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 09c084a77..23c091012 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -2873,6 +2873,7 @@ export default {
chooseAction: "选择一个功能,或直接输入你的需求。",
create: {
agentTitle: "用自然语言创建智能体",
+ agentAction: "用助手创建",
agentHint: "说说它为谁服务、需要完成什么,助手会帮你选择资源并创建。",
agentPlaceholder: "例如:创建一个产品客服助手,根据产品知识库回答使用问题,回答附上来源,找不到答案时说明原因。",
automationTitle: "用助手创建任务",
@@ -8338,6 +8339,8 @@ export default {
countHint: '当前目录 {direct} 个文档,含子目录共 {total} 个',
filteredCount: '匹配 {count} 个文档',
title: '目录',
+ folderSection: '文件夹',
+ documentSection: '文档',
rootRow: '根目录',
rootRowTip: '知识库根目录,未归入子文件夹的文档在此',
folderCardCount: '{count} 个文档',
diff --git a/frontend/src/i18n/locales/zh-TW.ts b/frontend/src/i18n/locales/zh-TW.ts
index 6df2c0bbc..6e68d831b 100644
--- a/frontend/src/i18n/locales/zh-TW.ts
+++ b/frontend/src/i18n/locales/zh-TW.ts
@@ -2873,6 +2873,7 @@ export default {
chooseAction: "選擇一項功能,或直接輸入你的需求。",
create: {
agentTitle: "用自然語言建立智慧體",
+ agentAction: "用助手建立",
agentHint: "說說它為誰服務、需要完成什麼,助手會協助選擇資源並建立。",
agentPlaceholder: "例如:建立產品客服智慧體,根據產品知識庫回答使用問題,附上來源,找不到答案時說明原因。",
automationTitle: "用助手建立任務",
@@ -8338,6 +8339,8 @@ export default {
countHint: '當前目錄 {direct} 個文件,含子目錄共 {total} 個',
filteredCount: '比對 {count} 個文件',
title: '目錄',
+ folderSection: '資料夾',
+ documentSection: '文件',
rootRow: '根目錄',
rootRowTip: '知識庫根目錄,未歸入子資料夾的文件在此',
folderCardCount: '{count} 個文件',
diff --git a/frontend/src/views/agent/AgentList.test.ts b/frontend/src/views/agent/AgentList.test.ts
index 7d864e886..472284a22 100644
--- a/frontend/src/views/agent/AgentList.test.ts
+++ b/frontend/src/views/agent/AgentList.test.ts
@@ -26,6 +26,7 @@ function setup(t: TestContext) {
'@/composables/useListUrlState': { useListUrlState: () => ({ scope: vue.ref('all'), creator: vue.ref('all'), query: vue.ref('') }) },
'@/composables/useResourcePins': { useResourcePins: () => ({ favorites: vue.ref([]), recents: vue.ref([]) }) },
'@/composables/useAssistantPageContext': { useAssistantPageContext() {} },
+ '@/stores/assistant': { useAssistantStore: () => ({ pageAccess: true }) },
'@/api/agent': {}, '@/api/chat/index': {}, '@/api/organization': {},
'@/config/contextualGuides': { markContextualGuideDone() {} }, '@/config/settingsRoute': {},
'@/utils/resourceListSearch': {}, '@/utils/card-list-badge': {}, '@/utils/resourceSorting': sorting,
@@ -54,6 +55,15 @@ test('refreshes the mounted agent list once per burst, ignoring other areas and
assert.equal(f.fetchAgentsForList.mock.callCount(), 1)
})
+test('the assistant create entry opens its own dialog instead of the editor', async t => {
+ const f = setup(t)
+ await flush()
+ assert.equal(f.vm.assistantCreateVisible, false)
+ f.vm.assistantCreateVisible = true
+ assert.equal(f.vm.assistantCreateVisible, true)
+ assert.equal(f.vm.editorVisible, false)
+})
+
test('the original create entry opens the configuration form directly', async t => {
const f = setup(t)
await flush()
diff --git a/frontend/src/views/agent/AgentList.vue b/frontend/src/views/agent/AgentList.vue
index eb54d2b68..4a37871b3 100644
--- a/frontend/src/views/agent/AgentList.vue
+++ b/frontend/src/views/agent/AgentList.vue
@@ -20,8 +20,16 @@
{{ $t('agent.createAgent') }}
</t-button>
</t-tooltip>
- <AssistantActionButton v-if="authStore.hasRole('contributor')" icon-only
- :label="$t('assistant.create.agentTitle')" :query="$t('assistant.prompts.startAgentCreation')" />
+ <t-tooltip v-if="authStore.hasRole('contributor') && assistantStore.pageAccess"
+ :content="$t('assistant.create.agentHint')" placement="bottom">
+ <t-button variant="text" theme="default" size="small" class="header-action-btn"
+ style="--wails-draggable: no-drag" @click="assistantCreateVisible = true">
+ <template #icon>
+ <ResourceIcon type="assistant" :size="16" />
+ </template>
+ {{ $t('assistant.create.agentAction') }}
+ </t-button>
+ </t-tooltip>
</div>
</div>
<p class="header-subtitle" style="--wails-draggable: drag">{{ $t('agent.subtitle') }}</p>
@@ -589,6 +597,13 @@
</template>
<span>{{ $t('agent.createAgent') }}</span>
</t-button>
+ <t-button v-if="authStore.hasRole('contributor') && assistantStore.pageAccess" variant="outline"
+ class="agent-create-btn" @click="assistantCreateVisible = true">
+ <template #icon>
+ <ResourceIcon type="assistant" :size="16" />
+ </template>
+ {{ $t('assistant.create.agentAction') }}
+ </t-button>
</EmptyState>
<!-- 空状态:收藏 / 最近 — 不放创建按钮,参见 KnowledgeBaseList 的同处理由 -->
@@ -623,6 +638,13 @@
</template>
<span>{{ $t('agent.createAgent') }}</span>
</t-button>
+ <t-button v-if="authStore.hasRole('contributor') && assistantStore.pageAccess" variant="outline"
+ class="agent-create-btn" @click="assistantCreateVisible = true">
+ <template #icon>
+ <ResourceIcon type="assistant" :size="16" />
+ </template>
+ {{ $t('assistant.create.agentAction') }}
+ </t-button>
</EmptyState>
<!-- 空状态:空间下 -->
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceAgentsLoading && spaceAgentsList.length === 0" :title="$t('agent.empty.sharedTitle')"
@@ -698,6 +720,8 @@
</div>
</Transition>
+ <AssistantCreateDialog v-model:visible="assistantCreateVisible" kind="agent" @manual="handleCreateAgent" />
+
<!-- 智能体编辑器弹窗 -->
<AgentEditorModal :visible="editorVisible" :mode="editorMode" :agent="editingAgent"
:initialSection="editorInitialSection"
@@ -728,7 +752,8 @@ import { useSettingsStore } from '@/stores/settings'
import { useMenuStore } from '@/stores/menu'
import type { SharedAgentInfo, OrganizationSharedAgentItem } from '@/api/organization'
import AgentEditorModal from './AgentEditorModal.vue'
-import AssistantActionButton from '@/components/assistant/AssistantActionButton.vue'
+import AssistantCreateDialog from '@/components/assistant/AssistantCreateDialog.vue'
+import { useAssistantStore } from '@/stores/assistant'
import { useAssistantPageContext } from '@/composables/useAssistantPageContext'
import ContextualGuide from '@/components/ContextualGuide.vue'
import TenantModelsGuide from '@/components/TenantModelsGuide.vue'
@@ -756,6 +781,8 @@ const { t } = useI18n()
const route = useRoute()
const router = useRouter()
const authStore = useAuthStore()
+const assistantStore = useAssistantStore()
+const assistantCreateVisible = ref(false)
const uiStore = useUIStore()
const orgStore = useOrganizationStore()
const chatResources = useChatResourcesStore()
@@ -1636,7 +1663,8 @@ watch(keyword, () => { collapsedAgentSections.value = new Set() })
}
:deep(.t-icon),
- :deep(.btn-icon-wrapper) {
+ :deep(.btn-icon-wrapper),
+ :deep(.resource-icon) {
color: var(--td-brand-color);
display: inline-flex;
align-items: center;
diff --git a/frontend/src/views/knowledge/KnowledgeBase.vue b/frontend/src/views/knowledge/KnowledgeBase.vue
index f475a83f2..51d9c9068 100644
--- a/frontend/src/views/knowledge/KnowledgeBase.vue
+++ b/frontend/src/views/knowledge/KnowledgeBase.vue
@@ -850,12 +850,14 @@ const isFiltering = computed(() =>
);
// A row's folder is worth showing only when the list can span folders.
const showDocumentFolderPath = computed(() => hasFolders.value && isFiltering.value);
-// Browsing a folder lists its direct sub-folders as entries, the way a file
-// manager does. Filtering returns matching documents from the whole subtree,
-// so folder entries would be noise there.
-const visibleSubFolders = computed(() =>
- isFiltering.value ? [] : childFolders(folderTree.value, selectedFolderPath.value),
-);
+// Folders belong in the sidebar tree. The document pane only lists them when
+// that tree is collapsed, so navigation still works. Filtering already returns
+// matching documents from the whole subtree, so folder entries would be noise.
+const visibleSubFolders = computed(() => {
+ if (isFiltering.value) return []
+ if (showFolderTree.value && !folderTreeCollapsed.value) return []
+ return childFolders(folderTree.value, selectedFolderPath.value)
+});
const folderBreadcrumbs = computed(() => buildFolderBreadcrumbs(selectedFolderPath.value));
// What the breadcrumb reports is the folder's own contents the way a file
// manager counts them: the documents this list can show plus its direct
@@ -3609,7 +3611,7 @@ const handleKBEditorSuccess = (kbIdValue: string) => {
background: var(--td-bg-color-container);
position: relative;
cursor: pointer;
- transition: border-color var(--app-motion-base) ease, box-shadow var(--app-motion-base) ease, background-color var(--app-motion-base) ease;
+ transition: background-color var(--app-motion-base) ease;
.card-content {
flex: 1;
@@ -3644,8 +3646,7 @@ const handleKBEditorSuccess = (kbIdValue: string) => {
}
.knowledge-card:hover {
- border-color: color-mix(in srgb, var(--td-component-stroke) 55%, var(--td-brand-color));
- box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
+ background: var(--td-bg-color-container-hover);
}
</style>
diff --git a/frontend/src/views/knowledge/KnowledgeBaseFolderCounts.test.ts b/frontend/src/views/knowledge/KnowledgeBaseFolderCounts.test.ts
index 8e66a4eee..00ad41c26 100644
--- a/frontend/src/views/knowledge/KnowledgeBaseFolderCounts.test.ts
+++ b/frontend/src/views/knowledge/KnowledgeBaseFolderCounts.test.ts
@@ -160,6 +160,7 @@ test('filtering keeps the flat result count and adds no folder number', async t
test('the page lists exactly the direct sub-folders of the current folder', async t => {
const f = await setup(t, syncedTree)
+ f.vm.folderTreeCollapsed = true
await selectFolder(f, '天诛渗透攻防')
assert.deepEqual(
f.vm.visibleSubFolders.map((node: { path: string }) => node.path),
@@ -170,6 +171,15 @@ test('the page lists exactly the direct sub-folders of the current folder', asyn
assert.equal(f.vm.visibleSubFolders.length, 5)
})
+test('an open folder tree does not repeat folders in the document pane', async t => {
+ const f = await setup(t, syncedTree)
+ f.vm.folderTreeCollapsed = false
+ await selectFolder(f, '')
+ assert.equal(f.vm.visibleSubFolders.length, 0)
+ await selectFolder(f, '天诛渗透攻防')
+ assert.equal(f.vm.visibleSubFolders.length, 0)
+})
+
test('filtering hides sub-folder entries because it lists matching documents', async t => {
const f = await setup(t, syncedTree)
await selectFolder(f, '天诛渗透攻防')
diff --git a/frontend/src/views/knowledge/components/DocumentCardView.vue b/frontend/src/views/knowledge/components/DocumentCardView.vue
index 92d077940..467334a70 100644
--- a/frontend/src/views/knowledge/components/DocumentCardView.vue
+++ b/frontend/src/views/knowledge/components/DocumentCardView.vue
@@ -49,9 +49,9 @@ const props = defineProps<{
/** Every folder of the knowledge base, for the "move to folder" picker. */
folderOptions?: FolderOption[];
/**
- * Direct sub-folders of the folder being browsed. They lead the grid, the way
- * a file manager shows folders before files. Filtering searches the subtree
- * for documents, so the caller passes an empty list.
+ * Direct sub-folders of the folder being browsed, shown as chips above
+ * the document cards when the sidebar tree is collapsed. Filtering
+ * searches the subtree for documents, so the caller passes an empty list.
*/
subFolders?: FolderEntry[];
/**
@@ -334,35 +334,37 @@ const handleAction = (action: 'download' | 'edit' | 'view-trace' | 'reparse' | '
<template>
<div class="doc-card-view">
-
- <div class="doc-card-list doc-card-list-animated">
- <div
- v-for="folder in subFolderCards"
- :key="`folder:${folder.path}`"
- class="knowledge-card folder-card"
- :data-folder-path="folder.path"
- role="button"
- tabindex="0"
- @click="onOpenFolder(folder.path)"
- @keydown.enter="onOpenFolder(folder.path)"
- >
- <div class="card-content">
- <div class="card-content-nav">
- <div class="card-file-icon folder-card-icon">
- <t-icon name="folder" size="28px" />
- </div>
- <span class="card-content-title folder-card-title" :title="folder.path">{{ folder.name }}</span>
- </div>
- <div class="card-preview">
- <div class="card-content-txt folder-card-count"
+ <section v-if="subFolderCards.length" class="doc-section">
+ <h3 class="doc-section-header">
+ <span>{{ t('knowledgeBase.folderTree.folderSection') }}</span>
+ <span class="doc-section-count">{{ subFolderCards.length }}</span>
+ </h3>
+ <nav class="doc-folder-strip" :aria-label="t('knowledgeBase.folderTree.folderSection')">
+ <button
+ v-for="folder in subFolderCards"
+ :key="`folder:${folder.path}`"
+ type="button"
+ class="doc-folder-tile"
+ :data-folder-path="folder.path"
+ :title="folder.path"
+ @click="onOpenFolder(folder.path)"
+ >
+ <t-icon name="folder" class="doc-folder-tile__icon" size="20px" />
+ <span class="doc-folder-tile__name">{{ folder.name }}</span>
+ <span class="doc-folder-tile__count"
:title="t('knowledgeBase.folderTree.countHint', { direct: folder.document_count, total: folder.total_count })">
- <t-icon name="file" size="12px" />
- <span>{{ t('knowledgeBase.folderTree.folderCardCount', { count: folder.total_count }) }}</span>
- </div>
- </div>
- </div>
- </div>
-
+ {{ t('knowledgeBase.folderTree.folderCardCount', { count: folder.total_count }) }}
+ </span>
+ </button>
+ </nav>
+ </section>
+
+ <section v-if="items.length" class="doc-section">
+ <h3 v-if="subFolderCards.length" class="doc-section-header">
+ <span>{{ t('knowledgeBase.folderTree.documentSection') }}</span>
+ <span class="doc-section-count">{{ items.length }}</span>
+ </h3>
+ <div class="doc-card-list doc-card-list-animated">
<div
class="knowledge-card"
:class="{ 'is-selected': selectedIds.has(item.id), 'batch-mode': batchMode }"
@@ -614,7 +616,8 @@ const handleAction = (action: 'download' | 'edit' | 'view-trace' | 'reparse' | '
<span v-else class="card-time" :title="t('knowledgeBase.columnUpdatedAt')">{{ formatDocTime(item.updated_at) }}</span>
</div>
</div>
- </div>
+ </div>
+ </section>
</div>
<!-- Hover popover -->
@@ -695,6 +698,90 @@ const handleAction = (action: 'download' | 'edit' | 'view-trace' | 'reparse' | '
padding-top: 12px;
}
+.doc-section + .doc-section {
+ margin-top: 16px;
+}
+
+.doc-section-header {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin: 0 0 8px;
+ padding: 0 2px;
+ color: var(--td-text-color-secondary);
+ font-size: var(--app-text-sm);
+ font-weight: 500;
+ line-height: 20px;
+}
+
+.doc-section-count {
+ color: var(--td-text-color-placeholder);
+ font-variant-numeric: tabular-nums;
+}
+
+.doc-folder-strip {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
+ gap: 10px;
+ margin-bottom: 12px;
+}
+
+.doc-folder-tile {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-width: 0;
+ min-height: 48px;
+ padding: 10px 12px;
+ border: 1px solid transparent;
+ border-radius: var(--app-radius-md);
+ background: var(--td-bg-color-secondarycontainer);
+ color: inherit;
+ font: inherit;
+ text-align: left;
+ cursor: pointer;
+ transition: background-color var(--app-motion-base) ease;
+
+ &:hover {
+ background: color-mix(in srgb, var(--td-text-color-primary) 12%, var(--td-bg-color-secondarycontainer));
+ }
+
+ &:hover .doc-folder-tile__icon {
+ color: var(--td-text-color-primary);
+ }
+
+ &:focus-visible {
+ outline: 2px solid var(--app-focus-border);
+ outline-offset: 2px;
+ }
+}
+
+.doc-folder-tile__icon {
+ flex-shrink: 0;
+ color: var(--td-text-color-secondary);
+ transition: color var(--app-motion-base) ease;
+}
+
+.doc-folder-tile__name {
+ min-width: 0;
+ flex: 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: var(--td-text-color-primary);
+ font-size: var(--app-text-md);
+ font-weight: 500;
+ line-height: 22px;
+}
+
+.doc-folder-tile__count {
+ flex-shrink: 0;
+ color: var(--td-text-color-placeholder);
+ font-size: var(--app-text-xs);
+ line-height: 16px;
+ font-variant-numeric: tabular-nums;
+}
+
.doc-card-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
@@ -714,13 +801,14 @@ const handleAction = (action: 'download' | 'edit' | 'view-trace' | 'reparse' | '
border-radius: var(--app-radius-md);
background: var(--td-bg-color-container);
cursor: pointer;
- transition: border-color var(--app-motion-base) ease, box-shadow var(--app-motion-base) ease;
+ transition: background-color var(--app-motion-base) ease;
&:hover {
- border-color: var(--app-selection-border);
- box-shadow: 0 3px 12px rgba(0, 0, 0, 0.035);
+ background: var(--td-bg-color-container-hover);
}
- &.is-selected { border-color: var(--app-selection-border); background: var(--td-bg-color-container); box-shadow: none; }
+ &.is-selected {
+ background: var(--app-selection-bg);
+ }
.card-content { min-width: 0; }
.card-content-nav { display: flex; align-items: flex-start; gap: 7px; height: 36px; margin-bottom: 4px; }
@@ -809,7 +897,7 @@ const handleAction = (action: 'download' | 'edit' | 'view-trace' | 'reparse' | '
line-height: 18px;
}
.card-time { flex-shrink: 0; margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
- .card-tags-anchor { flex: 1; min-width: 0; width: auto; }
+ .card-tags-anchor { flex: 0 1 auto; min-width: 0; width: auto; }
.card-folder {
display: inline-flex;
align-items: center;
@@ -828,24 +916,6 @@ const handleAction = (action: 'download' | 'edit' | 'view-trace' | 'reparse' | '
.t-icon { flex-shrink: 0; }
}
- /* A folder card uses the same shell as a document card, so the grid rhythm
- and the hover treatment stay identical; only its body is folder-specific. */
- &.folder-card {
- .folder-card-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- color: var(--td-warning-color);
- }
- .folder-card-title { cursor: pointer; }
- .folder-card-count {
- display: flex;
- align-items: center;
- gap: 4px;
- color: var(--td-text-color-placeholder);
- .t-icon { flex-shrink: 0; }
- }
- }
}
.card-tags {
@@ -875,10 +945,22 @@ const handleAction = (action: 'download' | 'edit' | 'view-trace' | 'reparse' | '
text-overflow: ellipsis;
cursor: pointer;
&:disabled { cursor: default; }
- &:not(:disabled):hover { color: var(--td-brand-color); border-color: var(--app-selection-border); background: var(--app-selection-bg); }
+ &:not(:disabled):hover { color: var(--td-text-color-primary); border-color: var(--td-component-stroke); background: var(--td-bg-color-container-hover); }
}
.card-tag-chip { display: block; min-width: 0; }
- .card-tag-add { max-width: none; padding: 0; border-color: transparent; color: var(--td-text-color-placeholder); background: transparent; }
+ .card-tag-add {
+ width: auto;
+ max-width: 100%;
+ padding: 0;
+ border-color: transparent;
+ color: var(--td-text-color-placeholder);
+ background: transparent;
+ &:not(:disabled):hover {
+ color: var(--td-text-color-secondary);
+ border-color: transparent;
+ background: transparent;
+ }
+ }
.card-tag-overflow { flex-shrink: 0; }
}
.card-tag-menu-action { width: 100%; border: 0; background: transparent; font-family: inherit; text-align: left; }
diff --git a/frontend/src/views/knowledge/components/DocumentFolderEntries.test.ts b/frontend/src/views/knowledge/components/DocumentFolderEntries.test.ts
index 4abe0b7e1..503747dfd 100644
--- a/frontend/src/views/knowledge/components/DocumentFolderEntries.test.ts
+++ b/frontend/src/views/knowledge/components/DocumentFolderEntries.test.ts
@@ -219,47 +219,60 @@ function mountCards(overrides: Record<string, unknown> = {}) {
})
}
-test('the list renders one folder row before the document rows', () => {
+test('the list renders folder tiles above the document table', () => {
const opened: string[] = []
const view = mountList({ onOpenFolder: (path: string) => opened.push(path) })
try {
- const rows = allElements(view.root).filter((element) => classesOf(element).includes('doc-list-row'))
- const folderRows = rows.filter((row) => row.props['data-folder-path'] !== undefined)
- const documentRows = rows.filter((row) => row.props['data-folder-path'] === undefined)
+ const folderTiles = allElements(view.root).filter((element) => classesOf(element).includes('doc-folder-tile'))
+ const documentRows = allElements(view.root).filter((element) => classesOf(element).includes('doc-list-row'))
- assert.equal(folderRows.length, 1)
+ assert.equal(folderTiles.length, 1)
assert.equal(documentRows.length, 2)
- assert.ok(rows.indexOf(folderRows[0]) < rows.indexOf(documentRows[0]), 'folder row comes first')
- assert.equal(folderRows[0].props['data-folder-path'], folder.path)
- assert.match(textOf(folderRows[0]), /2024使用培训视频/)
- // The folder takes no part in batch selection: its checkbox cell stays empty.
+ assert.equal(folderTiles[0].props['data-folder-path'], folder.path)
+ assert.match(textOf(folderTiles[0]), /2024使用培训视频/)
+ const headings = allElements(view.root).filter((element) => classesOf(element).includes('doc-section-header'))
+ assert.equal(headings.length, 2)
+ assert.match(textOf(headings[0]), /Folders|文件夹/)
+ assert.match(textOf(headings[1]), /Documents|文档/)
assert.equal(
- allElements(folderRows[0]).filter((element) => classesOf(element).includes('doc-list-check')).length,
+ allElements(folderTiles[0]).filter((element) => classesOf(element).includes('doc-list-check')).length,
0,
)
+ assert.equal(
+ documentRows.filter((row) => row.props['data-folder-path'] !== undefined).length,
+ 0,
+ 'folders are not table rows',
+ )
- folderRows[0].props.onClick({ stopPropagation() {} })
+ folderTiles[0].props.onClick({ stopPropagation() {} })
assert.deepEqual(opened, [folder.path])
} finally {
view.unmount()
}
})
-test('the card grid renders one folder card before the document cards', () => {
+test('the card grid renders one folder tile above the document cards', () => {
const opened: string[] = []
const view = mountCards({ onOpenFolder: (path: string) => opened.push(path) })
try {
- const cards = allElements(view.root).filter((element) => classesOf(element).includes('knowledge-card'))
- const folderCards = cards.filter((card) => card.props['data-folder-path'] !== undefined)
- const documentCards = cards.filter((card) => card.props['data-folder-path'] === undefined)
+ const folderTiles = allElements(view.root).filter((element) => classesOf(element).includes('doc-folder-tile'))
+ const documentCards = allElements(view.root).filter((element) => classesOf(element).includes('knowledge-card'))
- assert.equal(folderCards.length, 1)
+ assert.equal(folderTiles.length, 1)
assert.equal(documentCards.length, 2)
- assert.ok(cards.indexOf(folderCards[0]) < cards.indexOf(documentCards[0]), 'folder card comes first')
- assert.equal(folderCards[0].props['data-folder-path'], folder.path)
- assert.match(textOf(folderCards[0]), /2024使用培训视频/)
+ assert.equal(folderTiles[0].props['data-folder-path'], folder.path)
+ assert.match(textOf(folderTiles[0]), /2024使用培训视频/)
+ const headings = allElements(view.root).filter((element) => classesOf(element).includes('doc-section-header'))
+ assert.equal(headings.length, 2)
+ assert.match(textOf(headings[0]), /Folders|文件夹/)
+ assert.match(textOf(headings[1]), /Documents|文档/)
+ assert.equal(
+ allElements(view.root).find((element) => classesOf(element).includes('knowledge-card') && element.props['data-folder-path']),
+ undefined,
+ 'folders are not document cards',
+ )
- folderCards[0].props.onClick({ stopPropagation() {} })
+ folderTiles[0].props.onClick({ stopPropagation() {} })
assert.deepEqual(opened, [folder.path])
} finally {
view.unmount()
@@ -270,17 +283,21 @@ test('no folder rows or cards are rendered when the caller filters them out', ()
const list = mountList({ subFolders: [] })
try {
const rows = allElements(list.root).filter((element) => classesOf(element).includes('doc-list-row'))
+ assert.equal(allElements(list.root).filter((element) => classesOf(element).includes('doc-folder-tile')).length, 0)
assert.equal(rows.filter((row) => row.props['data-folder-path'] !== undefined).length, 0)
assert.equal(rows.length, 2)
+ assert.equal(allElements(list.root).filter((element) => classesOf(element).includes('doc-section-header')).length, 0)
} finally {
list.unmount()
}
const cards = mountCards({ subFolders: [] })
try {
+ const folderTiles = allElements(cards.root).filter((element) => classesOf(element).includes('doc-folder-tile'))
const cardElements = allElements(cards.root).filter((element) => classesOf(element).includes('knowledge-card'))
- assert.equal(cardElements.filter((card) => card.props['data-folder-path'] !== undefined).length, 0)
+ assert.equal(folderTiles.length, 0)
assert.equal(cardElements.length, 2)
+ assert.equal(allElements(cards.root).filter((element) => classesOf(element).includes('doc-section-header')).length, 0)
} finally {
cards.unmount()
}
diff --git a/frontend/src/views/knowledge/components/DocumentListView.vue b/frontend/src/views/knowledge/components/DocumentListView.vue
index a21681689..bb712380f 100644
--- a/frontend/src/views/knowledge/components/DocumentListView.vue
+++ b/frontend/src/views/knowledge/components/DocumentListView.vue
@@ -47,9 +47,9 @@ const props = defineProps<{
/** Every folder of the knowledge base, for the "move to folder" picker. */
folderOptions?: FolderOption[];
/**
- * Direct sub-folders of the folder being browsed. They are listed ahead of
- * the documents, the way a file manager shows folders before files. Filtering
- * searches the subtree for documents, so the caller passes an empty list.
+ * Direct sub-folders of the folder being browsed. They sit in their own
+ * group above the document table. Filtering searches the subtree for
+ * documents, so the caller passes an empty list.
*/
subFolders?: FolderEntry[];
/**
@@ -273,9 +273,39 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
</script>
<template>
- <div class="doc-list-view" :class="{ 'is-loading': loading }" role="table" :aria-label="t('knowledgeEditor.document.title')">
- <div ref="stickySentinel" class="doc-list-sticky-sentinel" aria-hidden="true"></div>
- <div class="doc-list-header" :class="{ 'is-stuck': headerStuck }" role="row">
+ <div class="doc-list-view" :class="{ 'is-loading': loading }">
+ <section v-if="subFolderRows.length" class="doc-section">
+ <h3 class="doc-section-header">
+ <span>{{ t('knowledgeBase.folderTree.folderSection') }}</span>
+ <span class="doc-section-count">{{ subFolderRows.length }}</span>
+ </h3>
+ <nav class="doc-folder-strip" :aria-label="t('knowledgeBase.folderTree.folderSection')">
+ <button
+ v-for="folder in subFolderRows"
+ :key="`folder:${folder.path}`"
+ type="button"
+ class="doc-folder-tile"
+ :data-folder-path="folder.path"
+ :title="folder.path"
+ @click="openFolder(folder)"
+ >
+ <t-icon name="folder" class="doc-folder-tile__icon" size="20px" />
+ <span class="doc-folder-tile__name">{{ folder.name }}</span>
+ <span class="doc-folder-tile__count"
+ :title="t('knowledgeBase.folderTree.countHint', { direct: folder.document_count, total: folder.total_count })">
+ {{ t('knowledgeBase.folderTree.folderCardCount', { count: folder.total_count }) }}
+ </span>
+ </button>
+ </nav>
+ </section>
+
+ <section v-if="items.length" class="doc-section" role="table" :aria-label="t('knowledgeEditor.document.title')">
+ <h3 v-if="subFolderRows.length" class="doc-section-header">
+ <span>{{ t('knowledgeBase.folderTree.documentSection') }}</span>
+ <span class="doc-section-count">{{ items.length }}</span>
+ </h3>
+ <div ref="stickySentinel" class="doc-list-sticky-sentinel" aria-hidden="true"></div>
+ <div class="doc-list-header" :class="{ 'is-stuck': headerStuck }" role="row">
<div class="cell cell-check" role="columnheader" @click.stop>
<t-checkbox v-if="canEdit || canDownload" class="doc-list-check" size="small" :checked="allSelected" :indeterminate="someSelected"
:disabled="!items.length" :title="t('knowledgeBase.selectAll')" @change="onHeaderCheckboxChange" />
@@ -287,28 +317,6 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
</div>
<div class="doc-list-body" role="rowgroup">
- <div v-for="folder in subFolderRows" :key="`folder:${folder.path}`" class="doc-list-row folder-row"
- :data-folder-path="folder.path" role="row" @click="openFolder(folder)">
- <!-- Folders are navigation entries, not documents: no batch checkbox. -->
- <div class="cell cell-check" role="cell"></div>
-
- <div class="cell cell-name" role="cell">
- <span class="folder-row-icon" aria-hidden="true">
- <t-icon name="folder" size="26px" />
- </span>
- <div class="row-file-text">
- <div class="row-title-line">
- <button type="button" class="row-file-name" :title="folder.path"
- @click.stop="openFolder(folder)">{{ folder.name }}</button>
- </div>
- </div>
- </div>
-
- <div class="cell cell-tags" role="cell"></div>
- <div class="cell cell-status" role="cell"></div>
- <div class="cell cell-actions" role="cell"></div>
- </div>
-
<div v-for="item in items" :key="item.id" class="doc-list-row"
:class="{ selected: selectedIds.has(item.id), 'menu-open': moreOpen === item.id }" :data-select-id="item.id"
role="row" @click="emit('open', item)">
@@ -482,6 +490,7 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
</div>
</div>
</div>
+ </section>
</div>
</template>
@@ -502,6 +511,7 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
display: flex;
flex-direction: column;
width: 100%;
+ padding-top: 12px;
background: transparent;
/* 不能用 overflow:hidden,否则表头 position:sticky 相对外层滚动区失效 */
overflow: visible;
@@ -551,6 +561,89 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
padding: 6px 0 72px;
}
+.doc-section + .doc-section {
+ margin-top: 16px;
+}
+
+.doc-section-header {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin: 0 0 8px;
+ padding: 0 2px;
+ color: var(--td-text-color-secondary);
+ font-size: var(--app-text-sm);
+ font-weight: 500;
+ line-height: 20px;
+}
+
+.doc-section-count {
+ color: var(--td-text-color-placeholder);
+ font-variant-numeric: tabular-nums;
+}
+
+.doc-folder-strip {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
+ gap: 10px;
+}
+
+.doc-folder-tile {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-width: 0;
+ min-height: 48px;
+ padding: 10px 12px;
+ border: 1px solid transparent;
+ border-radius: var(--app-radius-md);
+ background: var(--td-bg-color-secondarycontainer);
+ color: inherit;
+ font: inherit;
+ text-align: left;
+ cursor: pointer;
+ transition: background-color var(--app-motion-base) ease;
+
+ &:hover {
+ background: color-mix(in srgb, var(--td-text-color-primary) 12%, var(--td-bg-color-secondarycontainer));
+ }
+
+ &:hover .doc-folder-tile__icon {
+ color: var(--td-text-color-primary);
+ }
+
+ &:focus-visible {
+ outline: 2px solid var(--app-focus-border);
+ outline-offset: 2px;
+ }
+}
+
+.doc-folder-tile__icon {
+ flex-shrink: 0;
+ color: var(--td-text-color-secondary);
+ transition: color var(--app-motion-base) ease;
+}
+
+.doc-folder-tile__name {
+ min-width: 0;
+ flex: 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: var(--td-text-color-primary);
+ font-size: var(--app-text-md);
+ font-weight: 500;
+ line-height: 22px;
+}
+
+.doc-folder-tile__count {
+ flex-shrink: 0;
+ color: var(--td-text-color-placeholder);
+ font-size: var(--app-text-xs);
+ line-height: 16px;
+ font-variant-numeric: tabular-nums;
+}
+
.doc-list-row {
position: relative;
min-height: 68px;
@@ -576,22 +669,6 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
}
}
-/* A folder is an entry in the same grid as a document, so every column stays
- aligned; only the cells a folder has no value for stay empty. */
-.folder-row {
- min-height: 56px;
-}
-
-.folder-row-icon {
- flex: 0 0 32px;
- width: 32px;
- height: 38px;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- color: var(--td-warning-color);
-}
-
.cell {
display: flex;
align-items: center;
@@ -745,7 +822,8 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
&.status-default { color: var(--td-text-color-placeholder); }
}
.row-title-line { display: flex; align-items: center; min-width: 0; }
-.row-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; width: 100%; }
+.row-tag-trigger { display: inline-flex; min-width: 0; max-width: 100%; }
+.row-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.row-tag {
flex: 0 0 auto;
max-width: min(180px, 100%);
@@ -763,7 +841,7 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
white-space: nowrap;
cursor: pointer;
&:disabled { cursor: default; }
- &:not(:disabled):hover { color: var(--td-brand-color); background: var(--td-brand-color-light); }
+ &:not(:disabled):hover { color: var(--td-text-color-primary); background: var(--td-bg-color-container-hover); }
&--overflow { background: transparent; color: var(--td-text-color-placeholder); }
}
.row-tag-add {
@@ -783,9 +861,9 @@ const handleAction = (action: 'download' | 'edit' | 'reparse' | 'cancel-parse' |
transition: color var(--app-motion-fast) ease, border-color var(--app-motion-fast) ease, background var(--app-motion-fast) ease;
&:hover {
- color: var(--td-brand-color);
- border-color: var(--td-brand-color);
- background: var(--td-brand-color-light);
+ color: var(--td-text-color-secondary);
+ border-color: var(--td-component-stroke);
+ background: var(--td-bg-color-container-hover);
}
}
.row-tag-menu-action {
diff --git a/frontend/src/views/knowledge/components/KbFolderTree.test.ts b/frontend/src/views/knowledge/components/KbFolderTree.test.ts
index 12f14bcca..e93f5aab3 100644
--- a/frontend/src/views/knowledge/components/KbFolderTree.test.ts
+++ b/frontend/src/views/knowledge/components/KbFolderTree.test.ts
@@ -23,6 +23,12 @@ test('the rename sentinel cannot collide with the root folder path', () => {
assert.match(tree, /row\.kind === 'folder' && renamingPath\.value === row\.path/)
})
+test('deep folders stop indenting so the name stays visible', () => {
+ assert.match(tree, /--kb-folder-indent-max:\s*4/)
+ assert.match(tree, /min\(var\(--kb-folder-depth/)
+ assert.doesNotMatch(tree, /kb-folder-row__more-placeholder/)
+})
+
test('only real folders expose a rename affordance', () => {
assert.match(tree, /v-if="canEdit && row\.kind === 'folder'"/)
assert.match(tree, /popup-menu-item/)
diff --git a/frontend/src/views/knowledge/components/KbFolderTree.vue b/frontend/src/views/knowledge/components/KbFolderTree.vue
index 4b310458a..a328b5f7d 100644
--- a/frontend/src/views/knowledge/components/KbFolderTree.vue
+++ b/frontend/src/views/knowledge/components/KbFolderTree.vue
@@ -124,7 +124,6 @@
</div>
</template>
</t-popup>
- <span v-else class="kb-folder-row__more-placeholder" aria-hidden="true"></span>
</span>
</template>
</div>
@@ -253,7 +252,10 @@ watch(
<style scoped lang="less">
.kb-folder-tree {
- --kb-folder-indent: 14px;
+ /* Cap indent so a 8–10 level path still has room for the folder name.
+ Past this depth the chevron already shows the parent/child relation. */
+ --kb-folder-indent: 12px;
+ --kb-folder-indent-max: 4;
display: flex;
flex-direction: column;
flex-shrink: 0;
@@ -352,7 +354,7 @@ watch(
width: 100%;
height: 32px;
margin-bottom: 2px;
- padding: 0 4px 0 calc(4px + var(--kb-folder-depth, 0) * var(--kb-folder-indent));
+ padding: 0 4px 0 calc(4px + min(var(--kb-folder-depth, 0), var(--kb-folder-indent-max)) * var(--kb-folder-indent));
border-radius: var(--app-radius-sm);
background: transparent;
color: var(--td-text-color-primary);
@@ -374,13 +376,31 @@ watch(
}
&.active {
+ height: auto;
+ min-height: 32px;
+ align-items: flex-start;
+ padding-top: 6px;
+ padding-bottom: 6px;
background: var(--app-selection-bg);
.kb-folder-row__label,
.kb-folder-row__icon {
color: var(--td-brand-color);
}
- .kb-folder-row__label { font-weight: 500; }
+ .kb-folder-row__label {
+ font-weight: 500;
+ white-space: normal;
+ overflow: visible;
+ text-overflow: unset;
+ overflow-wrap: anywhere;
+ line-height: 18px;
+ }
+ .kb-folder-row__toggle,
+ .kb-folder-row__toggle-placeholder,
+ .kb-folder-row__icon,
+ .kb-folder-row__trailing {
+ margin-top: 1px;
+ }
}
&.is-root .kb-folder-row__label {
@@ -428,12 +448,13 @@ watch(
}
.kb-folder-row__trailing {
+ position: relative;
flex: 0 0 auto;
- gap: 2px;
+ min-width: 16px;
height: 20px;
display: flex;
align-items: center;
- justify-content: center;
+ justify-content: flex-end;
margin-left: 2px;
}
@@ -446,9 +467,10 @@ watch(
line-height: 1;
}
-.kb-folder-row__more-placeholder { width: 20px; }
-
.kb-folder-row__more {
+ position: absolute;
+ right: 0;
+ top: 50%;
display: inline-flex;
opacity: 0;
pointer-events: none;
@@ -457,10 +479,11 @@ watch(
padding: 0;
border: 0;
border-radius: var(--app-radius-xs);
- background: transparent;
+ background: var(--td-bg-color-container);
color: var(--td-text-color-placeholder);
align-items: center;
justify-content: center;
+ transform: translateY(-50%);
cursor: pointer;
transition: color var(--app-motion-fast) ease, background-color var(--app-motion-fast) ease;
@@ -481,6 +504,10 @@ watch(
opacity: 1;
pointer-events: auto;
}
+
+ .kb-folder-row__count {
+ visibility: hidden;
+ }
}
.kb-folder-row__more.is-open {
diff --git a/frontend/src/views/knowledge/components/KnowledgeTagPopover.test.ts b/frontend/src/views/knowledge/components/KnowledgeTagPopover.test.ts
index c6590a3f8..464ac597a 100644
--- a/frontend/src/views/knowledge/components/KnowledgeTagPopover.test.ts
+++ b/frontend/src/views/knowledge/components/KnowledgeTagPopover.test.ts
@@ -73,6 +73,14 @@ async function fixture(fail = false) {
return { state, requests, changes: () => changes, root, find, fire, settle, close: () => app.unmount() }
}
+test('the trigger shrinks to the chip and the panel stays compact', () => {
+ assert.match(source, /class="knowledge-tag-trigger"/)
+ assert.match(source, /width: min\(232px/)
+ assert.match(source, /width: auto/)
+ assert.doesNotMatch(source, /(?<!max-)width: 100%/)
+ assert.doesNotMatch(source, /min\(300px/)
+})
+
test('opening hydrates tags; refreshing the document preserves an open draft; cancel does not save', async t => {
const f = await fixture(); t.after(f.close)
const picker = f.find(el => el.type === 'picker')
diff --git a/frontend/src/views/knowledge/components/KnowledgeTagPopover.vue b/frontend/src/views/knowledge/components/KnowledgeTagPopover.vue
index da58da69f..9c0c00a26 100644
--- a/frontend/src/views/knowledge/components/KnowledgeTagPopover.vue
+++ b/frontend/src/views/knowledge/components/KnowledgeTagPopover.vue
@@ -1,9 +1,11 @@
<template>
<div class="knowledge-tag-anchor" @click.stop @mousedown.stop>
<t-popup :visible="visible" :disabled="disabled" trigger="click" placement="bottom-left" attach="body"
- destroy-on-close overlay-class-name="knowledge-tag-popover" :overlay-inner-style="{ padding: '12px' }"
+ destroy-on-close overlay-class-name="knowledge-tag-popover" :overlay-inner-style="{ padding: '8px' }"
@visible-change="changeVisible">
- <slot />
+ <span class="knowledge-tag-trigger">
+ <slot />
+ </span>
<template #content>
<section v-if="visible" class="tag-popover-panel" :aria-label="$t('knowledgeBase.tagEditDialogHeading')">
<KnowledgeTagPicker :kb-id="kbId" :selected-ids="selectedIds" @update:selected-ids="selectedIds = $event"
@@ -62,12 +64,29 @@ async function save() {
</script>
<style scoped lang="less">
-.knowledge-tag-anchor { min-width: 0; width: 100%; }
-.tag-popover-panel { width: min(300px, calc(100vw - 56px)); }
-.tag-popover-panel :deep(.knowledge-tag-picker) { margin-top: 0; }
-.tag-popover-panel :deep(.tag-picker-list) { max-height: min(240px, 40vh); }
+.knowledge-tag-anchor {
+ display: inline-flex;
+ min-width: 0;
+ max-width: 100%;
+ width: auto;
+}
+.knowledge-tag-trigger {
+ display: inline-flex;
+ min-width: 0;
+ max-width: 100%;
+}
+.knowledge-tag-anchor :deep(.t-popup__reference) {
+ display: inline-flex;
+ width: auto;
+ max-width: 100%;
+}
+.tag-popover-panel { width: min(232px, calc(100vw - 48px)); }
+.tag-popover-panel :deep(.knowledge-tag-picker) { margin-top: 0; gap: 6px; }
+.tag-popover-panel :deep(.tag-picker-list) { max-height: min(160px, 28vh); }
+.tag-popover-panel :deep(.tag-picker-list:has(.tag-picker-empty)) { max-height: none; }
+.tag-popover-panel :deep(.tag-picker-empty) { padding: 6px 2px; }
.tag-popover-footer {
- display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px;
+ display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 8px;
border-top: 1px solid var(--td-component-stroke);
> span { flex: 1; font-size: var(--app-text-sm); color: var(--td-text-color-placeholder); }
}