🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(resource): path-based category routes, library-style home and a Files category (#18083)
Arvin Xu2b38ac8b8f9b
diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.mdindex 9ba78384c53..e20703964af 100644--- a/.agents/acceptance/probe-mock-patterns.md+++ b/.agents/acceptance/probe-mock-patterns.md@@ -695,6 +695,36 @@ Keep that command session open for the run. Confirm the CDP endpoint, projectprocess path, `app-probe.sh ready`, renderer auth, server auth, and a raw-CDPscreenshot before collecting evidence.+### `acceptance run ingest` is creative — re-running it to re-read its output mints a duplicate round++**Situation:** after a successful ingest, wanting to re-check a field from its JSON+output (evidence count, acceptanceId).++**Doesn't work:** running the same `ingest` command again "just to see the output".+Every invocation creates a new immutable round on the acceptance — the re-run+publishes a byte-identical duplicate round that reviewers then see twice.++**Works:** re-read state with the read-only commands — `acceptance run list`,+`acceptance run get <runId>`, `acceptance view <id> --json`. If a duplicate was+minted by mistake, `acceptance run delete <runId> --yes` (newest timestamp = the+accident) restores the round history; this is data correction of an operator+error, distinct from the forbidden overwrite-a-real-round.++### A backgrounded `init-dev-env.sh dev` looks dead while the server is alive on a dynamic port++**Situation:** starting the dev server from a harness-managed background command in a+worktree, then waiting for readiness.++**Doesn't work:** trusting the background task's captured output (it can stay 0 bytes+while the detached process tree lives on), or polling the default port. Worktrees+allocate dynamic ports, so probing `localhost:3010` waits forever while the server is+already up elsewhere; a retry then fails with "an owned dev server is already running".++**Works:** treat `.records/runtime/` as the source of truth — it records `PID`,+`SERVER_PORT` and `SPA_PORT` for the owned instance. Read the port from there and poll+that. For a long-lived start prefer a detached `screen -dmS <name> … >> .records/logs/x.log`+so the log lands in a stable file; `stop-dev` still stops the recorded PID tree either way.+### Cold SWR cache: clearing then reloading is undone by the outgoing page**Situation:** forcing a first-load / skeleton state for anything backed by the@@ -1100,3 +1130,47 @@ timestamps before suspecting the query.work / Works and evidence for every mechanism claim.- Promote product-independent findings to the generic skill layer rather thanduplicating them here.++### Switching web-session theme for dark-mode evidence needs no UI — next-themes reads `localStorage.theme`++**Situation:** capturing light- and dark-mode evidence in the seeded `agent-browser`+web session (settings UI navigation is slow and the theme control moved between+releases; an earlier round wrongly concluded the web session "cannot switch to+dark").++**Doesn't work:** driving the settings UI to flip appearance, or editing user+settings server-side (the provider is `next-themes` with `defaultTheme="system"` —+the server does not own it).++**Works:** set the next-themes key directly, then reload the target route in the+same session:++```bash+agent-browser --session lobehub-dev eval "localStorage.setItem('theme','dark')"+agent-browser --session lobehub-dev open "$SERVER_URL/<route>" # re-render applies html[data-theme]+```++`'light'` / removal (`localStorage.removeItem('theme')` → back to system) work the+same way. Restore BEFORE stopping the dev server — once the server is down the+document becomes sourceless and `localStorage` access throws SecurityError, so the+override stays behind for the next run. Assert the applied theme via+`document.documentElement.dataset.theme`, not the storage value.++### A reset shell cwd silently retargets git commits at the main repo's checked-out branch++**Situation:** a long worktree-based session where the harness occasionally resets the+shell cwd back to the main repo root (e.g. after a `cd /tmp` in a compound command).++**Doesn't work:** running `git add -A && git commit` (or `bun run check`) without an+explicit `cd` into the worktree. The commands succeed against the MAIN repo — the+commit lands on whatever branch the user has checked out there, staging their+unrelated dirty files, while the intended worktree change stays uncommitted. The+only tell is an unexpected diffstat / parent commit; `push <branch>` then reports+"Everything up-to-date" because the worktree branch ref never moved.++**Works:** in any worktree session, prefix every git/check command with an explicit+`cd <worktree> &&`, and read the commit output's diffstat + `git log -1` parent+before pushing. Recovery for a mistaken main-repo commit: `git reset --mixed HEAD~1`+restores the user's branch and leaves their working tree as it was (verify against+the session-start `gitStatus` snapshot); nothing needs force-pushing because the+wrong-branch push was a no-op.diff --git a/locales/en-US/file.json b/locales/en-US/file.jsonindex 5da051a22ca..ca6370b20ce 100644--- a/locales/en-US/file.json+++ b/locales/en-US/file.json@@ -44,15 +44,11 @@"header.actions.uploadFolder.creatingFolders": "Creating folder structure...","header.newPageButton": "New Page","header.uploadButton": "Upload",- "home.getStarted": "Get Started",- "home.greeting": "Get Started",- "home.quickActions": "Quick Actions",+ "home.libraries": "Libraries","home.recentFiles": "Recent Files","home.recentPages": "Recent Pages",- "home.uploadEntries.files.title": "Upload Files",- "home.uploadEntries.folder.title": "Upload Folder","home.uploadEntries.library.title": "Create New Library",- "home.uploadEntries.newPage.title": "New Page",+ "home.viewAll": "View all","library.hierarchy.empty.desc": "Add files or create a folder to get started","library.hierarchy.empty.title": "Nothing here yet","library.import.action": "Import to workspace…",@@ -232,6 +228,7 @@"tab.artifacts": "Artifacts","tab.audios": "Audio","tab.documents": "Documents",+ "tab.files": "Files","tab.home": "Home","tab.images": "Images","tab.moreTypes": "More Types",diff --git a/locales/zh-CN/file.json b/locales/zh-CN/file.jsonindex 36851e32a64..123bc55cd45 100644--- a/locales/zh-CN/file.json+++ b/locales/zh-CN/file.json@@ -44,15 +44,11 @@"header.actions.uploadFolder.creatingFolders": "正在创建文件夹结构...","header.newPageButton": "新建文稿","header.uploadButton": "上传",- "home.getStarted": "开始使用",- "home.greeting": "开始",- "home.quickActions": "快捷操作",+ "home.libraries": "库","home.recentFiles": "最近文件","home.recentPages": "最近文稿",- "home.uploadEntries.files.title": "上传文件",- "home.uploadEntries.folder.title": "上传文件夹","home.uploadEntries.library.title": "新建资源库",- "home.uploadEntries.newPage.title": "新建文稿",+ "home.viewAll": "查看全部","library.hierarchy.empty.desc": "上传文件或新建文件夹开始整理","library.hierarchy.empty.title": "这里还没有内容","library.import.action": "导入到工作区…",@@ -232,6 +228,7 @@"tab.artifacts": "工件","tab.audios": "语音","tab.documents": "文档",+ "tab.files": "文件","tab.home": "首页","tab.images": "图片","tab.moreTypes": "更多类型",diff --git a/packages/database/src/models/__tests__/file.test.ts b/packages/database/src/models/__tests__/file.test.tsindex 43dbc6d1edd..8eaf8947c40 100644--- a/packages/database/src/models/__tests__/file.test.ts+++ b/packages/database/src/models/__tests__/file.test.ts@@ -1288,12 +1288,9 @@ describe('FileModel', () => {expect(result[0].id).toBe('page-file');});- it('should handle Pages category (should use text/html like Websites)', async () => {- // FilesTabs.Pages is not explicitly handled in switch, falls to default- // which returns empty string, so it won't filter by file type+ it('should handle Pages category (derived pages never live in the files table)', async () => {const result = await fileModel.query({ category: FilesTabs.Pages });- // Should return all files since default case returns empty string- expect(result.length).toBeGreaterThan(0);+ expect(result).toHaveLength(0);});it('should handle unknown file category', async () => {diff --git a/packages/database/src/models/file.ts b/packages/database/src/models/file.tsindex df1586db0c0..dc301108480 100644--- a/packages/database/src/models/file.ts+++ b/packages/database/src/models/file.ts@@ -13,6 +13,7 @@ import {ne,notExists,or,+ sql,sum,} from 'drizzle-orm';import type { PgTransaction } from 'drizzle-orm/pg-core';@@ -35,6 +36,7 @@ import {users,} from '../schemas';import type { LobeChatDatabase, Transaction } from '../type';+import { buildFileCategoryFilter } from '../utils/fileTypeCategory';import { buildWorkspacePayload, buildWorkspaceWhere } from '../utils/workspace';/**@@ -342,15 +344,11 @@ export class FileModel {visibility ? eq(files.visibility, visibility) : undefined,);if (category && category !== FilesTabs.All && category !== FilesTabs.Home) {- const fileTypePrefix = this.getFileTypePrefix(category as FilesTabs);- if (Array.isArray(fileTypePrefix)) {- // For multiple file types (e.g., Documents includes 'application' and 'custom')- whereClause = and(- whereClause,- or(...fileTypePrefix.map((prefix) => ilike(files.fileType, `${prefix}%`))),- );- } else {- whereClause = and(whereClause, ilike(files.fileType, `${fileTypePrefix}%`));+ const categoryFilter = buildFileCategoryFilter(files.fileType, category as FilesTabs);+ if (categoryFilter === 'none') {+ whereClause = and(whereClause, sql`false`);+ } else if (categoryFilter !== 'all') {+ whereClause = and(whereClause, categoryFilter);}}@@ -614,32 +612,6 @@ export class FileModel {);};- /**- * get the corresponding file type prefix according to FilesTabs- */- private getFileTypePrefix = (category: FilesTabs): string | string[] => {- switch (category) {- case FilesTabs.Audios: {- return 'audio';- }- case FilesTabs.Documents: {- return ['application', 'custom'];- }- case FilesTabs.Images: {- return 'image';- }- case FilesTabs.Videos: {- return 'video';- }- case FilesTabs.Websites: {- return 'text/html';- }- default: {- return '';- }- }- };-findByNames = async (fileNames: string[]) =>this.db.query.files.findMany({where: and(or(...fileNames.map((name) => like(files.name, `${name}%`))), this.ownership()),diff --git a/packages/database/src/repositories/knowledge/__tests__/index.test.ts b/packages/database/src/repositories/knowledge/__tests__/index.test.tsindex 7bde90c007a..1cd7d46a9a0 100644--- a/packages/database/src/repositories/knowledge/__tests__/index.test.ts+++ b/packages/database/src/repositories/knowledge/__tests__/index.test.ts@@ -270,18 +270,89 @@ describe('KnowledgeRepo', () => {expect(result.every((item) => item.fileType.startsWith('audio'))).toBe(true);});- it('should filter by category - Documents', async () => {+ it('should filter by category - Documents includes uploaded text/pdf files only', async () => {const result = await knowledgeRepo.query({ category: FilesTabs.Documents });+ const fileTypes = result.map((item) => item.fileType);+ // uploaded text/* and office/pdf files are document files+ expect(fileTypes).toContain('text/plain');+ expect(fileTypes).toContain('application/pdf');+ // derived notes/pages belong to the Pages category, media stays out too+ expect(result.every((item) => item.sourceType === 'file')).toBe(true);expect(result.every((item) =>- item.fileType.startsWith('application') ||- (item.fileType.startsWith('custom') && item.fileType !== 'custom/document'),+ !/^(?:audio|image|video|custom)/.test(item.fileType) &&+ item.fileType !== 'custom/folder',),).toBe(true);});+ it('should filter by category - Pages returns derived notes only', async () => {+ const result = await knowledgeRepo.query({ category: FilesTabs.Pages });++ const fileTypes = result.map((item) => item.fileType);+ // derived notes/pages surface here+ expect(fileTypes).toContain('custom/note');+ // uploaded files (text, pdf, media, raw data) never do+ expect(result.every((item) => item.sourceType === 'document')).toBe(true);+ expect(fileTypes).not.toContain('text/plain');+ expect(fileTypes).not.toContain('application/pdf');+ expect(fileTypes).not.toContain('custom/folder');+ });++ it('should filter by category - Files returns raw data files only', async () => {+ // Document-table rows (agent instructions, derived docs) must never leak+ // into the Files category even when their fileType matches no other bucket.+ await serverDB.insert(documents).values([+ {+ id: 'doc-verify-instruction',+ userId,+ title: 'Verification checklist',+ fileType: 'verify/instruction',+ sourceType: 'agent',+ source: 'internal://verify/doc-verify-instruction',+ totalCharCount: 100,+ totalLineCount: 5,+ },+ ]);+ await serverDB.insert(files).values([+ {+ id: 'file-raw-json',+ userId,+ name: 'data.json',+ fileType: 'application/json',+ size: 100,+ url: 'https://example.com/data.json',+ },+ {+ id: 'file-raw-zip',+ userId,+ name: 'bundle.zip',+ fileType: 'application/zip',+ size: 100,+ url: 'https://example.com/bundle.zip',+ },+ ]);++ const result = await knowledgeRepo.query({ category: FilesTabs.Files });++ const ids = result.map((item) => item.id);+ expect(ids).toContain('file-raw-json');+ expect(ids).toContain('file-raw-zip');+ // documents / media / notes are excluded from the Files category+ expect(+ result.every(+ (item) =>+ !/^(?:audio|image|video|text|custom)/.test(item.fileType) &&+ item.fileType !== 'application/pdf',+ ),+ ).toBe(true);+ // no documents-table rows at all, whatever their fileType+ expect(ids).not.toContain('doc-verify-instruction');+ expect(result.every((item) => item.sourceType === 'file')).toBe(true);+ });+it('should search by query', async () => {const result = await knowledgeRepo.query({ q: 'Search' });@@ -1039,20 +1110,17 @@ describe('KnowledgeRepo', () => {expect(result.every((item) => item.fileType.startsWith('image'))).toBe(true);});- it('should filter KB files by category (Documents) and exclude custom/document', async () => {+ it('should filter KB files by category (Documents) including text files and notes', async () => {const result = await knowledgeRepo.query({knowledgeBaseId: 'kb-filter',category: FilesTabs.Documents,});- // Should include application/* files and custom/* docs- expect(- result.every(- (item) =>- item.fileType.startsWith('application') ||- (item.fileType.startsWith('custom') && item.fileType !== 'custom/document'),- ),- ).toBe(true);+ const ids = result.map((item) => item.id);+ expect(ids).toContain('kb-f-pdf');+ expect(ids).toContain('kb-f-searchable');+ // media stays out of Documents+ expect(result.every((item) => !/^(?:audio|image|video)/.test(item.fileType))).toBe(true);});it('should return KB standalone documents (no fileId) with search', async () => {@@ -1140,13 +1208,43 @@ describe('KnowledgeRepo', () => {url: 'https://example.com/readme.txt',},]);++ // a web clipping saved as an article document plus a plain note that+ // must stay out of the Websites category+ await serverDB.insert(documents).values([+ {+ id: 'article-doc',+ userId,+ title: 'Clipped Article',+ fileType: 'article',+ sourceType: 'web',+ source: 'https://example.com/some-article',+ content: 'clipped content',+ totalCharCount: 15,+ totalLineCount: 1,+ },+ {+ id: 'plain-note',+ userId,+ title: 'Plain Note',+ fileType: 'custom/note',+ sourceType: 'topic',+ source: 'internal://note/plain-note',+ totalCharCount: 10,+ totalLineCount: 1,+ },+ ]);});- it('should filter by category - Websites', async () => {+ it('should filter by category - Websites includes html files and article clippings', async () => {const result = await knowledgeRepo.query({ category: FilesTabs.Websites });expect(result.some((item) => item.id === 'website-file')).toBe(true);- expect(result.every((item) => item.fileType === 'text/html')).toBe(true);+ expect(result.some((item) => item.id === 'article-doc')).toBe(true);+ expect(result.every((item) => item.id !== 'plain-note')).toBe(true);+ expect(+ result.every((item) => item.fileType === 'text/html' || item.fileType === 'article'),+ ).toBe(true);});});diff --git a/packages/database/src/repositories/knowledge/index.test.ts b/packages/database/src/repositories/knowledge/index.test.tsindex c7f663883b4..2ea769469bd 100644--- a/packages/database/src/repositories/knowledge/index.test.ts+++ b/packages/database/src/repositories/knowledge/index.test.ts@@ -126,24 +126,24 @@ describe('KnowledgeRepo', () => {expect(uploadedPdf).toBeUndefined();});- it('should include documents with sourceType="api" in Documents category', async () => {+ it('should exclude document-table rows from Documents category (files only)', async () => {const results = await knowledgeRepo.query({ category: FilesTabs.Documents });- // Should include API PDF (application/pdf with sourceType='api')- const apiPdf = results.find((item) => item.name === 'api-pdf.pdf');- expect(apiPdf).toBeDefined();- expect(apiPdf?.sourceType).toBe('document');- expect(apiPdf?.fileType).toBe('application/pdf');+ // Documents means uploaded document FILES; derived document rows stay out+ expect(results.find((item) => item.name === 'api-pdf.pdf')).toBeUndefined();+ expect(results.find((item) => item.name === 'web-doc.txt')).toBeUndefined();+ expect(results.every((item) => item.sourceType === 'file')).toBe(true);});- it('should include documents with sourceType="web" in Documents category', async () => {- const results = await knowledgeRepo.query({ category: FilesTabs.Documents });+ it('should surface custom/* document rows under the Pages category', async () => {+ const results = await knowledgeRepo.query({ category: FilesTabs.Pages });- // Should include web document (custom/other with sourceType='web')+ // custom/other derived doc belongs to Pagesconst webDoc = results.find((item) => item.name === 'web-doc.txt');expect(webDoc).toBeDefined();expect(webDoc?.sourceType).toBe('document');- expect(webDoc?.fileType).toBe('custom/other');+ // uploaded files never surface under Pages+ expect(results.every((item) => item.sourceType === 'document')).toBe(true);});it('should include files from files table in Documents category', async () => {@@ -180,18 +180,14 @@ describe('KnowledgeRepo', () => {expect(regularFile).toBeDefined();});- it('should apply both filters together in Documents category', async () => {+ it('should keep the Documents category free of document-table rows', async () => {const results = await knowledgeRepo.query({ category: FilesTabs.Documents });- // Count documents with sourceType='document'const documentTypeItems = results.filter((item) => item.sourceType === 'document');+ expect(documentTypeItems).toHaveLength(0);- // Should have exactly 2 documents (api-pdf and web-doc)- // Excluded: uploaded-pdf (sourceType='file') and editor-doc (fileType='custom/document')- expect(documentTypeItems).toHaveLength(2);-- const names = documentTypeItems.map((item) => item.name).sort();- expect(names).toEqual(['api-pdf.pdf', 'web-doc.txt']);+ // the uploaded pdf file from the files table is still there+ expect(results.find((item) => item.name === 'regular-pdf-file.pdf')).toBeDefined();});});diff --git a/packages/database/src/repositories/knowledge/index.ts b/packages/database/src/repositories/knowledge/index.tsindex 99bcdd08fbf..d3437be9713 100644--- a/packages/database/src/repositories/knowledge/index.ts+++ b/packages/database/src/repositories/knowledge/index.ts@@ -6,6 +6,7 @@ import { DocumentModel } from '../../models/document';import { FileModel } from '../../models/file';import { DOCUMENT_FOLDER_TYPE, documents, files, knowledgeBaseFiles, users } from '../../schemas';import type { LobeChatDatabase } from '../../type';+import { buildDocumentCategoryFilter, buildFileCategoryFilter } from '../../utils/fileTypeCategory';import { buildWorkspaceWhere } from '../../utils/workspace';export interface KnowledgeItem {@@ -484,13 +485,11 @@ export class KnowledgeRepo {// Category filterif (category && category !== FilesTabs.All) {- const fileTypePrefix = this.getFileTypePrefix(category as FilesTabs);- if (Array.isArray(fileTypePrefix)) {- // For multiple file types (e.g., Documents includes 'application' and 'custom')- const orConditions = fileTypePrefix.map((prefix) => sql`f.file_type ILIKE ${`${prefix}%`}`);- whereConditions.push(sql`(${sql.join(orConditions, sql` OR `)})`);- } else {- whereConditions.push(sql`f.file_type ILIKE ${`${fileTypePrefix}%`}`);+ const categoryFilter = buildFileCategoryFilter(sql.raw('f.file_type'), category as FilesTabs);+ if (categoryFilter === 'none') {+ whereConditions.push(sql`false`);+ } else if (categoryFilter !== 'all') {+ whereConditions.push(categoryFilter);}}@@ -519,14 +518,14 @@ export class KnowledgeRepo {// Category filterif (category && category !== FilesTabs.All && category !== FilesTabs.Home) {- const fileTypePrefix = this.getFileTypePrefix(category as FilesTabs);- if (Array.isArray(fileTypePrefix)) {- const orConditions = fileTypePrefix.map(- (prefix) => sql`f.file_type ILIKE ${`${prefix}%`}`,- );- kbWhereConditions.push(sql`(${sql.join(orConditions, sql` OR `)})`);- } else {- kbWhereConditions.push(sql`f.file_type ILIKE ${`${fileTypePrefix}%`}`);+ const categoryFilter = buildFileCategoryFilter(+ sql.raw('f.file_type'),+ category as FilesTabs,+ );+ if (categoryFilter === 'none') {+ kbWhereConditions.push(sql`false`);+ } else if (categoryFilter !== 'all') {+ kbWhereConditions.push(categoryFilter);}}@@ -658,23 +657,13 @@ export class KnowledgeRepo {);}- // Category filter - match documents by fileType prefix+ // Category filter — document rows only surface under All and Pages; every+ // file-oriented category (Documents included) excludes the table entirely.if (category && category !== FilesTabs.All) {- const fileTypePrefix = this.getFileTypePrefix(category as FilesTabs);- if (Array.isArray(fileTypePrefix)) {- // For multiple file types (e.g., Documents includes 'application' and 'custom')- const orConditions = fileTypePrefix.map(- (prefix) => sql`${documents.fileType} ILIKE ${`${prefix}%`}`,- );- whereConditions.push(sql`(${sql.join(orConditions, sql` OR `)})`);-- // Exclude custom/document from Documents category- if (category === FilesTabs.Documents) {- whereConditions.push(sql`${documents.fileType} != ${'custom/document'}`);- }- } else if (fileTypePrefix) {- whereConditions.push(sql`${documents.fileType} ILIKE ${`${fileTypePrefix}%`}`);- } else {+ const categoryFilter = buildDocumentCategoryFilter(documents.fileType, category as FilesTabs);+ if (categoryFilter !== 'all' && categoryFilter !== 'none') {+ whereConditions.push(categoryFilter);+ } else if (categoryFilter === 'none') {// Exclude documents from other categories (Images, Videos, Audios, Websites)return sql`SELECT@@ -735,25 +724,15 @@ export class KnowledgeRepo {kbWhereConditions.push(sql`(d.visibility = 'public' OR d.visibility IS NULL)`);}- // Category filter+ // Category filter (document rows only surface under All / Pages — see above)if (category && category !== FilesTabs.All) {- const fileTypePrefix = this.getFileTypePrefix(category as FilesTabs);- if (Array.isArray(fileTypePrefix)) {- const orConditions = fileTypePrefix.map(- (prefix) => sql`d.file_type ILIKE ${`${prefix}%`}`,- );- kbWhereConditions.push(sql`(${sql.join(orConditions, sql` OR `)})`);-- // Exclude custom/document and source_type='file' from Documents category- if (category === FilesTabs.Documents) {- kbWhereConditions.push(- sql`d.file_type != ${'custom/document'}`,- sql`d.source_type != ${'file'}`,- );- }- } else if (fileTypePrefix) {- kbWhereConditions.push(sql`d.file_type ILIKE ${`${fileTypePrefix}%`}`);- } else {+ const categoryFilter = buildDocumentCategoryFilter(+ sql.raw('d.file_type'),+ category as FilesTabs,+ );+ if (categoryFilter !== 'all' && categoryFilter !== 'none') {+ kbWhereConditions.push(categoryFilter);+ } else if (categoryFilter === 'none') {// Exclude documents from other categories (Images, Videos, Audios, Websites).// Keep the NULL placeholder column set aligned with the other UNION// branches so PostgreSQL doesn't complain about mismatched arity.@@ -871,27 +850,4 @@ export class KnowledgeRepo {return sql.raw('created_at DESC');}-- private getFileTypePrefix(category: FilesTabs): string | string[] {- switch (category) {- case FilesTabs.Audios: {- return 'audio';- }- case FilesTabs.Documents: {- return ['application', 'custom'];- }- case FilesTabs.Images: {- return 'image';- }- case FilesTabs.Videos: {- return 'video';- }- case FilesTabs.Websites: {- return 'text/html';- }- default: {- return '';- }- }- }}diff --git a/packages/database/src/utils/fileTypeCategory.ts b/packages/database/src/utils/fileTypeCategory.tsnew file mode 100644index 00000000000..c0e008bb397--- /dev/null+++ b/packages/database/src/utils/fileTypeCategory.ts@@ -0,0 +1,125 @@+import { FilesTabs } from '@lobechat/types';+import type { SQL, SQLWrapper } from 'drizzle-orm';+import { sql } from 'drizzle-orm';++/**+ * `application/*` MIME prefixes that are human-readable documents rather than+ * raw data files. Everything else under `application/*` (json, zip,+ * octet-stream, …) belongs to the Files category.+ */+const DOCUMENT_APPLICATION_PREFIXES = [+ 'application/epub',+ 'application/msword',+ 'application/pdf',+ 'application/rtf',+ 'application/vnd.apple.keynote',+ 'application/vnd.apple.numbers',+ 'application/vnd.apple.pages',+ 'application/vnd.ms-excel',+ 'application/vnd.ms-powerpoint',+ 'application/vnd.oasis.opendocument',+ 'application/vnd.openxmlformats-officedocument',+];++const MEDIA_PREFIXES = ['audio', 'image', 'video'];++/**+ * Category filter outcome for one storage table:+ * - a SQL condition to apply,+ * - `'all'` — the category does not constrain this table (no condition),+ * - `'none'` — the category can never match rows of this table.+ */+export type CategoryFilterResult = SQL | 'all' | 'none';++/**+ * Uploaded document files: any `text/*` file plus office / pdf style+ * `application/*` types. Derived pages/notes are NOT documents — they live in+ * the documents table and belong to the Pages category.+ */+const documentFileCondition = (column: SQLWrapper): SQL => {+ const orConditions = [+ sql`${column} ILIKE ${'text/%'}`,+ ...DOCUMENT_APPLICATION_PREFIXES.map((prefix) => sql`${column} ILIKE ${`${prefix}%`}`),+ ];+ return sql`(${sql.join(orConditions, sql` OR `)})`;+};++/**+ * Raw data files: everything that is not media, not a document and not a+ * synthetic `custom/*` row (folders, pages).+ */+const rawFileCondition = (column: SQLWrapper): SQL => {+ const andConditions = [+ sql`NOT ${documentFileCondition(column)}`,+ ...MEDIA_PREFIXES.map((prefix) => sql`${column} NOT ILIKE ${`${prefix}%`}`),+ sql`${column} NOT ILIKE ${'custom/%'}`,+ ];+ return sql`(${sql.join(andConditions, sql` AND `)})`;+};++/**+ * Category filter for the `files` table (uploaded files).+ *+ * `column` is the `file_type` column to match against — either a drizzle+ * column or a raw aliased reference (e.g. `sql.raw('f.file_type')`).+ */+export const buildFileCategoryFilter = (+ column: SQLWrapper,+ category: FilesTabs,+): CategoryFilterResult => {+ switch (category) {+ case FilesTabs.Audios: {+ return sql`${column} ILIKE ${'audio%'}`;+ }+ case FilesTabs.Documents: {+ return documentFileCondition(column);+ }+ case FilesTabs.Files: {+ return rawFileCondition(column);+ }+ case FilesTabs.Images: {+ return sql`${column} ILIKE ${'image%'}`;+ }+ case FilesTabs.Pages: {+ // Pages are derived documents; uploaded files never qualify.+ return 'none';+ }+ case FilesTabs.Videos: {+ return sql`${column} ILIKE ${'video%'}`;+ }+ case FilesTabs.Websites: {+ return sql`${column} ILIKE ${'text/html%'}`;+ }+ default: {+ return 'all';+ }+ }+};++/**+ * Category filter for the `documents` table (derived pages / notes).+ *+ * Only the Pages category (and the unconstrained All view) surfaces document+ * rows; every file-oriented category excludes the table entirely.+ */+export const buildDocumentCategoryFilter = (+ column: SQLWrapper,+ category: FilesTabs,+): CategoryFilterResult => {+ switch (category) {+ case FilesTabs.All:+ case FilesTabs.Home: {+ return 'all';+ }+ case FilesTabs.Pages: {+ return sql`(${column} ILIKE ${'custom/%'} AND ${column} != ${'custom/folder'})`;+ }+ case FilesTabs.Websites: {+ // web clippings: article documents plus raw html captures+ return sql`(${column} = ${'article'} OR ${column} ILIKE ${'text/html%'})`;+ }+ default: {+ return 'none';+ }+ }+};diff --git a/packages/locales/src/default/file.ts b/packages/locales/src/default/file.tsindex 60bbc9a9e2a..ec9a124ca8e 100644--- a/packages/locales/src/default/file.ts+++ b/packages/locales/src/default/file.ts@@ -50,15 +50,11 @@ export default {'header.newPageButton': 'New Page','header.uploadButton': 'Upload','listView.uploadedBy': 'Uploaded by {{name}}',- 'home.getStarted': 'Get Started',- 'home.greeting': 'Get Started',- 'home.quickActions': 'Quick Actions',+ 'home.libraries': 'Libraries','home.recentFiles': 'Recent Files','home.recentPages': 'Recent Pages',- 'home.uploadEntries.files.title': 'Upload Files',- 'home.uploadEntries.folder.title': 'Upload Folder','home.uploadEntries.library.title': 'Create New Library',- 'home.uploadEntries.newPage.title': 'New Page',+ 'home.viewAll': 'View all','library.hierarchy.empty.desc': 'Add files or create a folder to get started','library.hierarchy.empty.title': 'Nothing here yet','library.import.action': 'Import to workspace…',@@ -265,6 +261,7 @@ export default {'tab.artifacts': 'Artifacts','tab.audios': 'Audio','tab.documents': 'Documents',+ 'tab.files': 'Files','tab.home': 'Home','tab.images': 'Images','tab.moreTypes': 'More Types',diff --git a/packages/types/src/files/index.ts b/packages/types/src/files/index.tsindex 31d26db2556..e3f7a4cb3d9 100644--- a/packages/types/src/files/index.ts+++ b/packages/types/src/files/index.ts@@ -2,6 +2,11 @@ export enum FilesTabs {All = 'all',Audios = 'audios',Documents = 'documents',+ /**+ * Raw data files that are neither media nor human-readable documents,+ * e.g. json / zip / octet-stream uploads.+ */+ Files = 'files',Home = 'home',Images = 'images',Pages = 'pages',diff --git a/src/features/ResourceHome/Home/FrequentLibraries.tsx b/src/features/ResourceHome/Home/FrequentLibraries.tsxnew file mode 100644index 00000000000..a743740c25a--- /dev/null+++ b/src/features/ResourceHome/Home/FrequentLibraries.tsx@@ -0,0 +1,158 @@+'use client';++import { Flexbox, Icon } from '@lobehub/ui';+import { Skeleton } from 'antd';+import { createStaticStyles } from 'antd-style';+import { PlusIcon } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import LibIcon from '@/components/LibIcon';+import { useCreateNewModal } from '@/features/LibraryModal';+import { useResourceManagerStore } from '@/features/ResourceManager/store';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { usePermission } from '@/hooks/usePermission';+import { useKnowledgeBaseStore } from '@/store/library';++const styles = createStaticStyles(({ css, cssVar }) => ({+ chip: css`+ cursor: pointer;++ display: flex;+ gap: 10px;+ align-items: center;++ min-width: 0;+ padding-block: 14px;+ padding-inline: 16px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};++ text-align: start;++ background: ${cssVar.colorFillQuaternary};++ transition: all 0.2s ${cssVar.motionEaseInOut};++ &:hover {+ border-color: ${cssVar.colorBorder};+ background: ${cssVar.colorFillTertiary};+ }+ `,+ createChip: css`+ cursor: pointer;++ display: flex;+ gap: 8px;+ align-items: center;+ justify-content: center;++ padding-block: 14px;+ padding-inline: 16px;+ border: 1px dashed ${cssVar.colorBorder};+ border-radius: ${cssVar.borderRadiusLG};++ color: ${cssVar.colorTextSecondary};++ background: transparent;++ transition: all 0.2s ${cssVar.motionEaseInOut};++ &:hover {+ border-color: ${cssVar.colorTextQuaternary};+ color: ${cssVar.colorText};+ }++ &:disabled {+ cursor: not-allowed;+ opacity: 0.5;+ }+ `,+ grid: css`+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));+ gap: 12px;+ `,+ name: css`+ overflow: hidden;++ font-size: 13px;+ font-weight: 500;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+}));++/** How many libraries the quick-access row shows before "all" lives in the sidebar. */+const MAX_FREQUENT_LIBRARIES = 7;++/**+ * Quick access to the user's libraries, sitting right under the greeting —+ * the everyday entry point of the library home.+ */+const FrequentLibraries = memo(() => {+ const { t } = useTranslation('file');+ const navigate = useWorkspaceAwareNavigate();+ const { allowed: canCreate } = usePermission('create_content');++ const listVisibility = useResourceManagerStore((s) => s.listVisibility);+ const visibility = listVisibility === 'private' ? ('private' as const) : ('public' as const);++ const useFetchKnowledgeBaseList = useKnowledgeBaseStore((s) => s.useFetchKnowledgeBaseList);+ const { data, isLoading } = useFetchKnowledgeBaseList(visibility);++ const setLibraryId = useResourceManagerStore((s) => s.setLibraryId);+ const { open: openCreateLibrary } = useCreateNewModal();++ const handleCreate = () => {+ if (!canCreate) return;+ openCreateLibrary({+ onSuccess: (id) => {+ navigate(`/resource/library/${id}`);+ },+ });+ };++ return (+ <Flexbox gap={12}>+ {isLoading ? (+ <div className={styles.grid}>+ {Array.from({ length: 4 }, (_, index) => (+ <Skeleton.Node active key={index} style={{ height: 52, width: '100%' }} />+ ))}+ </div>+ ) : (+ <div className={styles.grid}>+ {data?.slice(0, MAX_FREQUENT_LIBRARIES).map((item) => (+ <button+ className={styles.chip}+ key={item.id}+ type={'button'}+ onClick={() => {+ setLibraryId(item.id);+ navigate(`/resource/library/${item.id}`);+ }}+ >+ <LibIcon size={18} />+ <span className={styles.name}>{item.name}</span>+ </button>+ ))}+ <button+ className={styles.createChip}+ disabled={!canCreate}+ type={'button'}+ onClick={handleCreate}+ >+ <Icon icon={PlusIcon} size={16} />+ {t('home.uploadEntries.library.title')}+ </button>+ </div>+ )}+ </Flexbox>+ );+});++FrequentLibraries.displayName = 'FrequentLibraries';++export default FrequentLibraries;diff --git a/src/features/ResourceHome/Home/Libraries.tsx b/src/features/ResourceHome/Home/Libraries.tsxnew file mode 100644index 00000000000..2dd161dcbf8--- /dev/null+++ b/src/features/ResourceHome/Home/Libraries.tsx@@ -0,0 +1,163 @@+'use client';++import { Flexbox, Icon } from '@lobehub/ui';+import { Skeleton } from 'antd';+import { createStaticStyles } from 'antd-style';+import { PlusIcon } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import LibIcon from '@/components/LibIcon';+import { useCreateNewModal } from '@/features/LibraryModal';+import { useResourceManagerStore } from '@/features/ResourceManager/store';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { usePermission } from '@/hooks/usePermission';+import { useKnowledgeBaseStore } from '@/store/library';++import SectionTitle from './SectionTitle';++const styles = createStaticStyles(({ css, cssVar }) => ({+ card: css`+ cursor: pointer;++ display: flex;+ flex-direction: column;+ gap: 8px;++ padding: 16px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};++ text-align: start;++ background: ${cssVar.colorBgContainer};++ transition: all 0.2s ${cssVar.motionEaseInOut};++ &:hover {+ border-color: ${cssVar.colorBorder};+ box-shadow: ${cssVar.boxShadowTertiary};+ }+ `,+ createCard: css`+ cursor: pointer;++ display: flex;+ gap: 8px;+ align-items: center;+ justify-content: center;++ min-height: 88px;+ border: 1px dashed ${cssVar.colorBorder};+ border-radius: ${cssVar.borderRadiusLG};++ color: ${cssVar.colorTextSecondary};++ background: transparent;++ transition: all 0.2s ${cssVar.motionEaseInOut};++ &:hover {+ border-color: ${cssVar.colorTextQuaternary};+ color: ${cssVar.colorText};+ }++ &:disabled {+ cursor: not-allowed;+ opacity: 0.5;+ }+ `,+ description: css`+ overflow: hidden;+ display: -webkit-box;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 2;++ font-size: 12px;+ color: ${cssVar.colorTextSecondary};+ `,+ grid: css`+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));+ gap: 12px;+ `,+ name: css`+ overflow: hidden;++ font-size: 13px;+ font-weight: 500;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+}));++const Libraries = memo(() => {+ const { t } = useTranslation('file');+ const navigate = useWorkspaceAwareNavigate();+ const { allowed: canCreate } = usePermission('create_content');++ const listVisibility = useResourceManagerStore((s) => s.listVisibility);+ const visibility = listVisibility === 'private' ? ('private' as const) : ('public' as const);++ const useFetchKnowledgeBaseList = useKnowledgeBaseStore((s) => s.useFetchKnowledgeBaseList);+ const { data, isLoading } = useFetchKnowledgeBaseList(visibility);++ const setLibraryId = useResourceManagerStore((s) => s.setLibraryId);+ const { open: openCreateLibrary } = useCreateNewModal();++ const handleCreate = () => {+ if (!canCreate) return;+ openCreateLibrary({+ onSuccess: (id) => {+ navigate(`/resource/library/${id}`);+ },+ });+ };++ return (+ <Flexbox gap={12}>+ <SectionTitle title={t('home.libraries')} />+ {isLoading ? (+ <div className={styles.grid}>+ {Array.from({ length: 3 }, (_, index) => (+ <Skeleton.Node active key={index} style={{ height: 88, width: '100%' }} />+ ))}+ </div>+ ) : (+ <div className={styles.grid}>+ {data?.map((item) => (+ <button+ className={styles.card}+ key={item.id}+ type={'button'}+ onClick={() => {+ setLibraryId(item.id);+ navigate(`/resource/library/${item.id}`);+ }}+ >+ <Flexbox horizontal align={'center'} gap={8}>+ <LibIcon size={18} />+ <span className={styles.name}>{item.name}</span>+ </Flexbox>+ {item.description && <span className={styles.description}>{item.description}</span>}+ </button>+ ))}+ <button+ className={styles.createCard}+ disabled={!canCreate}+ type={'button'}+ onClick={handleCreate}+ >+ <Icon icon={PlusIcon} size={16} />+ {t('home.uploadEntries.library.title')}+ </button>+ </div>+ )}+ </Flexbox>+ );+});++Libraries.displayName = 'Libraries';++export default Libraries;diff --git a/src/features/ResourceHome/Home/RecentFiles.tsx b/src/features/ResourceHome/Home/RecentFiles.tsxnew file mode 100644index 00000000000..605032dc772--- /dev/null+++ b/src/features/ResourceHome/Home/RecentFiles.tsx@@ -0,0 +1,132 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { Skeleton } from 'antd';+import { createStaticStyles } from 'antd-style';+import dayjs from 'dayjs';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import FileIcon from '@/components/FileIcon';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { useClientDataSWR } from '@/libs/swr';+import { fileService } from '@/services/file';+import { FilesTabs } from '@/types/files';++import SectionTitle from './SectionTitle';++const styles = createStaticStyles(({ css, cssVar }) => ({+ card: css`+ cursor: pointer;++ overflow: hidden;+ display: flex;+ flex-direction: column;++ padding: 0;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};++ text-align: start;++ background: ${cssVar.colorBgContainer};++ transition: all 0.2s ${cssVar.motionEaseInOut};++ &:hover {+ border-color: ${cssVar.colorBorder};+ box-shadow: ${cssVar.boxShadowTertiary};+ }+ `,+ grid: css`+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));+ gap: 12px;+ `,+ meta: css`+ font-size: 12px;+ color: ${cssVar.colorTextQuaternary};+ `,+ name: css`+ overflow: hidden;++ font-size: 13px;+ font-weight: 500;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ preview: css`+ display: flex;+ align-items: center;+ justify-content: center;++ aspect-ratio: 16 / 10;+ width: 100%;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};++ background: ${cssVar.colorFillQuaternary};+ `,+ thumbnail: css`+ width: 100%;+ height: 100%;+ object-fit: cover;+ `,+}));++const formatTime = (date: Date | string) =>+ dayjs().diff(dayjs(date), 'd') < 7 ? dayjs(date).fromNow() : dayjs(date).format('YYYY-MM-DD');++const RecentFiles = memo(() => {+ const { t } = useTranslation('file');+ const navigate = useWorkspaceAwareNavigate();++ const { data, isLoading } = useClientDataSWR('resource-home-recent-files', () =>+ fileService.getRecentFiles(8),+ );++ if (!isLoading && !data?.length) return null;++ return (+ <Flexbox gap={12}>+ <SectionTitle title={t('home.recentFiles')} viewAllUrl={`/resource/${FilesTabs.All}`} />+ {isLoading ? (+ <div className={styles.grid}>+ {Array.from({ length: 4 }, (_, index) => (+ <Skeleton.Node active key={index} style={{ height: 160, width: '100%' }} />+ ))}+ </div>+ ) : (+ <div className={styles.grid}>+ {data!.map((item) => {+ const isImage = item.fileType?.startsWith('image');+ return (+ <button+ className={styles.card}+ key={item.id}+ type={'button'}+ onClick={() => navigate(`/resource?file=${item.id}`)}+ >+ <div className={styles.preview}>+ {isImage && item.url ? (+ <img alt={item.name} className={styles.thumbnail} src={item.url} />+ ) : (+ <FileIcon fileName={item.name} fileType={item.fileType} size={40} />+ )}+ </div>+ <Flexbox gap={4} padding={12}>+ <span className={styles.name}>{item.name}</span>+ <span className={styles.meta}>{formatTime(item.createdAt)}</span>+ </Flexbox>+ </button>+ );+ })}+ </div>+ )}+ </Flexbox>+ );+});++RecentFiles.displayName = 'RecentFiles';++export default RecentFiles;diff --git a/src/features/ResourceHome/Home/RecentPages.tsx b/src/features/ResourceHome/Home/RecentPages.tsxnew file mode 100644index 00000000000..ae720817ba8--- /dev/null+++ b/src/features/ResourceHome/Home/RecentPages.tsx@@ -0,0 +1,118 @@+'use client';++import { Flexbox, Icon } from '@lobehub/ui';+import { Skeleton } from 'antd';+import { createStaticStyles } from 'antd-style';+import dayjs from 'dayjs';+import { FileTextIcon } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { useClientDataSWR } from '@/libs/swr';+import { fileService } from '@/services/file';++import SectionTitle from './SectionTitle';++const styles = createStaticStyles(({ css, cssVar }) => ({+ card: css`+ cursor: pointer;++ display: flex;+ gap: 12px;+ align-items: center;++ padding-block: 12px;+ padding-inline: 16px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};++ text-align: start;++ background: ${cssVar.colorBgContainer};++ transition: all 0.2s ${cssVar.motionEaseInOut};++ &:hover {+ border-color: ${cssVar.colorBorder};+ box-shadow: ${cssVar.boxShadowTertiary};+ }+ `,+ emoji: css`+ font-size: 20px;+ line-height: 1;+ `,+ grid: css`+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));+ gap: 12px;+ `,+ meta: css`+ font-size: 12px;+ color: ${cssVar.colorTextQuaternary};+ `,+ title: css`+ overflow: hidden;++ font-size: 13px;+ font-weight: 500;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+}));++const formatTime = (date: Date | string) =>+ dayjs().diff(dayjs(date), 'd') < 7 ? dayjs(date).fromNow() : dayjs(date).format('YYYY-MM-DD');++const RecentPages = memo(() => {+ const { t } = useTranslation('file');+ const navigate = useWorkspaceAwareNavigate();++ const { data, isLoading } = useClientDataSWR('resource-home-recent-pages', () =>+ fileService.getRecentPages(6),+ );++ if (!isLoading && !data?.length) return null;++ return (+ <Flexbox gap={12}>+ <SectionTitle title={t('home.recentPages')} viewAllUrl={'/resource/page'} />+ {isLoading ? (+ <div className={styles.grid}>+ {Array.from({ length: 3 }, (_, index) => (+ <Skeleton.Node active key={index} style={{ height: 64, width: '100%' }} />+ ))}+ </div>+ ) : (+ <div className={styles.grid}>+ {data!.map((item) => {+ const emoji = (item.metadata as { emoji?: string } | null)?.emoji;+ return (+ <button+ className={styles.card}+ key={item.id}+ type={'button'}+ onClick={() => navigate(`/resource?file=${item.id}`)}+ >+ {emoji ? (+ <span className={styles.emoji}>{emoji}</span>+ ) : (+ <Icon icon={FileTextIcon} size={20} />+ )}+ <Flexbox gap={2} style={{ minWidth: 0 }}>+ <span className={styles.title}>{item.name}</span>+ <span className={styles.meta}>{formatTime(item.updatedAt)}</span>+ </Flexbox>+ </button>+ );+ })}+ </div>+ )}+ </Flexbox>+ );+});++RecentPages.displayName = 'RecentPages';++export default RecentPages;diff --git a/src/features/ResourceHome/Home/RecentWorks.tsx b/src/features/ResourceHome/Home/RecentWorks.tsxnew file mode 100644index 00000000000..2bd257c48cc--- /dev/null+++ b/src/features/ResourceHome/Home/RecentWorks.tsx@@ -0,0 +1,57 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { Skeleton } from 'antd';+import { createStaticStyles } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { useWorkspaceWorksInfinite } from '@/features/WorkGallery/hooks';+import { useOpenWork } from '@/features/WorkGallery/useOpenWork';+import WorkPreviewCard from '@/features/WorkGallery/WorkPreviewCard';++import SectionTitle from './SectionTitle';++const styles = createStaticStyles(({ css }) => ({+ grid: css`+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));+ gap: 12px;+ `,+}));++/** The dashboard shows only the freshest works; the full gallery lives at /resource/works. */+const MAX_RECENT_WORKS = 3;++const RecentWorks = memo(() => {+ const { t } = useTranslation('file');+ const openWork = useOpenWork();++ const { items, isLoadingInitial } = useWorkspaceWorksInfinite('all');+ const recent = items.slice(0, MAX_RECENT_WORKS);++ if (!isLoadingInitial && recent.length === 0) return null;++ return (+ <Flexbox gap={12}>+ <SectionTitle title={t('work.group')} viewAllUrl={'/resource/works'} />+ {isLoadingInitial ? (+ <div className={styles.grid}>+ {Array.from({ length: 3 }, (_, index) => (+ <Skeleton.Node active key={index} style={{ height: 220, width: '100%' }} />+ ))}+ </div>+ ) : (+ <div className={styles.grid}>+ {recent.map((item) => (+ <WorkPreviewCard item={item} key={item.id} onOpen={openWork} />+ ))}+ </div>+ )}+ </Flexbox>+ );+});++RecentWorks.displayName = 'RecentWorks';++export default RecentWorks;diff --git a/src/features/ResourceHome/Home/SectionTitle.tsx b/src/features/ResourceHome/Home/SectionTitle.tsxnew file mode 100644index 00000000000..9e12bd4bb86--- /dev/null+++ b/src/features/ResourceHome/Home/SectionTitle.tsx@@ -0,0 +1,57 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';++const styles = createStaticStyles(({ css, cssVar }) => ({+ title: css`+ margin: 0;+ font-size: 15px;+ font-weight: 600;+ color: ${cssVar.colorText};+ `,+ viewAll: css`+ cursor: pointer;++ border: none;++ font-size: 13px;+ color: ${cssVar.colorTextSecondary};++ background: none;++ &:hover {+ color: ${cssVar.colorText};+ }+ `,+}));++interface SectionTitleProps {+ title: string;+ /** Target path of the "view all" affordance; omitted when there is no fuller view. */+ viewAllUrl?: string;+}++const SectionTitle = memo<SectionTitleProps>(({ title, viewAllUrl }) => {+ const { t } = useTranslation('file');+ const navigate = useWorkspaceAwareNavigate();++ return (+ <Flexbox horizontal align={'center'} justify={'space-between'}>+ <h2 className={styles.title}>{title}</h2>+ {viewAllUrl && (+ <button className={styles.viewAll} type={'button'} onClick={() => navigate(viewAllUrl)}>+ {t('home.viewAll')}+ </button>+ )}+ </Flexbox>+ );+});++SectionTitle.displayName = 'SectionTitle';++export default SectionTitle;diff --git a/src/features/ResourceHome/Home/index.tsx b/src/features/ResourceHome/Home/index.tsxnew file mode 100644index 00000000000..155100e8c96--- /dev/null+++ b/src/features/ResourceHome/Home/index.tsx@@ -0,0 +1,61 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import NavHeader from '@/features/NavHeader';+import AddButton from '@/features/ResourceManager/components/Header/AddButton';++import FrequentLibraries from './FrequentLibraries';+import Libraries from './Libraries';+import RecentFiles from './RecentFiles';+import RecentPages from './RecentPages';+import RecentWorks from './RecentWorks';++const styles = createStaticStyles(({ css }) => ({+ content: css`+ width: 100%;+ max-width: 1080px;+ margin-inline: auto;+ padding-block: 32px 64px;+ padding-inline: 32px;+ `,+ scroll: css`+ overflow: hidden auto;+ flex: 1;+ `,+}));++/**+ * The library-style landing page of /resource: quick library access, then+ * works → recent pages → libraries → recent files — instead of the flat+ * all-files table (which now lives at /resource/all).+ */+const ResourceHomeDashboard = memo(() => {+ const { t } = useTranslation('file');++ return (+ <Flexbox height={'100%'}>+ <NavHeader+ left={<Flexbox style={{ marginLeft: 8 }}>{t('resource')}</Flexbox>}+ right={<AddButton />}+ style={{ borderBottom: `1px solid ${cssVar.colorBorderSecondary}` }}+ />+ <div className={styles.scroll}>+ <Flexbox className={styles.content} gap={40}>+ <FrequentLibraries />+ <RecentWorks />+ <RecentPages />+ <Libraries />+ <RecentFiles />+ </Flexbox>+ </div>+ </Flexbox>+ );+});++ResourceHomeDashboard.displayName = 'ResourceHomeDashboard';++export default ResourceHomeDashboard;diff --git a/src/features/ResourceHome/Layout/Header/CategoryMenu.tsx b/src/features/ResourceHome/Layout/Header/CategoryMenu.tsxindex 97e894c6ecf..b408a6985da 100644--- a/src/features/ResourceHome/Layout/Header/CategoryMenu.tsx+++ b/src/features/ResourceHome/Layout/Header/CategoryMenu.tsx@@ -3,9 +3,13 @@import { Flexbox } from '@lobehub/ui';import {ClipboardListIcon,+ FilePenIcon,+ FilesIcon,FileText,+ HouseIcon,ImageIcon,LayoutPanelTopIcon,+ type LucideIcon,Mic2,SquarePlay,} from 'lucide-react';@@ -20,92 +24,135 @@ import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwarimport { useActiveLocation } from '@/hooks/useActiveLocation';import { FilesTabs } from '@/types/files';+interface CategoryItem {+ icon: LucideIcon;+ isBusiness?: boolean;+ key: string;+ title: string;+ url: string;+}+const CategoryMenu = memo(() => {const { t } = useTranslation('file');const [activeKey, setMode] = useResourceManagerStore((s) => [s.category, s.setMode]);const navigate = useWorkspaceAwareNavigate();const businessCategories = useBusinessResourceCategories();const location = useActiveLocation();- // In Work-gallery mode (`?works=`) no file category is selected, so suppress- // the category highlight — otherwise "All" reads as active alongside the- // active Work entry.- const worksActive = new URLSearchParams(location.search).has('works');+ // In Work-gallery mode (/resource/works) no file category is selected, so+ // suppress the category highlight — otherwise "Home" reads as active+ // alongside the active Work entry. Match by suffix: the pathname may carry a+ // workspace prefix.+ const worksActive = location.pathname.endsWith('/resource/works');- const items = useMemo(+ // Two groups below the fixed Home/All entries: file-based categories+ // (uploaded files by type) and LobeHub business entities (pages, works,+ // webpages), separated by a gap.+ const groups = useMemo(() => [- {- icon: LayoutPanelTopIcon,- key: FilesTabs.All,- title: t('tab.all'),- url: '/resource',- },- {- icon: FileText,- key: FilesTabs.Documents,- title: t('tab.documents'),- url: '/resource?category=documents',- },- {- icon: ImageIcon,- key: FilesTabs.Images,- title: t('tab.images'),- url: '/resource?category=images',- },- {- icon: Mic2,- key: FilesTabs.Audios,- title: t('tab.audios'),- url: '/resource?category=audios',- },- {- icon: SquarePlay,- key: FilesTabs.Videos,- title: t('tab.videos'),- url: '/resource?category=videos',- },- // Single Works entry (no sub-categories this iteration): switches the- // content area to the topic-grouped Work gallery via `?works=all`.- {- icon: ClipboardListIcon,- key: 'works',- title: t('work.group'),- url: '/resource?works=all',- },- ...businessCategories.map((category) => ({- icon: category.icon,- key: category.key,- // Business categories carry a chat-namespace key but the type narrows to a- // string at this seam; cast so t() accepts the dynamic key.- title: t(category.titleKey as never) as string,- url: category.url,- })),+ [+ {+ icon: HouseIcon,+ key: FilesTabs.Home,+ title: t('tab.home'),+ url: '/resource',+ },+ {+ icon: LayoutPanelTopIcon,+ key: FilesTabs.All,+ title: t('tab.all'),+ url: '/resource/all',+ },+ ],+ // file-based categories — Files (the misc raw-data bucket) sits last+ [+ {+ icon: FileText,+ key: FilesTabs.Documents,+ title: t('tab.documents'),+ url: '/resource/documents',+ },+ {+ icon: ImageIcon,+ key: FilesTabs.Images,+ title: t('tab.images'),+ url: '/resource/images',+ },+ {+ icon: SquarePlay,+ key: FilesTabs.Videos,+ title: t('tab.videos'),+ url: '/resource/videos',+ },+ {+ icon: Mic2,+ key: FilesTabs.Audios,+ title: t('tab.audios'),+ url: '/resource/audios',+ },+ {+ icon: FilesIcon,+ key: FilesTabs.Files,+ title: t('tab.files'),+ url: '/resource/files',+ },+ ],+ // LobeHub business entities+ [+ {+ icon: FilePenIcon,+ key: FilesTabs.Pages,+ title: t('tab.pages'),+ url: '/resource/page',+ },+ {+ icon: ClipboardListIcon,+ key: 'works',+ title: t('work.group'),+ url: '/resource/works',+ },+ // The Websites entry is hidden for now (the category route and the+ // reading-card view stay reachable at /resource/websites) — re-add it+ // here once web clippings ship as a first-class flow.+ ...businessCategories.map((category) => ({+ icon: category.icon,+ isBusiness: true,+ key: category.key,+ // Business categories carry a chat-namespace key but the type narrows to a+ // string at this seam; cast so t() accepts the dynamic key.+ title: t(category.titleKey as never) as string,+ url: category.url,+ })),+ ] as CategoryItem[],],[t, businessCategories],);return (- <Flexbox gap={1} paddingInline={4}>- {items.map((item) => {- const isBusinessRoute = item.url.startsWith('/resource/');- const isActive =- item.key === 'works'- ? worksActive- : !worksActive &&- (isBusinessRoute ? location.pathname === item.url : activeKey === item.key);- return (- <Link- key={item.key}- to={item.url}- onClick={(e) => {- e.preventDefault();- setMode('explorer');- navigate(item.url, { replace: true });- }}- >- <NavItem active={isActive} icon={item.icon} title={item.title} />- </Link>- );- })}+ <Flexbox gap={12} paddingInline={4}>+ {groups.map((group, groupIndex) => (+ <Flexbox gap={1} key={groupIndex}>+ {group.map((item) => {+ const isActive =+ item.key === 'works'+ ? worksActive+ : !worksActive &&+ (item.isBusiness ? location.pathname === item.url : activeKey === item.key);+ return (+ <Link+ key={item.key}+ to={item.url}+ onClick={(e) => {+ e.preventDefault();+ setMode('explorer');+ navigate(item.url, { replace: true });+ }}+ >+ <NavItem active={isActive} icon={item.icon} title={item.title} />+ </Link>+ );+ })}+ </Flexbox>+ ))}</Flexbox>);});diff --git a/src/features/ResourceHome/index.tsx b/src/features/ResourceHome/index.tsxindex 6b2f9e65ceb..7bea32ec56d 100644--- a/src/features/ResourceHome/index.tsx+++ b/src/features/ResourceHome/index.tsx@@ -1,27 +1,88 @@'use client';import { memo, useLayoutEffect } from 'react';-import { useLocation, useSearchParams } from 'react-router';+import { useLocation, useParams, useSearchParams } from 'react-router';import ResourceManager from '@/features/ResourceManager';import { useInitFileCheck } from '@/features/ResourceManager/hooks/useInitFileCheck';import { useResourceManagerStore } from '@/features/ResourceManager/store';import WorkGallery from '@/features/WorkGallery';import { parseWorkGalleryKey } from '@/features/WorkGallery/const';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { FilesTabs } from '@/types/files';+import HomeDashboard from './Home';++/**+ * Path segment → category for routes that own one: /resource/all,+ * /resource/page (derived pages/notes), /resource/documents, …+ */+export const CATEGORY_BY_SEGMENT: Record<string, FilesTabs> = {+ all: FilesTabs.All,+ audios: FilesTabs.Audios,+ documents: FilesTabs.Documents,+ files: FilesTabs.Files,+ images: FilesTabs.Images,+ page: FilesTabs.Pages,+ videos: FilesTabs.Videos,+ websites: FilesTabs.Websites,+};++const SEGMENT_BY_CATEGORY = Object.fromEntries(+ Object.entries(CATEGORY_BY_SEGMENT).map(([segment, category]) => [category, segment]),+);++/** Canonical path for a category, e.g. /resource/page for Pages. */+export const resourceCategoryPath = (category: FilesTabs): string =>+ SEGMENT_BY_CATEGORY[category] ? `/resource/${SEGMENT_BY_CATEGORY[category]}` : '/resource';++/** Path segment of the cross-topic Work gallery: /resource/works */+export const WORKS_PATH_SEGMENT = 'works';+const ResourceHomePage = memo(() => {const [searchParams] = useSearchParams();const location = useLocation();+ const params = useParams<{ category?: string }>();+ const navigate = useWorkspaceAwareNavigate();const [setCategory, setLibraryId] = useResourceManagerStore((s) => [s.setCategory,s.setLibraryId,]);- const categoryParam = (searchParams.get('category') as FilesTabs) || FilesTabs.All;- // `?works=<type>` switches the content area to the cross-topic Work gallery,- // independent of the file explorer (which stays keyed on `?category=`).- const worksKey = parseWorkGalleryKey(searchParams.get('works'));+ // /resource/page is a static route (no :category param) — recover the+ // segment from the pathname there.+ const pathCategory =+ params.category ?? (/\/resource\/page\/?$/.test(location.pathname) ? 'page' : undefined);+ const segmentCategory = pathCategory ? CATEGORY_BY_SEGMENT[pathCategory] : undefined;+ const isValidPathCategory = segmentCategory !== undefined;+ // The Work gallery owns its own path segment; `?works=<key>` narrows it+ // (task / document / linear / github), defaulting to the combined view.+ const isWorksPath = pathCategory === WORKS_PATH_SEGMENT;+ const worksKey = isWorksPath ? (parseWorkGalleryKey(searchParams.get('works')) ?? 'all') : null;+ // The bare /resource route is the library home dashboard; explorer views+ // live under /resource/<category> (the all-files list at /resource/all).+ const categoryParam = segmentCategory ?? FilesTabs.Home;++ // Legacy URLs used `?category=<x>` / `?works=<key>` on the bare /resource+ // route; canonical forms are now /resource/<x> and /resource/works.+ const legacyCategory = searchParams.get('category');+ const legacyWorksKey = isWorksPath ? null : parseWorkGalleryKey(searchParams.get('works'));+ const isInvalidPath = !!pathCategory && !isValidPathCategory && !isWorksPath;++ useLayoutEffect(() => {+ if (legacyWorksKey) {+ navigate(+ legacyWorksKey === 'all' ? '/resource/works' : `/resource/works?works=${legacyWorksKey}`,+ { replace: true },+ );+ return;+ }+ if (legacyCategory) {+ navigate(resourceCategoryPath(legacyCategory as FilesTabs), { replace: true });+ return;+ }+ if (isInvalidPath) navigate('/resource', { replace: true });+ }, [legacyWorksKey, legacyCategory, isInvalidPath, navigate]);// Clear libraryId when on home route using useLayoutEffect// useLayoutEffect runs synchronously before browser paint, ensuring state is cleared@@ -52,7 +113,7 @@ const ResourceHomePage = memo(() => {if (worksKey) return <WorkGallery galleryKey={worksKey} />;- return <ResourceManager />;+ return <ResourceManager content={isValidPathCategory ? undefined : <HomeDashboard />} />;});ResourceHomePage.displayName = 'ResourceHomePage';diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsxindex bae67870889..0e2ca245bb2 100644--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsx+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsx@@ -100,17 +100,15 @@ const FileListItemActions = ({{!isFolder &&!isPage &&(isCreatingFileParseTask || isNull(chunkingStatus) || !chunkingStatus ? (- canEditResources && (+ // Unsupported file types simply hide the entry instead of surfacing a+ // permanently disabled button.+ canEditResources &&+ isSupportedForChunking && (<divclassName={isCreatingFileParseTask ? undefined : styles.hover}- title={t(- isSupportedForChunking- ? 'FileManager.actions.chunkingTooltip'- : 'FileManager.actions.chunkingUnsupported',- )}+ title={t('FileManager.actions.chunkingTooltip')}><Button- disabled={!isSupportedForChunking}icon={FileBoxIcon}loading={isCreatingFileParseTask}size={'small'}diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/AudioFileItem.tsx b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/AudioFileItem.tsxnew file mode 100644index 00000000000..4c4d5406d87--- /dev/null+++ b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/AudioFileItem.tsx@@ -0,0 +1,87 @@+import { Flexbox, Icon, stopPropagation } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { AudioLinesIcon } from 'lucide-react';+import { memo } from 'react';++import { formatSize } from '@/utils/format';++const styles = createStaticStyles(({ css, cssVar }) => ({+ cover: css`+ display: flex;+ align-items: center;+ justify-content: center;++ width: 100%;+ padding-block: 28px;++ color: ${cssVar.colorTextSecondary};++ /* subtle top highlight keeps the fill from reading flat */+ background:+ radial-gradient(+ 140% 100% at 50% 0%,+ color-mix(in srgb, #fff 8%, transparent) 0%,+ transparent 60%+ ),+ ${cssVar.colorFillQuaternary};+ `,+ info: css`+ padding: 12px;+ `,+ meta: css`+ font-size: 12px;+ color: ${cssVar.colorTextQuaternary};+ `,+ name: css`+ overflow: hidden;++ font-size: 13px;+ font-weight: ${cssVar.fontWeightStrong};+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ player: css`+ width: 100%;+ height: 32px;++ &::-webkit-media-controls-panel {+ background: ${cssVar.colorFillQuaternary};+ }+ `,+}));++interface AudioFileItemProps {+ isInView: boolean;+ name: string;+ size: number;+ url?: string;+}++/** Masonry card for audio files: type cover plus an inline playable control. */+const AudioFileItem = memo<AudioFileItemProps>(({ isInView, name, size, url }) => (+ <>+ <div className={styles.cover}>+ <Icon icon={AudioLinesIcon} size={40} />+ </div>+ <Flexbox className={styles.info} gap={8}>+ <span className={styles.name}>{name}</span>+ <span className={styles.meta}>{formatSize(size)}</span>+ {isInView && url && (+ // controls stay interactive without triggering the card's open action+ <audio+ controls+ className={styles.player}+ preload={'metadata'}+ src={url}+ onClick={stopPropagation}+ onPointerDown={stopPropagation}+ />+ )}+ </Flexbox>+ </>+));++AudioFileItem.displayName = 'AudioFileItem';++export default AudioFileItem;diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/VideoFileItem.tsx b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/VideoFileItem.tsxnew file mode 100644index 00000000000..e9bb4c95df1--- /dev/null+++ b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/VideoFileItem.tsx@@ -0,0 +1,94 @@+import { Flexbox, Icon } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { PlayIcon } from 'lucide-react';+import { memo } from 'react';++import { formatSize } from '@/utils/format';++const styles = createStaticStyles(({ css, cssVar }) => ({+ info: css`+ padding: 12px;+ `,+ meta: css`+ font-size: 12px;+ color: ${cssVar.colorTextQuaternary};+ `,+ name: css`+ overflow: hidden;++ font-size: 13px;+ font-weight: ${cssVar.fontWeightStrong};+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ playBadge: css`+ position: absolute;+ z-index: 1;+ inset-block-start: 50%;+ inset-inline-start: 50%;+ transform: translate(-50%, -50%);++ display: grid;+ place-items: center;++ width: 44px;+ height: 44px;+ border-radius: 50%;++ color: #fff;++ background: color-mix(in srgb, #000 45%, transparent);+ backdrop-filter: blur(4px);+ `,+ videoWrapper: css`+ position: relative;++ display: flex;+ align-items: center;+ justify-content: center;++ width: 100%;+ min-height: 120px;++ background: ${cssVar.colorFillQuaternary};++ video {+ pointer-events: none;+ display: block;+ width: 100%;+ height: auto;+ }+ `,+}));++interface VideoFileItemProps {+ isInView: boolean;+ name: string;+ size: number;+ url?: string;+}++/** Masonry card for video files: a real first-frame preview with a play badge. */+const VideoFileItem = memo<VideoFileItemProps>(({ isInView, name, size, url }) => (+ <>+ <div className={styles.videoWrapper}>+ {isInView && url && (+ // The #t=0.001 media fragment forces a seek so the browser actually+ // paints the first frame; bare preload="metadata" may stay blank.+ <video muted playsInline preload={'metadata'} src={`${url}#t=0.001`} />+ )}+ <div className={styles.playBadge}>+ <Icon icon={PlayIcon} size={20} />+ </div>+ </div>+ <Flexbox className={styles.info} gap={4}>+ <span className={styles.name}>{name}</span>+ <span className={styles.meta}>{formatSize(size)}</span>+ </Flexbox>+ </>+));++VideoFileItem.displayName = 'VideoFileItem';++export default VideoFileItem;diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/WebpageFileItem.test.ts b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/WebpageFileItem.test.tsnew file mode 100644index 00000000000..81ffa9cf661--- /dev/null+++ b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/WebpageFileItem.test.ts@@ -0,0 +1,53 @@+import { describe, expect, it } from 'vitest';++import { displayTitle, excerptOf } from './WebpageFileItem';++describe('excerptOf', () => {+ it('strips spliced html tags to a fixpoint — no <script fragment survives', () => {+ // a single-pass tag strip would turn `<scr<b>ipt>` into `<script>`+ const spliced = '<scr<b>ipt>alert(1)</scr</b>ipt> hello world';+ const result = excerptOf(spliced);+ expect(result.toLowerCase()).not.toContain('<script');+ expect(result).not.toContain('<');+ expect(result).not.toContain('>');+ expect(result).toContain('hello world');+ });++ it('drops every angle bracket from the plain-text excerpt', () => {+ expect(excerptOf('a < b and b > c <em>text</em>')).not.toMatch(/[<>]/);+ });++ it('strips yaml frontmatter, markdown links and table rulers', () => {+ const clipping = [+ '---',+ 'name: acceptance',+ 'description: something',+ '---',+ '[ ](<https://example.com/>) Real content here',+ '|:---|---:|',+ ].join('\n');+ const result = excerptOf(clipping);+ expect(result).not.toContain('name: acceptance');+ expect(result).not.toContain('](');+ expect(result).not.toMatch(/-{3,}/);+ expect(result).toContain('Real content here');+ });+});++describe('displayTitle', () => {+ it('keeps a real page title unchanged', () => {+ expect(displayTitle('Agent Skills Marketplace | LobeHub')).toBe(+ 'Agent Skills Marketplace | LobeHub',+ );+ });++ it('falls back to the last path segment for URL-only titles', () => {+ expect(displayTitle('https://raw.githubusercontent.com/lobehub/lobehub/main/SKILL.md')).toBe(+ 'SKILL.md',+ );+ });++ it('falls back to the hostname when the URL has no path', () => {+ expect(displayTitle('https://www.example.com/')).toBe('example.com');+ });+});diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/WebpageFileItem.tsx b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/WebpageFileItem.tsxnew file mode 100644index 00000000000..9afa9cea28a--- /dev/null+++ b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/WebpageFileItem.tsx@@ -0,0 +1,199 @@+import { Flexbox, Icon, stopPropagation } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { ExternalLinkIcon, GlobeIcon } from 'lucide-react';+import { memo } from 'react';++const styles = createStaticStyles(({ css, cssVar }) => ({+ domain: css`+ overflow: hidden;+ display: flex;+ gap: 6px;+ align-items: center;++ font-size: 12px;+ color: ${cssVar.colorTextQuaternary};++ span {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ `,+ excerpt: css`+ overflow: hidden;+ display: -webkit-box;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 5;++ font-size: 12px;+ line-height: 1.7;+ color: ${cssVar.colorTextSecondary};+ word-break: break-word;+ `,+ excerptWrapper: css`+ padding: 14px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};++ /* the reading-card paper feel: a quiet tinted sheet above the fold */+ background:+ radial-gradient(+ 140% 100% at 50% 0%,+ color-mix(in srgb, #fff 10%, transparent) 0%,+ transparent 60%+ ),+ ${cssVar.colorFillQuaternary};+ `,+ info: css`+ padding: 12px;+ `,+ openLink: css`+ cursor: pointer;++ display: grid;+ flex: none;+ place-items: center;++ width: 22px;+ height: 22px;+ border-radius: ${cssVar.borderRadiusSM};++ color: ${cssVar.colorTextQuaternary};++ &:hover {+ color: ${cssVar.colorText};+ background: ${cssVar.colorFillTertiary};+ }+ `,+ title: css`+ overflow: hidden;+ display: -webkit-box;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 2;++ font-size: 13px;+ font-weight: ${cssVar.fontWeightStrong};+ color: ${cssVar.colorText};+ word-break: break-word;+ `,+}));++const hostnameOf = (url?: string): string | null => {+ if (!url) return null;+ try {+ return new URL(url).hostname.replace(/^www\./, '');+ } catch {+ return null;+ }+};++/**+ * Strip clipping noise down to readable excerpt text: YAML frontmatter,+ * markdown images/links (including the `(<url>)` angle-bracket form and+ * empty-text link shells), html tags and markdown punctuation.+ *+ * The output is a plain-text excerpt: after tag stripping every remaining+ * angle bracket is dropped too, so no `<script`-style fragment can survive+ * (js/incomplete-multi-character-sanitization).+ */+export const excerptOf = (content?: string | null): string => {+ let text = (content ?? '')+ .replace(/^\s*---[\s\S]*?---\s*/, '')+ .replaceAll(/!\[[^\]]*\]\([^)]*\)/g, '')+ .replaceAll(/\[([^\]]*)\]\([^)]*\)/g, '$1');++ // strip html tags to a fixpoint — a single pass can splice a new tag+ // together (e.g. `<scr<b>ipt`), which is exactly what CodeQL flags+ let previous: string;+ do {+ previous = text;+ text = text.replaceAll(/<\/?[a-z][^>]*>/gi, '');+ } while (text !== previous);++ return (+ text+ // markdown table rulers (|:---|---|) survive as long dash runs once the+ // pipes are stripped — drop them together with any leftover link shells+ .replaceAll(/:?-{3,}:?/g, ' ')+ .replaceAll(/\[\s*\]/g, '')+ // plain-text excerpt: no angle brackets survive at all+ .replaceAll(/[#*<>`_\\|]/g, '')+ .replaceAll(/\(\s*\)/g, '')+ // nested-link leftovers surface as stray bracket runs like `(]`+ .replaceAll(/[()[\]]{2,}/g, ' ')+ .replaceAll(/\s+/g, ' ')+ .trim()+ .slice(0, 240)+ );+};++/**+ * Clippings without a real page title store the URL in `name`. A raw URL as a+ * bold card title reads broken — fall back to the last path segment (the+ * document name, e.g. `SKILL.md`) or the hostname; the full source stays on+ * the domain row and the open-link button.+ */+export const displayTitle = (name: string): string => {+ if (!/^https?:\/\//.test(name.trim())) return name;+ try {+ const parsed = new URL(name.trim());+ const lastSegment = decodeURIComponent(+ parsed.pathname.split('/').findLast(Boolean) ?? '',+ ).trim();+ return lastSegment || parsed.hostname.replace(/^www\./, '');+ } catch {+ return name;+ }+};++interface WebpageFileItemProps {+ content?: string | null;+ name: string;+ url?: string;+}++/**+ * Masonry card for web clippings — a Cubox-style reading card: excerpt sheet+ * on top, title and source domain below, with a direct link to the original.+ */+const WebpageFileItem = memo<WebpageFileItemProps>(({ content, name, url }) => {+ const hostname = hostnameOf(url);+ const excerpt = excerptOf(content);+ const title = displayTitle(name);++ return (+ <>+ {excerpt && (+ <div className={styles.excerptWrapper}>+ <div className={styles.excerpt}>{excerpt}</div>+ </div>+ )}+ <Flexbox className={styles.info} gap={8}>+ <span className={styles.title}>{title}</span>+ <Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>+ <div className={styles.domain}>+ <Icon icon={GlobeIcon} size={13} />+ {hostname && <span>{hostname}</span>}+ </div>+ {url && (+ <button+ aria-label={'open source page'}+ className={styles.openLink}+ type={'button'}+ onPointerDown={stopPropagation}+ onClick={(e) => {+ stopPropagation(e);+ window.open(url, '_blank', 'noopener,noreferrer');+ }}+ >+ <Icon icon={ExternalLinkIcon} size={13} />+ </button>+ )}+ </Flexbox>+ </Flexbox>+ </>+ );+});++WebpageFileItem.displayName = 'WebpageFileItem';++export default WebpageFileItem;diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsx b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsxindex ebb9d634e98..137f43451c6 100644--- a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsx+++ b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsx@@ -21,10 +21,13 @@ import { type FileListItem } from '@/types/files';import { useFileItemClick } from '../../hooks/useFileItemClick';import DropdownMenu from '../../ItemDropdown/DropdownMenu';import { useFileItemDropdown } from '../../ItemDropdown/useFileItemDropdown';+import AudioFileItem from './AudioFileItem';import DefaultFileItem from './DefaultFileItem';import ImageFileItem from './ImageFileItem';import MarkdownFileItem from './MarkdownFileItem';import NoteFileItem from './NoteFileItem';+import VideoFileItem from './VideoFileItem';+import WebpageFileItem from './WebpageFileItem';// Image file typesconst IMAGE_TYPES = new Set([@@ -195,6 +198,7 @@ const MasonryFileItem = memo<MasonryFileItemProps>(embeddingStatus,finishEmbedding,chunkCount,+ content,url,name,fileType,@@ -226,15 +230,19 @@ const MasonryFileItem = memo<MasonryFileItemProps>(// Memoize computed values that don't changeconst computedValues = useMemo(() => ({+ isAudio: !!fileType?.startsWith('audio'),isFolder: fileType === CUSTOM_FOLDER_FILE_TYPE,isImage: fileType && IMAGE_TYPES.has(fileType),isMarkdown: isMarkdownFile(name, fileType),isPage: isCustomPage(fileType, name),+ isVideo: !!fileType?.startsWith('video'),+ // web clippings: article documents plus raw html captures+ isWebpage: fileType === 'article' || !!fileType?.startsWith('text/html'),}),[fileType, name],);- const { isImage, isMarkdown, isPage, isFolder } = computedValues;+ const { isAudio, isImage, isMarkdown, isPage, isFolder, isVideo, isWebpage } = computedValues;// Use shared click handler hookconst handleItemClick = useFileItemClick({@@ -435,12 +443,27 @@ const MasonryFileItem = memo<MasonryFileItemProps>(<divclassName={cx(styles.content,- !isImage && !isMarkdown && !isPage && styles.contentWithPadding,+ !isImage &&+ !isMarkdown &&+ !isPage &&+ !isVideo &&+ !isAudio &&+ !isWebpage &&+ styles.contentWithPadding,)}onClick={handleItemClick}>{(() => {switch (true) {+ case isWebpage: {+ return <WebpageFileItem content={content} name={name} url={url} />;+ }+ case isVideo && !!url: {+ return <VideoFileItem isInView={isInView} name={name} size={size} url={url} />;+ }+ case isAudio && !!url: {+ return <AudioFileItem isInView={isInView} name={name} size={size} url={url} />;+ }case isImage && !!url: {return (<ImageFileItemdiff --git a/src/features/ResourceManager/components/Explorer/hooks/useViewMode.ts b/src/features/ResourceManager/components/Explorer/hooks/useViewMode.tsindex f42bc01f97c..6de7859726d 100644--- a/src/features/ResourceManager/components/Explorer/hooks/useViewMode.ts+++ b/src/features/ResourceManager/components/Explorer/hooks/useViewMode.ts@@ -3,6 +3,18 @@ import { useCallback, useEffect } from 'react';import { useResourceManagerStore } from '@/features/ResourceManager/store';import { type ViewMode } from '@/features/ResourceManager/store/initialState';import { parseAsStringEnum, useQueryState } from '@/hooks/useQueryParam';+import { FilesTabs } from '@/types/files';++/**+ * Categories whose content is media first — they open in the gallery+ * (masonry) view unless the URL explicitly asks for another one.+ */+const GALLERY_FIRST_CATEGORIES = new Set<FilesTabs>([+ FilesTabs.Audios,+ FilesTabs.Images,+ FilesTabs.Videos,+ FilesTabs.Websites,+]);/*** Hook to manage view mode with URL query sync@@ -11,15 +23,19 @@ import { parseAsStringEnum, useQueryState } from '@/hooks/useQueryParam';*/export const useViewMode = (): [ViewMode, (mode: ViewMode) => void] => {// View mode from store- const [viewModeFromStore, setViewModeInStore] = useResourceManagerStore((s) => [- s.viewMode,- s.setViewMode,- ]);+ const [category, libraryId, viewModeFromStore, setViewModeInStore] = useResourceManagerStore(+ (s) => [s.category, s.libraryId, s.viewMode, s.setViewMode],+ );++ // Inside a library the category filter is not applied, so the stale home+ // category must not leak its gallery default there.+ const defaultViewMode: ViewMode =+ !libraryId && GALLERY_FIRST_CATEGORIES.has(category) ? 'masonry' : 'list';// Sync view mode with URL query parameterconst [viewModeFromUrl, setViewModeInUrl] = useQueryState('view',- parseAsStringEnum(['list', 'masonry'] as const).withDefault('list'),+ parseAsStringEnum(['list', 'masonry'] as const).withDefault(defaultViewMode),);useEffect(() => {diff --git a/src/features/ResourceManager/components/Header/AddButton.tsx b/src/features/ResourceManager/components/Header/AddButton.tsxindex e5701afb454..8c12f3cb3b2 100644--- a/src/features/ResourceManager/components/Header/AddButton.tsx+++ b/src/features/ResourceManager/components/Header/AddButton.tsx@@ -34,7 +34,7 @@ const getAcceptedFileTypes = (category: FilesTabs): string | undefined => {return 'audio/*';}case FilesTabs.Documents: {- return '.pdf,.doc,.docx,.md,.markdown,.xls,.xlsx';+ return '.pdf,.doc,.docx,.md,.markdown,.txt,.rtf,.csv,.xls,.xlsx,.ppt,.pptx,.epub';}case FilesTabs.Images: {return 'image/*';@@ -69,8 +69,9 @@ const AddButton = () => {]);const handleOpenPageEditor = useCallback(async () => {- // Navigate to "All" category first if not already there- if (category !== FilesTabs.All) {+ // Navigate to "All" category first if not already there. The home+ // dashboard and the Pages category both surface the new page, so stay put.+ if (category !== FilesTabs.All && category !== FilesTabs.Home && category !== FilesTabs.Pages) {setCategory(FilesTabs.All);}@@ -101,7 +102,7 @@ const AddButton = () => {const handleCreateFolder = useCallback(async () => {// Navigate to "All" category first if not already there- if (category !== FilesTabs.All) {+ if (category !== FilesTabs.All && category !== FilesTabs.Home) {setCategory(FilesTabs.All);}diff --git a/src/features/ResourceManager/index.tsx b/src/features/ResourceManager/index.tsxindex eea1cdaa87e..adaeb2ccb69 100644--- a/src/features/ResourceManager/index.tsx+++ b/src/features/ResourceManager/index.tsx@@ -2,7 +2,7 @@import { Flexbox } from '@lobehub/ui';import { createStaticStyles, useTheme } from 'antd-style';-import { memo, useCallback, useEffect, useMemo } from 'react';+import { memo, type ReactNode, useCallback, useEffect, useMemo } from 'react';import { useSearchParams } from 'react-router';import DragUploadZone from '@/components/DragUploadZone';@@ -57,7 +57,15 @@ export type ResourceManagerMode = 'editor' | 'explorer' | 'page';** Business component, no need be reusable.*/-const ResourceManager = memo(() => {+interface ResourceManagerProps {+ /**+ * Replaces the Explorer as the base content (used by the resource home+ * dashboard) while keeping the editor overlays, upload dock and drag zone.+ */+ content?: ReactNode;+}++const ResourceManager = memo<ResourceManagerProps>(({ content }) => {const theme = useTheme();const [, setSearchParams] = useSearchParams();const [mode, currentViewItemId, libraryId, setMode, setCurrentViewItemId] =@@ -143,8 +151,9 @@ const ResourceManager = memo(() => {onUploadFiles={handleUploadFiles}><Flexbox className={styles.container} height={'100%'} style={cssVariables}>- {/* Explorer is always rendered to preserve its state */}- <Explorer />+ {/* Explorer stays mounted to preserve its state, unless the caller+ swaps in its own base content (resource home dashboard) */}+ {content ?? <Explorer />}{/* Editor overlay */}{mode === 'editor' && (diff --git a/src/features/WorkGallery/WorkPreview.tsx b/src/features/WorkGallery/WorkPreview.tsxindex 39fd1f40df3..e88d72de517 100644--- a/src/features/WorkGallery/WorkPreview.tsx+++ b/src/features/WorkGallery/WorkPreview.tsx@@ -21,7 +21,30 @@ const styles = createStaticStyles(({ css }) => ({margin: 7px;border-radius: 11px;- background: ${cssVar.colorFillQuaternary};+ /* A white top spotlight keeps the flat fill from reading dull. Light and+ dark need different intensities: on the light grey fill the highlight+ must be near-opaque white to register at all, while in dark mode a few+ percent of white already lifts the surface. */+ background:+ radial-gradient(+ 140% 110% at 50% 0%,+ color-mix(in srgb, #fff 85%, transparent) 0%,+ color-mix(in srgb, #fff 30%, transparent) 45%,+ transparent 75%+ ),+ ${cssVar.colorFillTertiary};+ box-shadow: inset 0 1px 0 #fff;++ [data-theme='dark'] & {+ background:+ radial-gradient(+ 140% 110% at 50% 0%,+ color-mix(in srgb, #fff 10%, transparent) 0%,+ transparent 65%+ ),+ ${cssVar.colorFillQuaternary};+ box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent);+ }`,coverBadge: css`position: absolute;diff --git a/src/features/WorkGallery/index.tsx b/src/features/WorkGallery/index.tsxindex 67ae02455ce..1be6ef989fe 100644--- a/src/features/WorkGallery/index.tsx+++ b/src/features/WorkGallery/index.tsx@@ -5,19 +5,16 @@ import { Avatar, Center, Empty, Flexbox, Skeleton } from '@lobehub/ui';import { Button } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import { PackageOpenIcon, TriangleAlertIcon } from 'lucide-react';-import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';+import { memo, useEffect, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';-import { taskDetailPath } from '@/features/AgentTasks/shared/taskDetailPath';import { useAgentDisplayMeta } from '@/features/AgentTasks/shared/useAgentDisplayMeta';-import { openDocumentModal } from '@/features/DocumentModal/loader';-import { getWorkTypeDescriptor, isSafeExternalUrl } from '@/features/Work/descriptors';-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { useFetchAgentList } from '@/hooks/useFetchAgentList';import { formatWorkVersionCost } from '@/utils/workVersionCost';import type { WorkGalleryKey } from './const';import { useWorkspaceWorksInfinite } from './hooks';+import { useOpenWork } from './useOpenWork';import WorkPreviewCard from './WorkPreviewCard';const styles = createStaticStyles(({ css }) => ({@@ -184,7 +181,6 @@ interface WorkGalleryProps {const WorkGallery = memo<WorkGalleryProps>(({ galleryKey }) => {const { t, i18n } = useTranslation('file');- const navigate = useWorkspaceAwareNavigate();const [activeAgentId, setActiveAgentId] = useState<string | null>(null);useFetchAgentList();@@ -236,33 +232,7 @@ const WorkGallery = memo<WorkGalleryProps>(({ galleryKey }) => {}));}, [filteredItems, i18n.language, t]);- const handleOpen = useCallback(- (item: WorkSummaryItem) => {- const openTarget = getWorkTypeDescriptor(item).getOpenTarget(item);- if (!openTarget) return;-- switch (openTarget.kind) {- case 'document': {- void openDocumentModal(openTarget.documentId);- return;- }- case 'external': {- if (isSafeExternalUrl(openTarget.url))- window.open(openTarget.url, '_blank', 'noopener,noreferrer');- return;- }- case 'filePreview': {- if (isSafeExternalUrl(openTarget.url))- window.open(openTarget.url, '_blank', 'noopener,noreferrer');- return;- }- case 'task': {- navigate(taskDetailPath(openTarget.identifier));- }- }- },- [navigate],- );+ const handleOpen = useOpenWork();const sentinelRef = useRef<HTMLDivElement>(null);useEffect(() => {diff --git a/src/features/WorkGallery/useOpenWork.ts b/src/features/WorkGallery/useOpenWork.tsnew file mode 100644index 00000000000..c0c0f60f15d--- /dev/null+++ b/src/features/WorkGallery/useOpenWork.ts@@ -0,0 +1,44 @@+import type { WorkSummaryItem } from '@lobechat/types';+import { useCallback } from 'react';++import { taskDetailPath } from '@/features/AgentTasks/shared/taskDetailPath';+import { openDocumentModal } from '@/features/DocumentModal/loader';+import { getWorkTypeDescriptor, isSafeExternalUrl } from '@/features/Work/descriptors';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';++/**+ * Open a Work summary item at its canonical target (document modal, external+ * url, file preview or task detail). Shared by the Work gallery and the+ * resource home's recent-works section.+ */+export const useOpenWork = () => {+ const navigate = useWorkspaceAwareNavigate();++ return useCallback(+ (item: WorkSummaryItem) => {+ const openTarget = getWorkTypeDescriptor(item).getOpenTarget(item);+ if (!openTarget) return;++ switch (openTarget.kind) {+ case 'document': {+ void openDocumentModal(openTarget.documentId);+ return;+ }+ case 'external': {+ if (isSafeExternalUrl(openTarget.url))+ window.open(openTarget.url, '_blank', 'noopener,noreferrer');+ return;+ }+ case 'filePreview': {+ if (isSafeExternalUrl(openTarget.url))+ window.open(openTarget.url, '_blank', 'noopener,noreferrer');+ return;+ }+ case 'task': {+ navigate(taskDetailPath(openTarget.identifier));+ }+ }+ },+ [navigate],+ );+};diff --git a/src/hooks/useNavLayout.ts b/src/hooks/useNavLayout.tsindex 5bbfac94f84..ef181166425 100644--- a/src/hooks/useNavLayout.ts+++ b/src/hooks/useNavLayout.ts@@ -61,10 +61,10 @@ export const useNavLayout = (): NavLayout => {url: '/tasks',},{- icon: getRouteById('page')!.icon,- key: SidebarTabKey.Pages,- title: t('tab.pages'),- url: '/page',+ icon: getRouteById('resource')!.icon,+ key: SidebarTabKey.Resource,+ title: t('tab.resource'),+ url: '/resource',},] as NavItem[],[t, toggleCommandMenu],@@ -87,10 +87,10 @@ export const useNavLayout = (): NavLayout => {url: '/community',},{- icon: getRouteById('resource')!.icon,- key: SidebarTabKey.Resource,- title: t('tab.resource'),- url: '/resource',+ icon: getRouteById('page')!.icon,+ key: SidebarTabKey.Pages,+ title: t('tab.pages'),+ url: '/page',},{hidden: !!activeWorkspaceSlug,diff --git a/src/spa/router/desktopRouter.shared.tsx b/src/spa/router/desktopRouter.shared.tsxindex 8fe6fc77aa7..814f6c03add 100644--- a/src/spa/router/desktopRouter.shared.tsx+++ b/src/spa/router/desktopRouter.shared.tsx@@ -479,6 +479,32 @@ export const sharedMainAreaChildren: RouteObject[] = [index: true,},...BusinessResourceRoutes,+ // /resource/page needs a static segment: the dynamic `:category`+ // ties with the workspace mirror `/:workspaceSlug/page` on route+ // score, and the workspace tree would swallow it into a slug 404.+ {+ element: dynamicElement(+ () => import('@/routes/(main)/resource/(home)'),+ 'Desktop > Resource > Home > Pages',+ { preloadId: 'resource' },+ ),+ handle: {+ meta: routeMeta({ icon: LibraryBigIcon, titleKey: 'navigation.resources' }),+ },+ path: 'page',+ },+ // Category views share the home page: /resource/documents, /resource/images, …+ {+ element: dynamicElement(+ () => import('@/routes/(main)/resource/(home)'),+ 'Desktop > Resource > Home > Category',+ { preloadId: 'resource' },+ ),+ handle: {+ meta: routeMeta({ icon: LibraryBigIcon, titleKey: 'navigation.resources' }),+ },+ path: ':category',+ },],element: dynamicElement(() => import('@/routes/(main)/resource/(home)/_layout'),diff --git a/src/store/global/selectors/systemStatus.test.ts b/src/store/global/selectors/systemStatus.test.tsindex f7b3a7f9213..e6c55ed671f 100644--- a/src/store/global/selectors/systemStatus.test.ts+++ b/src/store/global/selectors/systemStatus.test.ts@@ -279,9 +279,10 @@ describe('systemStatusSelectors', () => {expect(items[spacerIdx - 1]).toBe('recents');// missing top-group defaults slot in just before the accordionexpect(items.indexOf('tasks')).toBeLessThan(spacerIdx - 2);- expect(items.indexOf('pages')).toBeLessThan(spacerIdx - 2);+ expect(items.indexOf('resource')).toBeLessThan(spacerIdx - 2);// missing bottom-group defaults sit after the spacerexpect(items.indexOf('image')).toBeGreaterThan(spacerIdx);+ expect(items.indexOf('pages')).toBeGreaterThan(spacerIdx);});it('should migrate legacy `sidebarSectionOrder` accordion order into the default layout', () => {@@ -293,14 +294,14 @@ describe('systemStatusSelectors', () => {// the legacy state was saved) is backfilled at the head of the block.expect(items).toEqual(['tasks',- 'pages',+ 'resource','private','agent','recents',SIDEBAR_SPACER_ID,'image','community',- 'resource',+ 'pages','memory',]);});@@ -314,14 +315,14 @@ describe('systemStatusSelectors', () => {// backfilled at the head of the block; recents/agent keep legacy order.expect(items).toEqual(['tasks',- 'pages',+ 'resource','private','recents','agent',SIDEBAR_SPACER_ID,'image','community',- 'resource',+ 'pages','memory',]);});diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.tsindex becdd80c013..630822a55a9 100644--- a/src/store/global/selectors/systemStatus.ts+++ b/src/store/global/selectors/systemStatus.ts@@ -174,14 +174,14 @@ export const SIDEBAR_SPACER_ID = '__spacer__';export const DEFAULT_SIDEBAR_ITEMS: string[] = ['tasks',- 'pages',+ 'resource','recents','private','agent',SIDEBAR_SPACER_ID,'image','community',- 'resource',+ 'pages','memory',];