feat(knowledge-base): add document batch delete and list view

Add a list-view alongside the existing card grid (issue #957) and
multi-select batch delete (issue #1045) for documents inside a knowledge
base. The two views are toggled from the toolbar and the preference is
persisted in localStorage. Selection state is shared between views with
shift-range support and a sticky batch-action bar.

Backend
- POST /api/v1/knowledge/batch-delete: validates KB scope and editor
  permission, then delegates to the existing DeleteKnowledgeList service
  which already cascades vector/file/graph cleanup. Caps batch size at
  200 and uses a single GetKnowledgeBatch call for membership validation.

Frontend
- DocumentListView: table layout with sticky header, checkbox column
  (with indeterminate select-all), file-type icons, status badges,
  per-row action menu.
- DocumentBatchBar: floating pill bar with selected count and delete
  action; appears when items are selected.
- KnowledgeBase.vue: view-mode toggle, selection state, batch-delete
  confirmation dialog, hover/active checkbox overlay on existing cards.
- Extracted formatFileSize and getFileIcon to utils/files.ts to share
  with the new list view and avoid further drift from the existing
  inline copies.
- i18n keys added for zh-CN, en-US, ko-KR, ru-RU.

Closes #1045
Closes #957
This commit is contained in:
nullkey
2026-04-29 03:24:35 +08:00
committed by lyingbug
parent abd188d344
commit be8e53bf08
11 changed files with 1074 additions and 12 deletions
+23
View File
@@ -215,6 +215,29 @@ export default {
confirmDeleteDocument: 'Подтвердить удаление документа "{fileName}", после удаления восстановление невозможно',
cancel: 'Отмена',
confirmDelete: 'Подтвердить удаление',
viewModeGrid: 'Сетка',
viewModeList: 'Список',
viewModeToggle: 'Переключить вид',
columnName: 'Имя',
columnTag: 'Тег',
columnSize: 'Размер',
columnType: 'Тип',
columnStatus: 'Статус',
columnUpdatedAt: 'Обновлено',
columnActions: 'Действия',
selectAll: 'Выбрать все',
selectedCount: 'Выбрано: {count}',
clearSelection: 'Очистить',
batchDelete: 'Удалить выбранные',
batchDeleteConfirmation: 'Подтверждение пакетного удаления',
confirmBatchDeleteDocument: 'Удалить {count} выбранных документов? Это действие нельзя отменить.',
batchDeleteSuccess: 'Удалено документов: {count}',
batchDeleteFailed: 'Ошибка пакетного удаления',
statusCompleted: 'Завершено',
statusProcessing: 'Обработка',
statusPending: 'Ожидание',
statusFailed: 'Ошибка',
statusDraft: 'Черновик',
selectKnowledgeBaseFirst: 'Пожалуйста, сначала выберите базу знаний',
sessionCreationFailed: 'Не удалось создать диалог',
sessionCreationError: 'Ошибка создания диалога',