@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,7 +1,7 @@
|
|
|
1
1
|
name: Desktop PR Build
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
4
|
+
pull_request:
|
|
5
5
|
types: [synchronize, labeled, unlabeled] # PR 更新或标签变化时触发
|
|
6
6
|
|
|
7
7
|
# 确保同一 PR 同一时间只运行一个相同的 workflow,取消正在进行的旧的运行
|
|
@@ -126,6 +126,7 @@ jobs:
|
|
|
126
126
|
run: npm run workflow:set-desktop-version ${{ needs.version.outputs.version }} nightly
|
|
127
127
|
|
|
128
128
|
# macOS 构建处理
|
|
129
|
+
# 注意:fork 的 PR 无法访问 secrets,会构建未签名版本
|
|
129
130
|
- name: Build artifact on macOS
|
|
130
131
|
if: runner.os == 'macOS'
|
|
131
132
|
run: npm run desktop:build
|
|
@@ -136,7 +137,7 @@ jobs:
|
|
|
136
137
|
DATABASE_URL: "postgresql://postgres@localhost:5432/postgres"
|
|
137
138
|
# 默认添加一个加密 SECRET
|
|
138
139
|
KEY_VAULTS_SECRET: "oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE="
|
|
139
|
-
# macOS
|
|
140
|
+
# macOS 签名和公证配置(fork 的 PR 访问不到 secrets,会跳过签名)
|
|
140
141
|
CSC_LINK: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
|
|
141
142
|
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
142
143
|
NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_PROJECT_ID }}
|
|
@@ -148,7 +149,8 @@ jobs:
|
|
|
148
149
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
|
149
150
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
150
151
|
|
|
151
|
-
#
|
|
152
|
+
# Windows 平台构建处理
|
|
153
|
+
# 注意:fork 的 PR 无法访问 secrets,会构建未签名版本
|
|
152
154
|
- name: Build artifact on Windows
|
|
153
155
|
if: runner.os == 'Windows'
|
|
154
156
|
run: npm run desktop:build
|
|
@@ -275,6 +277,8 @@ jobs:
|
|
|
275
277
|
publish-pr:
|
|
276
278
|
needs: [merge-mac-files, version]
|
|
277
279
|
name: Publish PR Build
|
|
280
|
+
# 只为非 fork 的 PR 发布(fork 的 PR 没有写权限)
|
|
281
|
+
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
278
282
|
runs-on: ubuntu-latest
|
|
279
283
|
# Grant write permissions for creating release and commenting on PR
|
|
280
284
|
permissions:
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.74](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.73...v2.0.0-next.74)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-11-17**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Edit local file render & intervention.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Edit local file render & intervention, closes [#10269](https://github.com/lobehub/lobe-chat/issues/10269) ([3785a71](https://github.com/lobehub/lobe-chat/commit/3785a71))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## [Version 2.0.0-next.73](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.72...v2.0.0-next.73)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2025-11-17**</sup>
|
|
33
|
+
|
|
34
|
+
#### ✨ Features
|
|
35
|
+
|
|
36
|
+
- **misc**: Support parallel topic agent runtime.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's improved
|
|
44
|
+
|
|
45
|
+
- **misc**: Support parallel topic agent runtime, closes [#10273](https://github.com/lobehub/lobe-chat/issues/10273) ([02eba3c](https://github.com/lobehub/lobe-chat/commit/02eba3c))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 2.0.0-next.72](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.71...v2.0.0-next.72)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2025-11-17**</sup>
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
WriteLocalFileParams,
|
|
19
19
|
} from '@lobechat/electron-client-ipc';
|
|
20
20
|
import { SYSTEM_FILES_TO_IGNORE, loadFile } from '@lobechat/file-loaders';
|
|
21
|
+
import { createPatch } from 'diff';
|
|
21
22
|
import { shell } from 'electron';
|
|
22
23
|
import fg from 'fast-glob';
|
|
23
24
|
import { Stats, constants } from 'node:fs';
|
|
@@ -94,26 +95,45 @@ export default class LocalFileCtr extends ControllerModule {
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
@ipcClientEvent('readLocalFile')
|
|
97
|
-
async readFile({
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
async readFile({
|
|
99
|
+
path: filePath,
|
|
100
|
+
loc,
|
|
101
|
+
fullContent,
|
|
102
|
+
}: LocalReadFileParams): Promise<LocalReadFileResult> {
|
|
103
|
+
const effectiveLoc = fullContent ? undefined : (loc ?? [0, 200]);
|
|
104
|
+
logger.debug('Starting to read file:', { filePath, fullContent, loc: effectiveLoc });
|
|
100
105
|
|
|
101
106
|
try {
|
|
102
107
|
const fileDocument = await loadFile(filePath);
|
|
103
108
|
|
|
104
|
-
const [startLine, endLine] = effectiveLoc;
|
|
105
109
|
const lines = fileDocument.content.split('\n');
|
|
106
110
|
const totalLineCount = lines.length;
|
|
107
111
|
const totalCharCount = fileDocument.content.length;
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
let content: string;
|
|
114
|
+
let charCount: number;
|
|
115
|
+
let lineCount: number;
|
|
116
|
+
let actualLoc: [number, number];
|
|
117
|
+
|
|
118
|
+
if (effectiveLoc === undefined) {
|
|
119
|
+
// Return full content
|
|
120
|
+
content = fileDocument.content;
|
|
121
|
+
charCount = totalCharCount;
|
|
122
|
+
lineCount = totalLineCount;
|
|
123
|
+
actualLoc = [0, totalLineCount];
|
|
124
|
+
} else {
|
|
125
|
+
// Return specified range
|
|
126
|
+
const [startLine, endLine] = effectiveLoc;
|
|
127
|
+
const selectedLines = lines.slice(startLine, endLine);
|
|
128
|
+
content = selectedLines.join('\n');
|
|
129
|
+
charCount = content.length;
|
|
130
|
+
lineCount = selectedLines.length;
|
|
131
|
+
actualLoc = effectiveLoc;
|
|
132
|
+
}
|
|
114
133
|
|
|
115
134
|
logger.debug('File read successfully:', {
|
|
116
135
|
filePath,
|
|
136
|
+
fullContent,
|
|
117
137
|
selectedLineCount: lineCount,
|
|
118
138
|
totalCharCount,
|
|
119
139
|
totalLineCount,
|
|
@@ -128,7 +148,7 @@ export default class LocalFileCtr extends ControllerModule {
|
|
|
128
148
|
fileType: fileDocument.fileType,
|
|
129
149
|
filename: fileDocument.filename,
|
|
130
150
|
lineCount,
|
|
131
|
-
loc:
|
|
151
|
+
loc: actualLoc,
|
|
132
152
|
// Line count for the selected range
|
|
133
153
|
modifiedTime: fileDocument.modifiedTime,
|
|
134
154
|
|
|
@@ -711,8 +731,32 @@ export default class LocalFileCtr extends ControllerModule {
|
|
|
711
731
|
// Write back to file
|
|
712
732
|
await writeFile(filePath, newContent, 'utf8');
|
|
713
733
|
|
|
714
|
-
|
|
734
|
+
// Generate diff for UI display
|
|
735
|
+
const patch = createPatch(filePath, content, newContent, '', '');
|
|
736
|
+
const diffText = `diff --git a${filePath} b${filePath}\n${patch}`;
|
|
737
|
+
|
|
738
|
+
// Calculate lines added and deleted from patch
|
|
739
|
+
const patchLines = patch.split('\n');
|
|
740
|
+
let linesAdded = 0;
|
|
741
|
+
let linesDeleted = 0;
|
|
742
|
+
|
|
743
|
+
for (const line of patchLines) {
|
|
744
|
+
if (line.startsWith('+') && !line.startsWith('+++')) {
|
|
745
|
+
linesAdded++;
|
|
746
|
+
} else if (line.startsWith('-') && !line.startsWith('---')) {
|
|
747
|
+
linesDeleted++;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
logger.info(`${logPrefix} File edited successfully`, {
|
|
752
|
+
linesAdded,
|
|
753
|
+
linesDeleted,
|
|
754
|
+
replacements,
|
|
755
|
+
});
|
|
715
756
|
return {
|
|
757
|
+
diffText,
|
|
758
|
+
linesAdded,
|
|
759
|
+
linesDeleted,
|
|
716
760
|
replacements,
|
|
717
761
|
success: true,
|
|
718
762
|
};
|
|
@@ -183,6 +183,26 @@ describe('LocalFileCtr', () => {
|
|
|
183
183
|
expect(result.totalLineCount).toBe(5);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
+
it('should read full file content when fullContent is true', async () => {
|
|
187
|
+
const mockFileContent = 'line1\nline2\nline3\nline4\nline5';
|
|
188
|
+
vi.mocked(mockLoadFile).mockResolvedValue({
|
|
189
|
+
content: mockFileContent,
|
|
190
|
+
filename: 'test.txt',
|
|
191
|
+
fileType: 'txt',
|
|
192
|
+
createdTime: new Date('2024-01-01'),
|
|
193
|
+
modifiedTime: new Date('2024-01-02'),
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const result = await localFileCtr.readFile({ path: '/test/file.txt', fullContent: true });
|
|
197
|
+
|
|
198
|
+
expect(result.content).toBe(mockFileContent);
|
|
199
|
+
expect(result.lineCount).toBe(5);
|
|
200
|
+
expect(result.charCount).toBe(mockFileContent.length);
|
|
201
|
+
expect(result.totalLineCount).toBe(5);
|
|
202
|
+
expect(result.totalCharCount).toBe(mockFileContent.length);
|
|
203
|
+
expect(result.loc).toEqual([0, 5]);
|
|
204
|
+
});
|
|
205
|
+
|
|
186
206
|
it('should handle file read error', async () => {
|
|
187
207
|
vi.mocked(mockLoadFile).mockRejectedValue(new Error('File not found'));
|
|
188
208
|
|
|
@@ -392,4 +412,137 @@ describe('LocalFileCtr', () => {
|
|
|
392
412
|
});
|
|
393
413
|
});
|
|
394
414
|
});
|
|
415
|
+
|
|
416
|
+
describe('handleEditFile', () => {
|
|
417
|
+
it('should replace first occurrence successfully', async () => {
|
|
418
|
+
const originalContent = 'Hello world\nHello again\nGoodbye world';
|
|
419
|
+
vi.mocked(mockFsPromises.readFile).mockResolvedValue(originalContent);
|
|
420
|
+
vi.mocked(mockFsPromises.writeFile).mockResolvedValue(undefined);
|
|
421
|
+
|
|
422
|
+
const result = await localFileCtr.handleEditFile({
|
|
423
|
+
file_path: '/test/file.txt',
|
|
424
|
+
old_string: 'Hello',
|
|
425
|
+
new_string: 'Hi',
|
|
426
|
+
replace_all: false,
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
expect(result.success).toBe(true);
|
|
430
|
+
expect(result.replacements).toBe(1);
|
|
431
|
+
expect(result.linesAdded).toBe(1);
|
|
432
|
+
expect(result.linesDeleted).toBe(1);
|
|
433
|
+
expect(result.diffText).toContain('diff --git a/test/file.txt b/test/file.txt');
|
|
434
|
+
expect(mockFsPromises.writeFile).toHaveBeenCalledWith(
|
|
435
|
+
'/test/file.txt',
|
|
436
|
+
'Hi world\nHello again\nGoodbye world',
|
|
437
|
+
'utf8',
|
|
438
|
+
);
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('should replace all occurrences when replace_all is true', async () => {
|
|
442
|
+
const originalContent = 'Hello world\nHello again\nHello there';
|
|
443
|
+
vi.mocked(mockFsPromises.readFile).mockResolvedValue(originalContent);
|
|
444
|
+
vi.mocked(mockFsPromises.writeFile).mockResolvedValue(undefined);
|
|
445
|
+
|
|
446
|
+
const result = await localFileCtr.handleEditFile({
|
|
447
|
+
file_path: '/test/file.txt',
|
|
448
|
+
old_string: 'Hello',
|
|
449
|
+
new_string: 'Hi',
|
|
450
|
+
replace_all: true,
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
expect(result.success).toBe(true);
|
|
454
|
+
expect(result.replacements).toBe(3);
|
|
455
|
+
expect(result.linesAdded).toBe(3);
|
|
456
|
+
expect(result.linesDeleted).toBe(3);
|
|
457
|
+
expect(mockFsPromises.writeFile).toHaveBeenCalledWith(
|
|
458
|
+
'/test/file.txt',
|
|
459
|
+
'Hi world\nHi again\nHi there',
|
|
460
|
+
'utf8',
|
|
461
|
+
);
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
it('should handle multiline replacement correctly', async () => {
|
|
465
|
+
const originalContent = 'function test() {\n console.log("old");\n}';
|
|
466
|
+
vi.mocked(mockFsPromises.readFile).mockResolvedValue(originalContent);
|
|
467
|
+
vi.mocked(mockFsPromises.writeFile).mockResolvedValue(undefined);
|
|
468
|
+
|
|
469
|
+
const result = await localFileCtr.handleEditFile({
|
|
470
|
+
file_path: '/test/file.js',
|
|
471
|
+
old_string: 'console.log("old");',
|
|
472
|
+
new_string: 'console.log("new");\n console.log("added");',
|
|
473
|
+
replace_all: false,
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
expect(result.success).toBe(true);
|
|
477
|
+
expect(result.replacements).toBe(1);
|
|
478
|
+
expect(result.linesAdded).toBe(2);
|
|
479
|
+
expect(result.linesDeleted).toBe(1);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
it('should return error when old_string is not found', async () => {
|
|
483
|
+
const originalContent = 'Hello world';
|
|
484
|
+
vi.mocked(mockFsPromises.readFile).mockResolvedValue(originalContent);
|
|
485
|
+
|
|
486
|
+
const result = await localFileCtr.handleEditFile({
|
|
487
|
+
file_path: '/test/file.txt',
|
|
488
|
+
old_string: 'NonExistent',
|
|
489
|
+
new_string: 'New',
|
|
490
|
+
replace_all: false,
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
expect(result.success).toBe(false);
|
|
494
|
+
expect(result.error).toBe('The specified old_string was not found in the file');
|
|
495
|
+
expect(result.replacements).toBe(0);
|
|
496
|
+
expect(mockFsPromises.writeFile).not.toHaveBeenCalled();
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
it('should handle file read error', async () => {
|
|
500
|
+
vi.mocked(mockFsPromises.readFile).mockRejectedValue(new Error('Permission denied'));
|
|
501
|
+
|
|
502
|
+
const result = await localFileCtr.handleEditFile({
|
|
503
|
+
file_path: '/test/file.txt',
|
|
504
|
+
old_string: 'Hello',
|
|
505
|
+
new_string: 'Hi',
|
|
506
|
+
replace_all: false,
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
expect(result.success).toBe(false);
|
|
510
|
+
expect(result.error).toBe('Permission denied');
|
|
511
|
+
expect(result.replacements).toBe(0);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
it('should handle file write error', async () => {
|
|
515
|
+
const originalContent = 'Hello world';
|
|
516
|
+
vi.mocked(mockFsPromises.readFile).mockResolvedValue(originalContent);
|
|
517
|
+
vi.mocked(mockFsPromises.writeFile).mockRejectedValue(new Error('Disk full'));
|
|
518
|
+
|
|
519
|
+
const result = await localFileCtr.handleEditFile({
|
|
520
|
+
file_path: '/test/file.txt',
|
|
521
|
+
old_string: 'Hello',
|
|
522
|
+
new_string: 'Hi',
|
|
523
|
+
replace_all: false,
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
expect(result.success).toBe(false);
|
|
527
|
+
expect(result.error).toBe('Disk full');
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
it('should generate correct diff format', async () => {
|
|
531
|
+
const originalContent = 'line 1\nline 2\nline 3';
|
|
532
|
+
vi.mocked(mockFsPromises.readFile).mockResolvedValue(originalContent);
|
|
533
|
+
vi.mocked(mockFsPromises.writeFile).mockResolvedValue(undefined);
|
|
534
|
+
|
|
535
|
+
const result = await localFileCtr.handleEditFile({
|
|
536
|
+
file_path: '/test/file.txt',
|
|
537
|
+
old_string: 'line 2',
|
|
538
|
+
new_string: 'modified line 2',
|
|
539
|
+
replace_all: false,
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
expect(result.success).toBe(true);
|
|
543
|
+
expect(result.diffText).toContain('diff --git a/test/file.txt b/test/file.txt');
|
|
544
|
+
expect(result.diffText).toContain('-line 2');
|
|
545
|
+
expect(result.diffText).toContain('+modified line 2');
|
|
546
|
+
});
|
|
547
|
+
});
|
|
395
548
|
});
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"features": [
|
|
5
|
+
"Edit local file render & intervention."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2025-11-17",
|
|
9
|
+
"version": "2.0.0-next.74"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {
|
|
13
|
+
"features": [
|
|
14
|
+
"Support parallel topic agent runtime."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"date": "2025-11-17",
|
|
18
|
+
"version": "2.0.0-next.73"
|
|
19
|
+
},
|
|
2
20
|
{
|
|
3
21
|
"children": {
|
|
4
22
|
"improvements": [
|
package/locales/en-US/tool.json
CHANGED
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"prompt": "Prompt"
|
|
16
16
|
},
|
|
17
17
|
"localFiles": {
|
|
18
|
+
"editFile": {
|
|
19
|
+
"newString": "Replace with",
|
|
20
|
+
"oldString": "Find",
|
|
21
|
+
"replaceAll": "Replace all occurrences",
|
|
22
|
+
"replaceFirst": "Replace first occurrence only"
|
|
23
|
+
},
|
|
18
24
|
"file": "File",
|
|
19
25
|
"folder": "Folder",
|
|
20
26
|
"moveFiles": {
|
|
@@ -34,7 +40,12 @@
|
|
|
34
40
|
"readFile": "Read File",
|
|
35
41
|
"readFileError": "Failed to read file, please check if the file path is correct",
|
|
36
42
|
"readFiles": "Read Files",
|
|
37
|
-
"readFilesError": "Failed to read files, please check if the file path is correct"
|
|
43
|
+
"readFilesError": "Failed to read files, please check if the file path is correct",
|
|
44
|
+
"writeFile": {
|
|
45
|
+
"characters": "characters",
|
|
46
|
+
"preview": "Content Preview",
|
|
47
|
+
"truncated": "truncated"
|
|
48
|
+
}
|
|
38
49
|
},
|
|
39
50
|
"search": {
|
|
40
51
|
"createNewSearch": "Create a new search record",
|
package/locales/zh-CN/tool.json
CHANGED
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"prompt": "提示词"
|
|
16
16
|
},
|
|
17
17
|
"localFiles": {
|
|
18
|
+
"editFile": {
|
|
19
|
+
"newString": "替换为",
|
|
20
|
+
"oldString": "查找内容",
|
|
21
|
+
"replaceAll": "替换全部匹配项",
|
|
22
|
+
"replaceFirst": "仅替换第一个匹配项"
|
|
23
|
+
},
|
|
18
24
|
"file": "文件",
|
|
19
25
|
"folder": "文件夹",
|
|
20
26
|
"moveFiles": {
|
|
@@ -34,7 +40,12 @@
|
|
|
34
40
|
"readFile": "读取文件",
|
|
35
41
|
"readFileError": "读取文件失败,请检查文件路径是否正确",
|
|
36
42
|
"readFiles": "读取文件",
|
|
37
|
-
"readFilesError": "读取文件失败,请检查文件路径是否正确"
|
|
43
|
+
"readFilesError": "读取文件失败,请检查文件路径是否正确",
|
|
44
|
+
"writeFile": {
|
|
45
|
+
"characters": "字符",
|
|
46
|
+
"preview": "内容预览",
|
|
47
|
+
"truncated": "已截断"
|
|
48
|
+
}
|
|
38
49
|
},
|
|
39
50
|
"search": {
|
|
40
51
|
"createNewSearch": "创建新的搜索记录",
|
package/next.config.ts
CHANGED
|
@@ -249,11 +249,11 @@ const nextConfig: NextConfig = {
|
|
|
249
249
|
// permanent: true,
|
|
250
250
|
// source: '/settings',
|
|
251
251
|
// },
|
|
252
|
-
{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
},
|
|
252
|
+
// {
|
|
253
|
+
// destination: '/chat',
|
|
254
|
+
// permanent: false,
|
|
255
|
+
// source: '/',
|
|
256
|
+
// },
|
|
257
257
|
{
|
|
258
258
|
destination: '/chat',
|
|
259
259
|
permanent: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.74",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -258,6 +258,7 @@
|
|
|
258
258
|
"random-words": "^2.0.1",
|
|
259
259
|
"react": "19.2.0",
|
|
260
260
|
"react-confetti": "^6.4.0",
|
|
261
|
+
"react-diff-view": "^3.3.2",
|
|
261
262
|
"react-dom": "19.2.0",
|
|
262
263
|
"react-fast-marquee": "^1.6.5",
|
|
263
264
|
"react-hotkeys-hook": "^5.2.1",
|
|
@@ -48,6 +48,7 @@ export interface RenameLocalFileResult {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export interface LocalReadFileParams {
|
|
51
|
+
fullContent?: boolean;
|
|
51
52
|
loc?: [number, number];
|
|
52
53
|
path: string;
|
|
53
54
|
}
|
|
@@ -217,7 +218,10 @@ export interface EditLocalFileParams {
|
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
export interface EditLocalFileResult {
|
|
221
|
+
diffText?: string;
|
|
220
222
|
error?: string;
|
|
223
|
+
linesAdded?: number;
|
|
224
|
+
linesDeleted?: number;
|
|
221
225
|
replacements: number;
|
|
222
226
|
success: boolean;
|
|
223
227
|
}
|
package/scripts/prebuild.mts
CHANGED
|
@@ -13,18 +13,18 @@ const partialBuildPages = [
|
|
|
13
13
|
{
|
|
14
14
|
name: 'changelog',
|
|
15
15
|
disabled: isDesktop,
|
|
16
|
-
paths: ['src/app/[variants]
|
|
16
|
+
paths: ['src/app/[variants]/(main)/changelog'],
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
name: 'auth',
|
|
20
20
|
disabled: isDesktop,
|
|
21
21
|
paths: ['src/app/[variants]/(auth)'],
|
|
22
22
|
},
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
23
|
+
// {
|
|
24
|
+
// name: 'mobile',
|
|
25
|
+
// disabled: isDesktop,
|
|
26
|
+
// paths: ['src/app/[variants]/(main)/(mobile)'],
|
|
27
|
+
// },
|
|
28
28
|
{
|
|
29
29
|
name: 'oauth',
|
|
30
30
|
disabled: isDesktop,
|
|
@@ -35,6 +35,16 @@ const partialBuildPages = [
|
|
|
35
35
|
disabled: isDesktop,
|
|
36
36
|
paths: ['src/app/(backend)/api/webhooks'],
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
name: 'market-auth',
|
|
40
|
+
disabled: isDesktop,
|
|
41
|
+
paths: ['src/app/market-auth-callback'],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'pwa',
|
|
45
|
+
disabled: isDesktop,
|
|
46
|
+
paths: ['src/manifest.ts', 'src/sitemap.tsx', 'src/robots.tsx', 'src/sw'],
|
|
47
|
+
},
|
|
38
48
|
// no need for web
|
|
39
49
|
{
|
|
40
50
|
name: 'desktop-devtools',
|
|
@@ -17,12 +17,12 @@ const handler = (req: NextRequest) => {
|
|
|
17
17
|
*/
|
|
18
18
|
createContext: () => createLambdaContext(req),
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
endpoint: '/trpc/desktop',
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
onError: ({ error, path, type }) => {
|
|
23
|
+
pino.info(`Error in tRPC handler (desktop) on path: ${path}, type: ${type}`);
|
|
24
|
+
console.error(error);
|
|
25
|
+
},
|
|
26
26
|
|
|
27
27
|
req: preparedReq,
|
|
28
28
|
responseMeta({ ctx }) {
|
|
@@ -34,4 +34,4 @@ const handler = (req: NextRequest) => {
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export { handler as GET, handler as POST };
|
|
37
|
+
export { handler as GET, handler as POST };
|
|
@@ -6,10 +6,12 @@ import { useUserStore } from '@/store/user';
|
|
|
6
6
|
import UserBanner from '../features/UserBanner';
|
|
7
7
|
|
|
8
8
|
// Mock dependencies
|
|
9
|
-
vi.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const mockNavigate = vi.fn();
|
|
10
|
+
vi.mock('react-router-dom', () => ({
|
|
11
|
+
Link: ({ to, children }: { to: string; children: React.ReactNode }) => (
|
|
12
|
+
<a href={to}>{children}</a>
|
|
13
|
+
),
|
|
14
|
+
useNavigate: () => mockNavigate,
|
|
13
15
|
}));
|
|
14
16
|
|
|
15
17
|
vi.mock('@/features/User/UserInfo', () => ({
|
|
@@ -45,6 +47,7 @@ vi.mock('@/const/auth', () => ({
|
|
|
45
47
|
|
|
46
48
|
afterEach(() => {
|
|
47
49
|
enableAuth = true;
|
|
50
|
+
mockNavigate.mockReset();
|
|
48
51
|
});
|
|
49
52
|
|
|
50
53
|
describe('UserBanner', () => {
|
|
@@ -11,10 +11,9 @@ const wrapper: React.JSXElementConstructor<{ children: React.ReactNode }> = ({ c
|
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
// Mock dependencies
|
|
14
|
-
vi.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})),
|
|
14
|
+
const mockNavigate = vi.fn();
|
|
15
|
+
vi.mock('react-router-dom', () => ({
|
|
16
|
+
useNavigate: () => mockNavigate,
|
|
18
17
|
}));
|
|
19
18
|
|
|
20
19
|
vi.mock('react-i18next', () => ({
|
|
@@ -48,6 +47,7 @@ vi.mock('@/const/version', async (importOriginal) => {
|
|
|
48
47
|
afterEach(() => {
|
|
49
48
|
enableAuth = true;
|
|
50
49
|
enableClerk = true;
|
|
50
|
+
mockNavigate.mockReset();
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
describe('useCategory', () => {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import Link from 'next/link';
|
|
4
|
-
import { useRouter } from 'next/navigation';
|
|
5
3
|
import { memo } from 'react';
|
|
4
|
+
import { Link, useNavigate } from 'react-router-dom';
|
|
6
5
|
import { Flexbox } from 'react-layout-kit';
|
|
7
6
|
|
|
8
7
|
import { enableAuth, enableNextAuth } from '@/const/auth';
|
|
@@ -13,7 +12,7 @@ import { useUserStore } from '@/store/user';
|
|
|
13
12
|
import { authSelectors } from '@/store/user/selectors';
|
|
14
13
|
|
|
15
14
|
const UserBanner = memo(() => {
|
|
16
|
-
const
|
|
15
|
+
const navigate = useNavigate();
|
|
17
16
|
const isLoginWithAuth = useUserStore(authSelectors.isLoginWithAuth);
|
|
18
17
|
const [signIn] = useUserStore((s) => [s.openLogin]);
|
|
19
18
|
|
|
@@ -21,10 +20,10 @@ const UserBanner = memo(() => {
|
|
|
21
20
|
<Flexbox gap={12} paddingBlock={8}>
|
|
22
21
|
{!enableAuth || (enableAuth && isLoginWithAuth) ? (
|
|
23
22
|
<>
|
|
24
|
-
<Link
|
|
23
|
+
<Link style={{ color: 'inherit' }} to="/profile">
|
|
25
24
|
<UserInfo />
|
|
26
25
|
</Link>
|
|
27
|
-
<Link
|
|
26
|
+
<Link style={{ color: 'inherit' }} to="/profile/stats">
|
|
28
27
|
<DataStatistics paddingInline={12} />
|
|
29
28
|
</Link>
|
|
30
29
|
</>
|
|
@@ -36,7 +35,7 @@ const UserBanner = memo(() => {
|
|
|
36
35
|
signIn();
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
navigate('/login');
|
|
40
39
|
}}
|
|
41
40
|
/>
|
|
42
41
|
)}
|