WeKnora/frontend
linus-liu-web e6dc60be32
fix(knowledge): 文件夹树显示递归文档数,不再把有子目录的文件夹显示成 0 (#4428)
* fix(knowledge): show recursive folder counts in the folder tree

Connector-synced knowledge bases now come with multi-level folders, so a
parent folder often holds no documents of its own while its subtree holds
several. The folder tree, the breadcrumb and the empty state all read
document_count (documents directly in the folder), so those parents rendered
0 and the document list stated "this folder has no documents yet" even though
the documents were one level down. The API was already correct: total_count
carries the recursive number.

- KbFolderTree renders the row's totalCount; the existing tooltip still spells
  out the direct/recursive split.
- KnowledgeBase reports the selected folder's recursive total in the
  breadcrumb. Filtering keeps the flat result count, and a tree that is
  missing or stale falls back to the loaded list total.
- The empty state gains a third branch for folders whose documents all live in
  sub-folders, with a new emptyFolderWithSubfolders message in all six locales.
- folderTree.ts exposes folderDocumentCounts() and shares the node lookup with
  childFolders().

Tests render the tree through Vite SSR (a 0/5 parent and the root row) and
cover the breadcrumb/empty-state computed values plus the template wiring.

* fix(knowledge): count sub-folders beside the breadcrumb document count

The breadcrumb reported the selected folder's recursive document total while
the document list only renders that folder's own documents. A folder holding 2
documents and 1 sub-folder therefore claimed "3 documents" next to a list of 2.
Report the two numbers the page can actually account for, the way the DingTalk
original does: "{documents} documents / {folders} folders".

- The breadcrumb renders a new two-part folderContentsCount message in all six
  locales. Browsing counts the loaded list total (the documents on screen) and
  the folder's direct sub-folders; filtering keeps the flat result count and
  adds no folder number, since it searches documents rather than folders.
- The sub-folder number is childFolders().length: the tree's top-level folders
  at the root, the selected node's children in a folder, and 0 when the tree is
  unavailable or the path is stale.
- The recursive total stays where it is useful: the tree row (totalCount) and
  the empty state, whose folderSubfolderDocumentCount is a different quantity
  (documents below the folder) and is left untouched.

* fix(knowledge): list sub-folders in the document views

Render the current folder's direct sub-folders as rows in the list and as
cards in the grid, ahead of the documents, so browsing matches a file manager
and the DingTalk folder view. Folder entries are navigation only: they carry
no batch checkbox and never enter document selection or sorting.

Filtering still searches the subtree and shows documents only. When the folder
tree is unavailable the views receive an empty list instead of crashing.

Also hide the breadcrumb's folder segment when the folder has no sub-folders
(falling back to the document-only message) and pluralize the folder count in
English and Russian.

* fix(knowledge): use t-icon sizes so the style guard stays at its baseline

The folder row/card icons were sized with literal CSS font-size values,
which the style guard counts against a fixed baseline. Use the t-icon size
attribute instead, as the guard's own guidance asks.

* fix(knowledge): preserve folder list icon size after style guard cleanup

---------

Co-authored-by: linus-liu-web <linus-liu-web@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-17 22:37:58 +08:00
..
public feat(i18n): add Traditional Chinese (zh-TW) locale support (#3916) 2026-10-08 16:18:17 +08:00
scripts feat(browser): add picture-in-picture task preview 2026-09-12 11:11:36 +08:00
src fix(knowledge): 文件夹树显示递归文档数,不再把有子目录的文件夹显示成 0 (#4428) 2026-10-17 22:37:58 +08:00
tests/source-locate fix(chat): locate citations in manual Markdown documents (#4278) 2026-10-14 11:53:58 +08:00
.dockerignore feat(ui): multi-stage Docker frontend build (no host npm) (#3074) 2026-09-07 19:33:57 +08:00
.gitignore init commit 2025-08-05 15:08:07 +08:00
Dockerfile chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
docker-entrypoint.sh feat(i18n): add Traditional Chinese (zh-TW) locale support (#3916) 2026-10-08 16:18:17 +08:00
embed.html feat(embed): add widget, visitor chat, and management UI (#1657) 2026-06-12 23:10:39 +08:00
env.d.ts feat(frontend): inject commit ID into frontend build for version tracking 2026-06-09 18:08:57 +08:00
index.html fix(frontend): bundle tdesign-icons sprite locally for offline deploys 2026-04-23 18:21:49 +08:00
mcpProxy.test.ts fix(mcp): proxy server endpoints through frontend gateways 2026-09-22 17:36:03 +08:00
nginx-api-proxy.conf fix(mcp): proxy server endpoints through frontend gateways 2026-09-22 17:36:03 +08:00
nginx-http.conf feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
nginx.conf docs: 迁移有效文档至 website-docs 并清理旧文档 (#3580) 2026-09-22 23:25:40 +08:00
package-lock.json chore(release): finalize v0.8.3 website and documentation (#4285) 2026-10-14 15:20:30 +08:00
package.json chore(release): finalize v0.8.3 website and documentation (#4285) 2026-10-14 15:20:30 +08:00
package.json.md5 fix: update environment configuration for debugging and logging, enhance SQLite FTS5 table management, and improve API base URL handling 2026-04-11 18:51:16 +08:00
pnpm-workspace.yaml fix(frontend): configure pnpm v11 build approvals in workspace file 2026-05-08 16:34:33 +08:00
tsconfig.app.json fix lint and test failures 2026-07-01 17:31:42 +08:00
tsconfig.json init commit 2025-08-05 15:08:07 +08:00
tsconfig.node.json init commit 2025-08-05 15:08:07 +08:00
vite.config.ts fix(mcp): proxy server endpoints through frontend gateways 2026-09-22 17:36:03 +08:00