@lobehub/lobehub 2.0.0-next.72 → 2.0.0-next.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/desktop-pr-build.yml +7 -3
- package/CHANGELOG.md +50 -0
- package/apps/desktop/package.json +1 -0
- package/apps/desktop/src/main/controllers/LocalFileCtr.ts +55 -11
- package/apps/desktop/src/main/controllers/__tests__/LocalFileCtr.test.ts +153 -0
- package/changelog/v1.json +18 -0
- package/locales/en-US/tool.json +12 -1
- package/locales/zh-CN/tool.json +12 -1
- package/next.config.ts +5 -5
- package/package.json +2 -1
- package/packages/electron-client-ipc/src/types/localSystem.ts +4 -0
- package/scripts/prebuild.mts +16 -6
- package/src/app/(backend)/trpc/desktop/[trpc]/route.ts +6 -6
- package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/UserBanner.test.tsx +7 -4
- package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +4 -4
- package/src/app/[variants]/(main)/(mobile)/me/(home)/features/UserBanner.tsx +5 -6
- package/src/app/[variants]/(main)/(mobile)/me/(home)/features/useCategory.tsx +5 -8
- package/src/app/[variants]/(main)/(mobile)/me/(home)/index.tsx +25 -0
- package/src/app/[variants]/(main)/(mobile)/me/(home)/layout.tsx +13 -16
- package/src/app/[variants]/(main)/(mobile)/me/profile/features/Category.tsx +6 -6
- package/src/app/[variants]/(main)/(mobile)/me/profile/features/Header.tsx +3 -3
- package/src/app/[variants]/(main)/(mobile)/me/profile/index.tsx +16 -0
- package/src/app/[variants]/(main)/(mobile)/me/profile/layout.tsx +9 -11
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/Header.tsx +3 -3
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx +3 -4
- package/src/app/[variants]/(main)/(mobile)/me/settings/index.tsx +16 -0
- package/src/app/[variants]/(main)/(mobile)/me/settings/layout.tsx +15 -13
- package/src/app/[variants]/(main)/changelog/_layout/Desktop/index.tsx +6 -5
- package/src/app/[variants]/(main)/changelog/_layout/Mobile/Header.tsx +3 -3
- package/src/app/[variants]/(main)/changelog/_layout/Mobile/index.tsx +5 -5
- package/src/app/[variants]/(main)/changelog/features/Post.tsx +7 -4
- package/src/app/[variants]/(main)/changelog/index.tsx +55 -0
- package/src/app/[variants]/(main)/chat/_layout/Desktop/index.tsx +6 -7
- package/src/app/[variants]/(main)/chat/_layout/Mobile.tsx +3 -3
- package/src/app/[variants]/(main)/chat/components/WorkspaceLayout.tsx +1 -14
- package/src/app/[variants]/(main)/chat/components/conversation/features/ChatHydration/index.tsx +2 -2
- package/src/app/[variants]/(main)/chat/components/conversation/features/ChatInput/Desktop/MessageFromUrl.tsx +11 -13
- package/src/app/[variants]/(main)/chat/components/conversation/features/ChatInput/Desktop/index.tsx +0 -1
- package/src/app/[variants]/(main)/chat/components/conversation/features/ThreadHydration.tsx +2 -2
- package/src/app/[variants]/(main)/chat/components/topic/features/Topic/TopicListContent/TopicItem/TopicContent.tsx +20 -11
- package/src/app/[variants]/(main)/chat/features/PageTitle/index.tsx +1 -2
- package/src/app/[variants]/(main)/chat/index.tsx +29 -0
- package/src/app/[variants]/(main)/chat/session/features/SessionHydration.tsx +8 -6
- package/src/app/[variants]/(main)/chat/session/features/SessionListContent/Inbox/index.tsx +2 -4
- package/src/app/[variants]/(main)/chat/session/features/SessionListContent/List/index.tsx +1 -1
- package/src/app/[variants]/(main)/chat/session/layout/Mobile/SessionHeader.tsx +3 -3
- package/src/app/[variants]/(main)/chat/settings/_layout/Desktop/Header.tsx +3 -3
- package/src/app/[variants]/(main)/chat/settings/_layout/Mobile/Header.tsx +3 -3
- package/src/app/[variants]/(main)/chat/settings/features/PublishResultModal/index.tsx +3 -3
- package/src/app/[variants]/(main)/chat/{components/SettingsPage.tsx → settings/index.tsx} +6 -35
- package/src/app/[variants]/(main)/components/Link.tsx +21 -0
- package/src/app/[variants]/(main)/discover/(detail)/_layout/{Desktop.tsx → Desktop/index.tsx} +15 -7
- package/src/app/[variants]/(main)/discover/(detail)/_layout/Mobile/index.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Capabilities/Block.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Overview/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/SystemRole/index.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Versions/index.tsx +4 -4
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Header.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Sidebar/ActionButton/AddAgent.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Sidebar/ActionButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Sidebar/Related/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Sidebar/TocList/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/StatusPage/index.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(detail)/assistant/{AssistantDetailPage.tsx → index.tsx} +18 -11
- package/src/app/[variants]/(main)/discover/(detail)/features/Breadcrumb.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Details/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Details/Versions/index.tsx +5 -5
- package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Details/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Sidebar/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Sidebar/ServerConfig.tsx +4 -4
- package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Sidebar/TocList/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/mcp/{McpDetailPage.tsx → index.tsx} +15 -7
- package/src/app/[variants]/(main)/discover/(detail)/mcp/loading.tsx +1 -0
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Details/Overview/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Details/Parameter/ParameterItem.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Details/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Details/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Header.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Sidebar/ActionButton/ChatWithModel.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Sidebar/ActionButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Sidebar/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Sidebar/RelatedProviders/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/model/{ModelDetailPage.tsx → index.tsx} +17 -10
- package/src/app/[variants]/(main)/discover/(detail)/model/loading.tsx +1 -0
- package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Details/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Details/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Sidebar/ActionButton/ProviderConfig.tsx +5 -4
- package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Sidebar/ActionButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Sidebar/Related/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Sidebar/RelatedModels/index.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(detail)/provider/{ProviderDetailPage.tsx → index.tsx} +17 -10
- package/src/app/[variants]/(main)/discover/(detail)/provider/loading.tsx +1 -0
- package/src/app/[variants]/(main)/discover/(list)/(home)/{HomePage.tsx → index.tsx} +14 -0
- package/src/app/[variants]/(main)/discover/(list)/_layout/Desktop/Nav.tsx +2 -3
- package/src/app/[variants]/(main)/discover/(list)/_layout/Desktop/index.tsx +4 -3
- package/src/app/[variants]/(main)/discover/(list)/_layout/Mobile/Nav.tsx +3 -4
- package/src/app/[variants]/(main)/discover/(list)/_layout/Mobile/index.tsx +4 -3
- package/src/app/[variants]/(main)/discover/(list)/assistant/_layout/Desktop.tsx +3 -4
- package/src/app/[variants]/(main)/discover/(list)/assistant/_layout/Mobile.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/List/Item.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(list)/assistant/{AssistantPage.tsx → index.tsx} +18 -4
- package/src/app/[variants]/(main)/discover/(list)/features/SortButton/index.tsx +2 -2
- package/src/app/[variants]/(main)/discover/(list)/mcp/_layout/Desktop.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(list)/mcp/_layout/Mobile.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(list)/mcp/features/List/Item.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(list)/mcp/{McpPage.tsx → index.tsx} +9 -2
- package/src/app/[variants]/(main)/discover/(list)/model/_layout/Desktop.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(list)/model/_layout/Mobile.tsx +3 -3
- package/src/app/[variants]/(main)/discover/(list)/model/features/List/Item.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(list)/model/{ModelPage.tsx → index.tsx} +9 -2
- package/src/app/[variants]/(main)/discover/(list)/provider/features/List/Item.tsx +1 -1
- package/src/app/[variants]/(main)/discover/(list)/provider/{Client.tsx → index.tsx} +9 -2
- package/src/app/[variants]/(main)/discover/_layout/Desktop/index.tsx +4 -4
- package/src/app/[variants]/(main)/discover/_layout/Mobile/index.tsx +3 -3
- package/src/app/[variants]/(main)/discover/components/Title.tsx +1 -1
- package/src/app/[variants]/(main)/discover/features/Search.tsx +2 -2
- package/src/app/[variants]/(main)/discover/features/useNav.tsx +11 -12
- package/src/app/[variants]/(main)/hooks/useActiveTabKey.ts +40 -0
- package/src/app/[variants]/(main)/hooks/usePathname.ts +10 -0
- package/src/app/[variants]/(main)/hooks/useQuery.ts +12 -0
- package/src/app/[variants]/(main)/hooks/useRouter.ts +22 -0
- package/src/app/[variants]/(main)/hooks/useSearchParams.ts +11 -0
- package/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/ModelSelect/index.tsx +5 -5
- package/src/app/[variants]/(main)/image/@topic/features/Topics/TopicUrlSync.tsx +1 -1
- package/src/app/[variants]/(main)/image/ComingSoon.tsx +15 -0
- package/src/app/[variants]/(main)/image/_layout/Desktop/index.tsx +5 -2
- package/src/app/[variants]/(main)/image/_layout/DesktopWrapper.tsx +15 -0
- package/src/app/[variants]/(main)/image/_layout/Mobile/index.tsx +3 -1
- package/src/app/[variants]/(main)/image/features/ImageWorkspace/index.tsx +1 -2
- package/src/app/[variants]/(main)/image/index.tsx +18 -0
- package/src/app/[variants]/(main)/knowledge/_layout/Desktop.tsx +17 -0
- package/src/app/[variants]/(main)/knowledge/_layout/Mobile.tsx +17 -0
- package/src/app/[variants]/(main)/knowledge/components/KnowledgeBaseItem/index.tsx +1 -1
- package/src/app/[variants]/(main)/knowledge/components/modal/ModalPageClient.tsx +4 -4
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/index.tsx +5 -8
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/menu/Head.tsx +1 -1
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/CategoryMenu.tsx +2 -2
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/KnowledgeBase.tsx +1 -1
- package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/DesktopLayoutContainer.tsx +3 -2
- package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/BottomActions.tsx +4 -4
- package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/TopActions.test.tsx +9 -9
- package/src/app/[variants]/(main)/layouts/desktop/SideBar/TopActions.tsx +117 -0
- package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/index.tsx +9 -4
- package/src/app/[variants]/(main)/layouts/index.tsx +11 -0
- package/src/app/[variants]/(main)/{_layout/Mobile → layouts/mobile}/NavBar.tsx +5 -5
- package/src/app/[variants]/(main)/{_layout/Mobile → layouts/mobile}/index.tsx +10 -7
- package/src/app/[variants]/(main)/profile/(home)/desktop.tsx +26 -0
- package/src/app/[variants]/(main)/profile/(home)/index.tsx +26 -0
- package/src/app/[variants]/(main)/profile/@category/features/CategoryContent.tsx +5 -7
- package/src/app/[variants]/(main)/profile/_layout/Desktop/index.tsx +3 -2
- package/src/app/[variants]/(main)/profile/_layout/DesktopWrapper.tsx +14 -0
- package/src/app/[variants]/(main)/profile/_layout/Mobile/Header.tsx +3 -3
- package/src/app/[variants]/(main)/profile/_layout/Mobile/index.tsx +4 -3
- package/src/app/[variants]/(main)/profile/apikey/index.tsx +18 -0
- package/src/app/[variants]/(main)/profile/hooks/useCategory.tsx +6 -6
- package/src/app/[variants]/(main)/profile/security/index.tsx +29 -0
- package/src/app/[variants]/(main)/profile/stats/features/AssistantsRank.tsx +4 -4
- package/src/app/[variants]/(main)/profile/stats/features/TopicsRank.tsx +4 -4
- package/src/app/[variants]/(main)/profile/stats/index.tsx +20 -0
- package/src/app/[variants]/(main)/profile/usage/features/UsageTable.tsx +7 -9
- package/src/app/[variants]/(main)/profile/usage/index.tsx +13 -0
- package/src/app/[variants]/(main)/settings/_layout/Desktop/Header.tsx +2 -2
- package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +2 -2
- package/src/app/[variants]/(main)/settings/_layout/DesktopWrapper.tsx +23 -0
- package/src/app/[variants]/(main)/settings/_layout/Mobile/Header.tsx +8 -7
- package/src/app/[variants]/(main)/settings/_layout/Mobile/index.tsx +2 -5
- package/src/app/[variants]/(main)/settings/_layout/MobileWrapper.tsx +23 -0
- package/src/app/[variants]/(main)/settings/agent/AgentMenu/Menu.tsx +2 -4
- package/src/app/[variants]/(main)/settings/agent/index.tsx +2 -4
- package/src/app/[variants]/(main)/settings/provider/(list)/index.tsx +2 -3
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/All.tsx +2 -2
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/Item.tsx +38 -37
- package/src/app/[variants]/(main)/settings/provider/_layout/Mobile.tsx +2 -2
- package/src/app/[variants]/(main)/settings/provider/features/CreateNewProvider/index.tsx +3 -3
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/SettingModal.tsx +3 -3
- package/src/app/[variants]/DesktopRouter.tsx +40 -0
- package/src/app/[variants]/MobileRouter.tsx +41 -0
- package/src/app/[variants]/desktopRouter.config.tsx +364 -0
- package/src/app/[variants]/layout.tsx +1 -3
- package/src/app/[variants]/loaders/routeParams.ts +45 -0
- package/src/app/[variants]/loading/Server/Redirect.tsx +1 -1
- package/src/app/[variants]/mobileRouter.config.tsx +396 -0
- package/src/app/[variants]/page.tsx +17 -6
- package/src/app/desktop/devtools/page.tsx +1 -1
- package/src/app/desktop/layout.tsx +1 -1
- package/src/components/BootErrorBoundary/index.tsx +129 -0
- package/src/components/mdx/constants.ts +1 -0
- package/src/features/ChangelogModal/index.tsx +3 -3
- package/src/features/Conversation/Messages/Group/Tool/Inspector/index.tsx +23 -4
- package/src/features/KnowledgeManager/FileExplorer/index.tsx +4 -4
- package/src/features/KnowledgeManager/Header/FilesSearchBar.tsx +1 -1
- package/src/features/User/UserPanel/PanelContent.tsx +4 -3
- package/src/features/User/UserPanel/useMenu.tsx +20 -14
- package/src/features/User/__tests__/PanelContent.test.tsx +13 -7
- package/src/hooks/useDiscoverTab.ts +2 -2
- package/src/hooks/useInterceptingRoutes.test.ts +23 -26
- package/src/hooks/useInterceptingRoutes.ts +5 -4
- package/src/hooks/usePinnedAgentState.ts +6 -6
- package/src/hooks/useQuery.ts +5 -0
- package/src/hooks/useQueryParam.ts +322 -0
- package/src/hooks/useQueryRoute.test.ts +2 -12
- package/src/hooks/useQueryRoute.ts +5 -5
- package/src/hooks/useShowMobileWorkspace.ts +1 -1
- package/src/hooks/useSwitchSession.ts +4 -3
- package/src/layout/GlobalProvider/ImportSettings.tsx +22 -9
- package/src/layout/GlobalProvider/StoreInitialization.tsx +9 -1
- package/src/locales/default/tool.ts +11 -0
- package/src/proxy.ts +13 -1
- package/src/services/message/index.ts +11 -2
- package/src/store/chat/agents/createAgentExecutors.ts +31 -16
- package/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts +218 -0
- package/src/store/chat/slices/aiChat/actions/conversationControl.ts +4 -0
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +9 -3
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +142 -61
- package/src/store/chat/slices/builtinTool/actions/__tests__/localSystem.test.ts +5 -6
- package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +204 -10
- package/src/store/chat/slices/builtinTool/actions/localSystem.ts +45 -182
- package/src/store/chat/slices/builtinTool/actions/search.ts +51 -26
- package/src/store/chat/slices/message/action.test.ts +182 -33
- package/src/store/chat/slices/message/actions/optimisticUpdate.ts +79 -36
- package/src/store/chat/slices/message/actions/query.ts +7 -5
- package/src/store/chat/slices/message/selectors/dbMessage.ts +11 -4
- package/src/store/chat/slices/plugin/action.test.ts +257 -54
- package/src/store/chat/slices/plugin/actions/optimisticUpdate.ts +63 -26
- package/src/store/chat/slices/plugin/actions/pluginTypes.ts +52 -19
- package/src/store/chat/slices/plugin/actions/publicApi.ts +6 -1
- package/src/store/chat/slices/plugin/actions/workflow.ts +17 -6
- package/src/store/chat/slices/thread/action.ts +2 -0
- package/src/store/global/action.test.ts +3 -3
- package/src/store/global/actions/workspacePane.ts +2 -1
- package/src/store/global/initialState.ts +10 -2
- package/src/store/user/slices/common/action.ts +4 -0
- package/src/tools/executionRuntimes.ts +3 -0
- package/src/tools/local-system/ExecutionRuntime/index.ts +407 -0
- package/src/tools/local-system/Intervention/EditLocalFile/index.tsx +89 -0
- package/src/tools/local-system/Intervention/WriteFile/index.tsx +72 -0
- package/src/tools/local-system/Intervention/index.ts +4 -0
- package/src/tools/local-system/Render/EditLocalFile/index.tsx +67 -0
- package/src/tools/local-system/Render/ReadLocalFile/ReadFileView.tsx +53 -78
- package/src/tools/local-system/Render/index.ts +2 -0
- package/src/tools/local-system/index.ts +1 -0
- package/src/tools/local-system/type.ts +4 -3
- package/src/app/[variants]/(main)/(mobile)/me/(home)/loading.tsx +0 -38
- package/src/app/[variants]/(main)/(mobile)/me/(home)/page.tsx +0 -40
- package/src/app/[variants]/(main)/(mobile)/me/profile/loading.tsx +0 -5
- package/src/app/[variants]/(main)/(mobile)/me/profile/page.tsx +0 -30
- package/src/app/[variants]/(main)/(mobile)/me/settings/loading.tsx +0 -5
- package/src/app/[variants]/(main)/(mobile)/me/settings/page.tsx +0 -30
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/TopActions.tsx +0 -106
- package/src/app/[variants]/(main)/changelog/layout.tsx +0 -10
- package/src/app/[variants]/(main)/changelog/modal/page.tsx +0 -23
- package/src/app/[variants]/(main)/changelog/page.tsx +0 -78
- package/src/app/[variants]/(main)/chat/ChatRouter.tsx +0 -83
- package/src/app/[variants]/(main)/chat/_layout/ChatLayout.tsx +0 -22
- package/src/app/[variants]/(main)/chat/components/MainChatPage.tsx +0 -25
- package/src/app/[variants]/(main)/chat/error.tsx +0 -3
- package/src/app/[variants]/(main)/chat/layout.tsx +0 -10
- package/src/app/[variants]/(main)/chat/loading.tsx +0 -3
- package/src/app/[variants]/(main)/chat/not-found.tsx +0 -1
- package/src/app/[variants]/(main)/chat/page.tsx +0 -12
- package/src/app/[variants]/(main)/chat/settings/error.tsx +0 -3
- package/src/app/[variants]/(main)/chat/settings/loading.tsx +0 -3
- package/src/app/[variants]/(main)/chat/settings/not-found.tsx +0 -1
- package/src/app/[variants]/(main)/discover/(detail)/_layout/DetailLayout.tsx +0 -22
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/Client.tsx +0 -51
- package/src/app/[variants]/(main)/discover/(detail)/mcp/[slug]/Client.tsx +0 -43
- package/src/app/[variants]/(main)/discover/(detail)/mcp/[slug]/loading.tsx +0 -1
- package/src/app/[variants]/(main)/discover/(detail)/model/[...slugs]/Client.tsx +0 -40
- package/src/app/[variants]/(main)/discover/(detail)/model/[...slugs]/loading.tsx +0 -1
- package/src/app/[variants]/(main)/discover/(detail)/provider/[...slugs]/Client.tsx +0 -40
- package/src/app/[variants]/(main)/discover/(detail)/provider/[...slugs]/loading.tsx +0 -1
- package/src/app/[variants]/(main)/discover/(list)/_layout/ListLayout.tsx +0 -22
- package/src/app/[variants]/(main)/discover/(list)/assistant/AssistantLayout.tsx +0 -21
- package/src/app/[variants]/(main)/discover/(list)/mcp/Client.tsx +0 -44
- package/src/app/[variants]/(main)/discover/(list)/mcp/McpLayout.tsx +0 -21
- package/src/app/[variants]/(main)/discover/(list)/model/Client.tsx +0 -44
- package/src/app/[variants]/(main)/discover/(list)/model/ModelLayout.tsx +0 -21
- package/src/app/[variants]/(main)/discover/(list)/provider/ProviderPage.tsx +0 -43
- package/src/app/[variants]/(main)/discover/DiscoverRouter.tsx +0 -170
- package/src/app/[variants]/(main)/discover/[[...path]]/page.tsx +0 -12
- package/src/app/[variants]/(main)/discover/_layout/DiscoverLayout.tsx +0 -22
- package/src/app/[variants]/(main)/discover/error.tsx +0 -3
- package/src/app/[variants]/(main)/discover/not-found.tsx +0 -1
- package/src/app/[variants]/(main)/error.tsx +0 -3
- package/src/app/[variants]/(main)/image/layout.tsx +0 -15
- package/src/app/[variants]/(main)/image/page.tsx +0 -45
- package/src/app/[variants]/(main)/knowledge/KnowledgeRouter.tsx +0 -74
- package/src/app/[variants]/(main)/knowledge/[[...path]]/page.tsx +0 -12
- package/src/app/[variants]/(main)/knowledge/components/modal/page.tsx +0 -13
- package/src/app/[variants]/(main)/knowledge/layout.tsx +0 -12
- package/src/app/[variants]/(main)/layout.tsx +0 -10
- package/src/app/[variants]/(main)/not-found.tsx +0 -1
- package/src/app/[variants]/(main)/profile/apikey/page.tsx +0 -32
- package/src/app/[variants]/(main)/profile/error.tsx +0 -3
- package/src/app/[variants]/(main)/profile/layout.tsx +0 -11
- package/src/app/[variants]/(main)/profile/loading.tsx +0 -3
- package/src/app/[variants]/(main)/profile/not-found.tsx +0 -1
- package/src/app/[variants]/(main)/profile/security/page.tsx +0 -28
- package/src/app/[variants]/(main)/profile/stats/page.tsx +0 -23
- package/src/app/[variants]/(main)/profile/usage/page.tsx +0 -23
- package/src/app/[variants]/@modal/(.)changelog/modal/features/Cover.tsx +0 -48
- package/src/app/[variants]/@modal/(.)changelog/modal/features/Hero.tsx +0 -29
- package/src/app/[variants]/@modal/(.)changelog/modal/features/Post.tsx +0 -57
- package/src/app/[variants]/@modal/(.)changelog/modal/features/PublishedTime.tsx +0 -50
- package/src/app/[variants]/@modal/(.)changelog/modal/features/ReadDetail.tsx +0 -72
- package/src/app/[variants]/@modal/(.)changelog/modal/features/VersionTag.tsx +0 -26
- package/src/app/[variants]/@modal/(.)changelog/modal/layout.tsx +0 -41
- package/src/app/[variants]/@modal/(.)changelog/modal/loading.tsx +0 -10
- package/src/app/[variants]/@modal/(.)changelog/modal/page.tsx +0 -38
- package/src/app/[variants]/@modal/_layout/ModalLayout.tsx +0 -63
- package/src/app/[variants]/@modal/_layout/SettingModalLayout.tsx +0 -71
- package/src/app/[variants]/@modal/default.tsx +0 -3
- package/src/app/[variants]/@modal/error.tsx +0 -3
- package/src/app/[variants]/@modal/layout.tsx +0 -7
- package/src/app/[variants]/@modal/loading.tsx +0 -5
- /package/src/app/[variants]/{@modal/(.)changelog/modal → (main)/changelog}/features/Pagination.tsx +0 -0
- /package/src/app/[variants]/{@modal/(.)changelog/modal → (main)/changelog}/features/UpdateChangelogStatus.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/DetailProvider.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Capabilities/Knowledge.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Capabilities/KnowledgeItem.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Capabilities/PluginItem.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Capabilities/Plugins.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Capabilities/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Nav.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/Overview/TagList.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Details/SystemRole/TagList.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Sidebar/Related/Item.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Sidebar/Summary/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/features → features}/Sidebar/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/assistant/{[...slugs]/loading.tsx → loading.tsx} +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Sidebar/ActionButton/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Sidebar/ConnectionTypeAlert.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Sidebar/Related/Item.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/mcp/{[slug]/features → features}/Sidebar/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/DetailProvider.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Details/Nav.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Details/Overview/ProviderList/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Details/Parameter/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Sidebar/Related/Item.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Sidebar/RelatedProviders/Item.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/model/{[...slugs]/features → features}/Sidebar/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/DetailProvider.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Details/Guide/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Details/Nav.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Details/Overview/ModelList/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Details/Overview/index.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Header.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Sidebar/Related/Item.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Sidebar/RelatedModels/Item.tsx +0 -0
- /package/src/app/[variants]/(main)/discover/(detail)/provider/{[...slugs]/features → features}/Sidebar/index.tsx +0 -0
- /package/src/app/[variants]/(main)/labs/{page.tsx → index.tsx} +0 -0
- /package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/RegisterHotkeys.tsx +0 -0
- /package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/Avatar.test.tsx +0 -0
- /package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/Avatar.tsx +0 -0
- /package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/PinList/index.tsx +0 -0
- /package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/index.tsx +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Outlet } from 'react-router-dom';
|
|
1
2
|
import { Flexbox } from 'react-layout-kit';
|
|
2
3
|
|
|
3
4
|
import ImagePanel from '@/features/ImageSidePanel';
|
|
@@ -7,7 +8,7 @@ import { LayoutProps } from '../type';
|
|
|
7
8
|
import Container from './Container';
|
|
8
9
|
import RegisterHotkeys from './RegisterHotkeys';
|
|
9
10
|
|
|
10
|
-
const Layout = ({
|
|
11
|
+
const Layout = ({ menu, topic }: Omit<LayoutProps, 'children'>) => {
|
|
11
12
|
return (
|
|
12
13
|
<>
|
|
13
14
|
<Flexbox
|
|
@@ -17,7 +18,9 @@ const Layout = ({ children, menu, topic }: LayoutProps) => {
|
|
|
17
18
|
width={'100%'}
|
|
18
19
|
>
|
|
19
20
|
<ImagePanel>{menu}</ImagePanel>
|
|
20
|
-
<Container>
|
|
21
|
+
<Container>
|
|
22
|
+
<Outlet />
|
|
23
|
+
</Container>
|
|
21
24
|
<ImageTopicPanel>{topic}</ImageTopicPanel>
|
|
22
25
|
</Flexbox>
|
|
23
26
|
<RegisterHotkeys />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import Menu from '../@menu/default';
|
|
6
|
+
import Topic from '../@topic/default';
|
|
7
|
+
import Desktop from './Desktop';
|
|
8
|
+
|
|
9
|
+
const DesktopImageWrapper = memo(() => {
|
|
10
|
+
return <Desktop menu={<Menu />} topic={<Topic />} />;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
DesktopImageWrapper.displayName = 'DesktopImageWrapper';
|
|
14
|
+
|
|
15
|
+
export default DesktopImageWrapper;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Suspense, memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import ImageWorkspace from './features/ImageWorkspace';
|
|
6
|
+
import SkeletonList from './features/ImageWorkspace/SkeletonList';
|
|
7
|
+
|
|
8
|
+
const DesktopImagePage = memo(() => {
|
|
9
|
+
return (
|
|
10
|
+
<Suspense fallback={<SkeletonList />}>
|
|
11
|
+
<ImageWorkspace />
|
|
12
|
+
</Suspense>
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
DesktopImagePage.displayName = 'DesktopImagePage';
|
|
17
|
+
|
|
18
|
+
export default DesktopImagePage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { App } from 'antd';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Outlet } from 'react-router-dom';
|
|
6
|
+
|
|
7
|
+
const DesktopKnowledgeLayout = memo(() => {
|
|
8
|
+
return (
|
|
9
|
+
<App style={{ display: 'flex', flex: 1, height: '100%' }}>
|
|
10
|
+
<Outlet />
|
|
11
|
+
</App>
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
DesktopKnowledgeLayout.displayName = 'DesktopKnowledgeLayout';
|
|
16
|
+
|
|
17
|
+
export default DesktopKnowledgeLayout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { App } from 'antd';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Outlet } from 'react-router-dom';
|
|
6
|
+
|
|
7
|
+
const MobileKnowledgeLayout = memo(() => {
|
|
8
|
+
return (
|
|
9
|
+
<App style={{ display: 'flex', flex: 1, height: '100%' }}>
|
|
10
|
+
<Outlet />
|
|
11
|
+
</App>
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
MobileKnowledgeLayout.displayName = 'MobileKnowledgeLayout';
|
|
16
|
+
|
|
17
|
+
export default MobileKnowledgeLayout;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useRouter } from 'next/navigation';
|
|
4
3
|
import { useCallback } from 'react';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
5
|
|
|
6
6
|
import FileDetail from './FileDetail';
|
|
7
7
|
import FilePreview from './FilePreview';
|
|
@@ -12,15 +12,15 @@ interface ModalPageClientProps {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const ModalPageClient = ({ id }: ModalPageClientProps) => {
|
|
15
|
-
const
|
|
15
|
+
const navigate = useNavigate();
|
|
16
16
|
const handleClose = useCallback(() => {
|
|
17
17
|
if (typeof window === 'undefined') return;
|
|
18
18
|
|
|
19
19
|
const { pathname, search } = window.location;
|
|
20
20
|
const basePath = pathname.replace(/\/modal\/?$/, '');
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
}, [
|
|
22
|
+
navigate(`${basePath || '/'}${search}`, { replace: true });
|
|
23
|
+
}, [navigate]);
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<FullscreenModal detail={<FileDetail id={id} />} onClose={handleClose}>
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
|
-
import {
|
|
5
|
+
import { useLoaderData } from 'react-router-dom';
|
|
6
6
|
|
|
7
|
+
import type { IdParams } from '@/app/[variants]/loaders/routeParams';
|
|
7
8
|
import FileModalQueryRoute from '@/app/[variants]/(main)/knowledge/shared/FileModalQueryRoute';
|
|
8
9
|
import { useSetFileModalId } from '@/app/[variants]/(main)/knowledge/shared/useFileQueryParam';
|
|
9
10
|
import FilePanel from '@/features/FileSidePanel';
|
|
@@ -19,15 +20,11 @@ import Menu from './menu/Menu';
|
|
|
19
20
|
* Supports ?file=[fileId] query param for file preview modal
|
|
20
21
|
*/
|
|
21
22
|
const KnowledgeBaseDetailPage = memo(() => {
|
|
22
|
-
const { id } =
|
|
23
|
+
const { id } = useLoaderData() as IdParams;
|
|
23
24
|
const setFileModalId = useSetFileModalId();
|
|
24
25
|
|
|
25
|
-
useKnowledgeBaseItem(id
|
|
26
|
-
const name = useKnowledgeBaseStore(knowledgeBaseSelectors.getKnowledgeBaseNameById(id
|
|
27
|
-
|
|
28
|
-
if (!id) {
|
|
29
|
-
return <div>Knowledge base ID is required</div>;
|
|
30
|
-
}
|
|
26
|
+
useKnowledgeBaseItem(id);
|
|
27
|
+
const name = useKnowledgeBaseStore(knowledgeBaseSelectors.getKnowledgeBaseNameById(id));
|
|
31
28
|
|
|
32
29
|
return (
|
|
33
30
|
<>
|
|
@@ -93,7 +93,7 @@ const CategoryMenu = memo(() => {
|
|
|
93
93
|
className={cx(styles.header, isHomeActive && styles.headerActive)}
|
|
94
94
|
horizontal
|
|
95
95
|
onClick={() => {
|
|
96
|
-
navigate('/', { replace: true });
|
|
96
|
+
navigate('/knowledge', { replace: true });
|
|
97
97
|
}}
|
|
98
98
|
paddingBlock={6}
|
|
99
99
|
paddingInline={8}
|
|
@@ -132,7 +132,7 @@ const CategoryMenu = memo(() => {
|
|
|
132
132
|
onClick={({ key }) => {
|
|
133
133
|
// Navigate to home route and set category
|
|
134
134
|
const categoryParam = key === FilesTabs.Home ? '' : `?category=${key}`;
|
|
135
|
-
navigate(
|
|
135
|
+
navigate(`/knowledge${categoryParam}`, { replace: true });
|
|
136
136
|
}}
|
|
137
137
|
selectable
|
|
138
138
|
selectedKeys={[activeKey]}
|
package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/DesktopLayoutContainer.tsx
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useTheme } from 'antd-style';
|
|
2
|
-
import { usePathname } from 'next/navigation';
|
|
3
2
|
import { PropsWithChildren, Suspense, memo } from 'react';
|
|
4
3
|
import { Flexbox } from 'react-layout-kit';
|
|
4
|
+
import { useLocation } from 'react-router-dom';
|
|
5
5
|
|
|
6
6
|
import SideBar from './SideBar';
|
|
7
7
|
|
|
8
8
|
const DesktopLayoutContainer = memo<PropsWithChildren>(({ children }) => {
|
|
9
9
|
const theme = useTheme();
|
|
10
|
-
const
|
|
10
|
+
const location = useLocation();
|
|
11
|
+
const pathname = location.pathname;
|
|
11
12
|
const hideSideBar = pathname.startsWith('/settings');
|
|
12
13
|
return (
|
|
13
14
|
<>
|
package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/BottomActions.tsx
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionIcon, ActionIconProps } from '@lobehub/ui';
|
|
2
2
|
import { FlaskConical, Github } from 'lucide-react';
|
|
3
|
-
import Link from 'next/link';
|
|
4
3
|
import { memo } from 'react';
|
|
4
|
+
import { Link } from 'react-router-dom';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { Flexbox } from 'react-layout-kit';
|
|
7
7
|
|
|
@@ -22,16 +22,16 @@ const BottomActions = memo(() => {
|
|
|
22
22
|
return (
|
|
23
23
|
<Flexbox gap={8}>
|
|
24
24
|
{!hideGitHub && (
|
|
25
|
-
<
|
|
25
|
+
<a aria-label={'GitHub'} href={GITHUB} rel="noopener noreferrer" target={'_blank'}>
|
|
26
26
|
<ActionIcon
|
|
27
27
|
icon={Github}
|
|
28
28
|
size={ICON_SIZE}
|
|
29
29
|
title={'GitHub'}
|
|
30
30
|
tooltipProps={{ placement: 'right' }}
|
|
31
31
|
/>
|
|
32
|
-
</
|
|
32
|
+
</a>
|
|
33
33
|
)}
|
|
34
|
-
<Link aria-label={t('labs')}
|
|
34
|
+
<Link aria-label={t('labs')} to={'/labs'}>
|
|
35
35
|
<ActionIcon
|
|
36
36
|
icon={FlaskConical}
|
|
37
37
|
size={ICON_SIZE}
|
package/src/app/[variants]/(main)/{_layout/Desktop → layouts/desktop}/SideBar/TopActions.test.tsx
RENAMED
|
@@ -38,17 +38,16 @@ afterEach(() => {
|
|
|
38
38
|
cleanup();
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
vi.mock('
|
|
42
|
-
|
|
43
|
-
<div {...rest}>
|
|
44
|
-
{`Mocked Link ${rest.href}`}
|
|
45
|
-
{children}
|
|
46
|
-
</div>
|
|
47
|
-
)),
|
|
41
|
+
vi.mock('react-router-dom', () => ({
|
|
42
|
+
useNavigate: vi.fn(() => vi.fn()),
|
|
48
43
|
}));
|
|
49
44
|
|
|
50
45
|
vi.mock('@lobehub/ui', () => ({
|
|
51
|
-
ActionIcon: vi.fn(({ title }) =>
|
|
46
|
+
ActionIcon: vi.fn(({ title, onClick, icon }) => (
|
|
47
|
+
<div data-testid={`action-icon-${icon?.name || 'unknown'}`} onClick={onClick}>
|
|
48
|
+
{title}
|
|
49
|
+
</div>
|
|
50
|
+
)),
|
|
52
51
|
combineKeys: vi.fn((keys) => keys.join('+')),
|
|
53
52
|
KeyMapEnum: { Alt: 'alt', Ctrl: 'ctrl', Shift: 'shift' },
|
|
54
53
|
Hotkey: vi.fn(({ keys = [] }) => <div>{keys}</div>),
|
|
@@ -134,7 +133,8 @@ describe('TopActions', () => {
|
|
|
134
133
|
const switchBackToChat = vi.spyOn(store.current, 'switchBackToChat');
|
|
135
134
|
|
|
136
135
|
renderTopActions({ tab: SidebarTabKey.Discover });
|
|
137
|
-
|
|
136
|
+
const chatIcon = screen.getByText('tab.chat');
|
|
137
|
+
fireEvent.click(chatIcon);
|
|
138
138
|
|
|
139
139
|
expect(switchBackToChat).toBeCalledWith('1');
|
|
140
140
|
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ActionIcon, ActionIconProps, Hotkey } from '@lobehub/ui';
|
|
2
|
+
import { Compass, FolderClosed, MessageSquare, Palette } from 'lucide-react';
|
|
3
|
+
import { memo, useMemo, useTransition } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { useNavigate } from 'react-router-dom';
|
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
|
|
8
|
+
import { INBOX_SESSION_ID } from '@/const/session';
|
|
9
|
+
import { SESSION_CHAT_URL } from '@/const/url';
|
|
10
|
+
import { useGlobalStore } from '@/store/global';
|
|
11
|
+
import { SidebarTabKey } from '@/store/global/initialState';
|
|
12
|
+
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
13
|
+
import { useSessionStore } from '@/store/session';
|
|
14
|
+
import { useUserStore } from '@/store/user';
|
|
15
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
16
|
+
import { HotkeyEnum } from '@/types/hotkey';
|
|
17
|
+
|
|
18
|
+
const ICON_SIZE: ActionIconProps['size'] = {
|
|
19
|
+
blockSize: 40,
|
|
20
|
+
size: 24,
|
|
21
|
+
strokeWidth: 2,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface TopActionProps {
|
|
25
|
+
isPinned?: boolean | null;
|
|
26
|
+
tab?: SidebarTabKey;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// TODO Change icons
|
|
30
|
+
const TopActions = memo<TopActionProps>(({ tab, isPinned }) => {
|
|
31
|
+
const { t } = useTranslation('common');
|
|
32
|
+
const navigate = useNavigate();
|
|
33
|
+
const [, startTransition] = useTransition();
|
|
34
|
+
|
|
35
|
+
const [switchBackToChat, isMobile] = useGlobalStore((s) => [
|
|
36
|
+
s.switchBackToChat,
|
|
37
|
+
s.isMobile,
|
|
38
|
+
]);
|
|
39
|
+
const { showMarket, enableKnowledgeBase, showAiImage } =
|
|
40
|
+
useServerConfigStore(featureFlagsSelectors);
|
|
41
|
+
const hotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.NavigateToChat));
|
|
42
|
+
const activeSessionId = useSessionStore((s) => s.activeId);
|
|
43
|
+
const chatHref = useMemo(
|
|
44
|
+
() => SESSION_CHAT_URL(activeSessionId || INBOX_SESSION_ID, isMobile),
|
|
45
|
+
[activeSessionId, isMobile],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const isChatActive = tab === SidebarTabKey.Chat && !isPinned;
|
|
49
|
+
const isKnowledgeActive = tab === SidebarTabKey.Knowledge;
|
|
50
|
+
const isDiscoverActive = tab === SidebarTabKey.Discover;
|
|
51
|
+
const isImageActive = tab === SidebarTabKey.Image;
|
|
52
|
+
|
|
53
|
+
const handleNavigate = (path: string) => {
|
|
54
|
+
startTransition(() => {
|
|
55
|
+
navigate(path);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Flexbox gap={8}>
|
|
61
|
+
<ActionIcon
|
|
62
|
+
active={isChatActive}
|
|
63
|
+
icon={MessageSquare}
|
|
64
|
+
onClick={(e) => {
|
|
65
|
+
if (e.metaKey || e.ctrlKey) {
|
|
66
|
+
window.open(chatHref, '_blank');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
startTransition(() => {
|
|
71
|
+
switchBackToChat(activeSessionId);
|
|
72
|
+
});
|
|
73
|
+
}}
|
|
74
|
+
size={ICON_SIZE}
|
|
75
|
+
title={
|
|
76
|
+
<Flexbox align={'center'} gap={8} horizontal justify={'space-between'}>
|
|
77
|
+
<span>{t('tab.chat')}</span>
|
|
78
|
+
<Hotkey inverseTheme keys={hotkey} />
|
|
79
|
+
</Flexbox>
|
|
80
|
+
}
|
|
81
|
+
tooltipProps={{ placement: 'right' }}
|
|
82
|
+
/>
|
|
83
|
+
{enableKnowledgeBase && (
|
|
84
|
+
<ActionIcon
|
|
85
|
+
active={isKnowledgeActive}
|
|
86
|
+
icon={FolderClosed}
|
|
87
|
+
onClick={() => handleNavigate('/knowledge')}
|
|
88
|
+
size={ICON_SIZE}
|
|
89
|
+
title={t('tab.knowledgeBase')}
|
|
90
|
+
tooltipProps={{ placement: 'right' }}
|
|
91
|
+
/>
|
|
92
|
+
)}
|
|
93
|
+
{showAiImage && (
|
|
94
|
+
<ActionIcon
|
|
95
|
+
active={isImageActive}
|
|
96
|
+
icon={Palette}
|
|
97
|
+
onClick={() => handleNavigate('/image')}
|
|
98
|
+
size={ICON_SIZE}
|
|
99
|
+
title={t('tab.aiImage')}
|
|
100
|
+
tooltipProps={{ placement: 'right' }}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
103
|
+
{showMarket && (
|
|
104
|
+
<ActionIcon
|
|
105
|
+
active={isDiscoverActive}
|
|
106
|
+
icon={Compass}
|
|
107
|
+
onClick={() => handleNavigate('/discover')}
|
|
108
|
+
size={ICON_SIZE}
|
|
109
|
+
title={t('tab.discover')}
|
|
110
|
+
tooltipProps={{ placement: 'right' }}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
</Flexbox>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export default TopActions;
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import { useTheme } from 'antd-style';
|
|
4
4
|
import dynamic from 'next/dynamic';
|
|
5
|
-
import {
|
|
5
|
+
import { Suspense, memo } from 'react';
|
|
6
6
|
import { HotkeysProvider } from 'react-hotkeys-hook';
|
|
7
7
|
import { Flexbox } from 'react-layout-kit';
|
|
8
|
+
import { Outlet } from 'react-router-dom';
|
|
8
9
|
|
|
9
10
|
import { isDesktop } from '@/const/version';
|
|
10
11
|
import { BANNER_HEIGHT } from '@/features/AlertBanner/CloudBanner';
|
|
11
12
|
import TitleBar, { TITLE_BAR_HEIGHT } from '@/features/ElectronTitlebar';
|
|
12
13
|
import HotkeyHelperPanel from '@/features/HotkeyHelperPanel';
|
|
13
14
|
import { usePlatform } from '@/hooks/usePlatform';
|
|
15
|
+
import { Locales } from '@/locales/resources';
|
|
14
16
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
15
17
|
import { HotkeyScopeEnum } from '@/types/hotkey';
|
|
16
18
|
|
|
@@ -20,7 +22,8 @@ import SideBar from './SideBar';
|
|
|
20
22
|
|
|
21
23
|
const CloudBanner = dynamic(() => import('@/features/AlertBanner/CloudBanner'));
|
|
22
24
|
|
|
23
|
-
const Layout = memo
|
|
25
|
+
const Layout = memo((props: { locale: Locales }) => {
|
|
26
|
+
const { locale } = props;
|
|
24
27
|
const { isPWA } = usePlatform();
|
|
25
28
|
const theme = useTheme();
|
|
26
29
|
|
|
@@ -45,13 +48,15 @@ const Layout = memo<PropsWithChildren>(({ children }) => {
|
|
|
45
48
|
width={'100%'}
|
|
46
49
|
>
|
|
47
50
|
{isDesktop ? (
|
|
48
|
-
<DesktopLayoutContainer>
|
|
51
|
+
<DesktopLayoutContainer>
|
|
52
|
+
<Outlet context={{ locale: locale }} />
|
|
53
|
+
</DesktopLayoutContainer>
|
|
49
54
|
) : (
|
|
50
55
|
<>
|
|
51
56
|
<Suspense>
|
|
52
57
|
<SideBar />
|
|
53
58
|
</Suspense>
|
|
54
|
-
{
|
|
59
|
+
<Outlet context={{ locale: locale }} />
|
|
55
60
|
</>
|
|
56
61
|
)}
|
|
57
62
|
</Flexbox>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Re-export desktop and mobile layouts for external use
|
|
2
|
+
export { default as DesktopMainLayout } from './desktop';
|
|
3
|
+
export { default as MobileMainLayout } from './mobile';
|
|
4
|
+
|
|
5
|
+
// Re-export desktop components
|
|
6
|
+
export { default as DesktopLayoutContainer } from './desktop/DesktopLayoutContainer';
|
|
7
|
+
export { default as DesktopRegisterHotkeys } from './desktop/RegisterHotkeys';
|
|
8
|
+
export { default as DesktopSideBar } from './desktop/SideBar';
|
|
9
|
+
|
|
10
|
+
// Re-export mobile components
|
|
11
|
+
export { default as MobileNavBar } from './mobile/NavBar';
|
|
@@ -4,10 +4,10 @@ import { Icon } from '@lobehub/ui';
|
|
|
4
4
|
import { TabBar, type TabBarProps } from '@lobehub/ui/mobile';
|
|
5
5
|
import { createStyles } from 'antd-style';
|
|
6
6
|
import { Compass, MessageSquare, User } from 'lucide-react';
|
|
7
|
-
import { useRouter } from 'next/navigation';
|
|
8
7
|
import { rgba } from 'polished';
|
|
9
8
|
import { memo, useMemo } from 'react';
|
|
10
9
|
import { useTranslation } from 'react-i18next';
|
|
10
|
+
import { useNavigate } from 'react-router-dom';
|
|
11
11
|
|
|
12
12
|
import { MOBILE_TABBAR_HEIGHT } from '@/const/layoutTokens';
|
|
13
13
|
import { useActiveTabKey } from '@/hooks/useActiveTabKey';
|
|
@@ -32,7 +32,7 @@ const NavBar = memo(() => {
|
|
|
32
32
|
const { t } = useTranslation('common');
|
|
33
33
|
const { styles } = useStyles();
|
|
34
34
|
const activeKey = useActiveTabKey();
|
|
35
|
-
const
|
|
35
|
+
const navigate = useNavigate();
|
|
36
36
|
|
|
37
37
|
const { showMarket } = useServerConfigStore(featureFlagsSelectors);
|
|
38
38
|
|
|
@@ -45,7 +45,7 @@ const NavBar = memo(() => {
|
|
|
45
45
|
),
|
|
46
46
|
key: SidebarTabKey.Chat,
|
|
47
47
|
onClick: () => {
|
|
48
|
-
|
|
48
|
+
navigate('/chat');
|
|
49
49
|
},
|
|
50
50
|
title: t('tab.chat'),
|
|
51
51
|
},
|
|
@@ -55,7 +55,7 @@ const NavBar = memo(() => {
|
|
|
55
55
|
),
|
|
56
56
|
key: SidebarTabKey.Discover,
|
|
57
57
|
onClick: () => {
|
|
58
|
-
|
|
58
|
+
navigate('/discover');
|
|
59
59
|
},
|
|
60
60
|
title: t('tab.discover'),
|
|
61
61
|
},
|
|
@@ -65,7 +65,7 @@ const NavBar = memo(() => {
|
|
|
65
65
|
),
|
|
66
66
|
key: SidebarTabKey.Me,
|
|
67
67
|
onClick: () => {
|
|
68
|
-
|
|
68
|
+
navigate('/me');
|
|
69
69
|
},
|
|
70
70
|
title: t('tab.me'),
|
|
71
71
|
},
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import dynamic from 'next/dynamic';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Outlet, useLocation } from 'react-router-dom';
|
|
6
6
|
|
|
7
7
|
import { withSuspense } from '@/components/withSuspense';
|
|
8
8
|
import { useShowMobileWorkspace } from '@/hooks/useShowMobileWorkspace';
|
|
9
|
+
import { Locales } from '@/locales/resources';
|
|
9
10
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
10
11
|
|
|
11
12
|
import NavBar from './NavBar';
|
|
@@ -22,9 +23,11 @@ const MOBILE_NAV_ROUTES = new Set([
|
|
|
22
23
|
'/me',
|
|
23
24
|
]);
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
export const MobileMainLayout = memo((props: { locale: Locales }) => {
|
|
27
|
+
const { locale } = props;
|
|
26
28
|
const showMobileWorkspace = useShowMobileWorkspace();
|
|
27
|
-
const
|
|
29
|
+
const location = useLocation();
|
|
30
|
+
const pathname = location.pathname;
|
|
28
31
|
const showNav = !showMobileWorkspace && MOBILE_NAV_ROUTES.has(pathname);
|
|
29
32
|
|
|
30
33
|
const { showCloudPromotion } = useServerConfigStore(featureFlagsSelectors);
|
|
@@ -32,12 +35,12 @@ const Layout = memo(({ children }: PropsWithChildren) => {
|
|
|
32
35
|
return (
|
|
33
36
|
<>
|
|
34
37
|
{showCloudPromotion && <CloudBanner mobile />}
|
|
35
|
-
{
|
|
38
|
+
<Outlet context={{ locale: locale }} />
|
|
36
39
|
{showNav && <NavBar />}
|
|
37
40
|
</>
|
|
38
41
|
);
|
|
39
42
|
});
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
MobileMainLayout.displayName = 'MobileMainLayout';
|
|
42
45
|
|
|
43
|
-
export default withSuspense(
|
|
46
|
+
export default withSuspense(MobileMainLayout);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Skeleton } from 'antd';
|
|
4
|
+
import dynamic from 'next/dynamic';
|
|
5
|
+
import { memo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { enableClerk } from '@/const/auth';
|
|
8
|
+
|
|
9
|
+
import ProfileClient from './Client';
|
|
10
|
+
|
|
11
|
+
const ClerkProfile = dynamic(() => import('../features/ClerkProfile'), {
|
|
12
|
+
loading: () => (
|
|
13
|
+
<div style={{ flex: 1 }}>
|
|
14
|
+
<Skeleton paragraph={{ rows: 8 }} title={false} />
|
|
15
|
+
</div>
|
|
16
|
+
),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const DesktopProfileHomePage = memo(() => {
|
|
20
|
+
const mobile = false;
|
|
21
|
+
return enableClerk ? <ClerkProfile mobile={mobile} /> : <ProfileClient mobile={mobile} />;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
DesktopProfileHomePage.displayName = 'DesktopProfileHomePage';
|
|
25
|
+
|
|
26
|
+
export default DesktopProfileHomePage;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Skeleton } from 'antd';
|
|
4
|
+
import dynamic from 'next/dynamic';
|
|
5
|
+
import { memo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { enableClerk } from '@/const/auth';
|
|
8
|
+
|
|
9
|
+
import ProfileClient from './Client';
|
|
10
|
+
|
|
11
|
+
const ClerkProfile = dynamic(() => import('../features/ClerkProfile'), {
|
|
12
|
+
loading: () => (
|
|
13
|
+
<div style={{ flex: 1 }}>
|
|
14
|
+
<Skeleton paragraph={{ rows: 8 }} title={false} />
|
|
15
|
+
</div>
|
|
16
|
+
),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const MobileProfileHomePage = memo(() => {
|
|
20
|
+
const mobile = true;
|
|
21
|
+
return enableClerk ? <ClerkProfile mobile={mobile} /> : <ProfileClient mobile={mobile} />;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
MobileProfileHomePage.displayName = 'MobileProfileHomePage';
|
|
25
|
+
|
|
26
|
+
export default MobileProfileHomePage;
|