@lobehub/chat 0.84.0-beta.1 → 0.84.0
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/lighthouse-badger-advanced.yml +92 -0
- package/.github/workflows/release.yml +0 -3
- package/.github/workflows/sync.yml +9 -2
- package/.releaserc.js +1 -14
- package/CHANGELOG.md +41 -4
- package/README.md +21 -0
- package/README.zh-CN.md +21 -0
- package/docs/Home.md +1 -0
- package/docs/Lighthouse.md +65 -0
- package/docs/Lighthouse.zh-CN.md +65 -0
- package/docs/_Sidebar.md +1 -0
- package/locales/en_US/common.json +5 -0
- package/locales/ru_RU/common.json +5 -0
- package/locales/zh_CN/common.json +5 -0
- package/locales/zh_TW/common.json +5 -0
- package/next.config.mjs +0 -3
- package/package.json +4 -4
- package/src/app/chat/(desktop)/features/{ChatHeader/Desktop.tsx → ChatHeader.tsx} +2 -2
- package/src/app/chat/(desktop)/features/{ChatInput/Desktop.tsx → ChatInput.tsx} +5 -7
- package/src/app/chat/(desktop)/features/{SessionHeader/Desktop.tsx → SessionHeader.tsx} +1 -1
- package/src/app/chat/(desktop)/features/{SessionList/Desktop.tsx → SessionList.tsx} +5 -4
- package/src/app/chat/(desktop)/features/{SideBar/Desktop.tsx → SideBar.tsx} +5 -4
- package/src/app/chat/(desktop)/index.tsx +14 -8
- package/src/app/chat/(desktop)/{layout/Desktop.tsx → layout.desktop.tsx} +7 -8
- package/src/app/chat/(desktop)/layout.responsive.tsx +12 -0
- package/src/app/chat/(mobile)/features/ChatHeader.tsx +54 -1
- package/src/app/chat/(mobile)/features/ChatInput.tsx +28 -8
- package/src/app/chat/(mobile)/features/SessionList.tsx +13 -8
- package/src/app/chat/{components/Inspector/Mobile.tsx → (mobile)/features/TopicList.tsx} +6 -4
- package/src/app/chat/(mobile)/index.tsx +3 -5
- package/src/app/chat/(mobile)/layout.mobile.tsx +17 -0
- package/src/app/chat/(mobile)/mobile/index.tsx +19 -0
- package/src/app/chat/(mobile)/mobile/layout.mobile.tsx +11 -0
- package/src/app/chat/(mobile)/mobile/page.tsx +2 -20
- package/src/app/chat/{components → features}/ChatHeader/ShareButton/Preview.tsx +25 -9
- package/src/app/chat/{components → features}/ChatHeader/ShareButton/style.ts +7 -7
- package/src/app/chat/{components/ChatInput → features/ChatInputContent}/index.tsx +3 -1
- package/src/app/chat/{components/SessionList → features/SessionListContent}/Inbox/index.tsx +7 -5
- package/src/app/chat/{components/SessionList → features/SessionListContent}/index.tsx +3 -1
- package/src/app/chat/{components/Inspector → features/TopicListContent}/index.tsx +3 -1
- package/src/app/chat/page.tsx +3 -1
- package/src/app/chat/settings/(desktop)/index.tsx +14 -0
- package/src/app/chat/settings/(desktop)/layout.desktop.tsx +10 -15
- package/src/app/chat/settings/(desktop)/layout.responsive.tsx +12 -0
- package/src/app/chat/settings/(mobile)/index.tsx +14 -0
- package/src/app/chat/settings/(mobile)/layout.mobile.tsx +4 -8
- package/src/app/chat/settings/features/EditPage.tsx +38 -0
- package/src/app/chat/settings/page.tsx +9 -33
- package/src/app/market/(desktop)/{AgentDetail/Desktop.tsx → features/AgentDetail.tsx} +5 -3
- package/src/app/market/(desktop)/index.tsx +12 -0
- package/src/app/market/(desktop)/{layout/Desktop.tsx → layout.desktop.tsx} +5 -5
- package/src/app/market/(desktop)/layout.responsive.tsx +16 -0
- package/src/app/market/{components/AgentDetail/Mobile.tsx → (mobile)/features/AgentDetail.tsx} +6 -4
- package/src/app/market/(mobile)/index.tsx +12 -0
- package/src/app/market/(mobile)/layout.mobile.tsx +5 -5
- package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/Header.tsx +1 -0
- package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/index.tsx +3 -1
- package/src/app/market/features/TagList/index.tsx +2 -1
- package/src/app/market/page.tsx +8 -5
- package/src/app/settings/{features/Header/Desktop.tsx → (desktop)/features/Header.tsx} +2 -2
- package/src/app/settings/(desktop)/index.tsx +17 -0
- package/src/app/settings/{layout.desktop/Desktop.tsx → (desktop)/layout.desktop.tsx} +10 -9
- package/src/app/settings/(desktop)/layout.responsive.tsx +14 -0
- package/src/app/settings/{mobile → (mobile)/features}/ExtraList.tsx +1 -1
- package/src/app/settings/(mobile)/features/Header/Home.tsx +8 -0
- package/src/app/settings/{features/Header/Mobile.tsx → (mobile)/features/Header/index.tsx} +1 -0
- package/src/app/settings/(mobile)/index.tsx +3 -0
- package/src/app/settings/(mobile)/layout.mobile.tsx +19 -0
- package/src/app/settings/{mobile → (mobile)/mobile}/index.tsx +9 -9
- package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +14 -0
- package/src/app/settings/agent/Agent.tsx +30 -0
- package/src/app/settings/agent/index.tsx +23 -0
- package/src/app/settings/agent/layout.tsx +1 -0
- package/src/app/settings/agent/page.tsx +2 -31
- package/src/app/settings/common/index.tsx +23 -0
- package/src/app/settings/common/layout.tsx +1 -0
- package/src/app/settings/common/page.tsx +2 -14
- package/src/app/settings/features/SideBar/index.tsx +2 -0
- package/src/app/settings/features/UpgradeAlert.tsx +32 -0
- package/src/app/settings/layout.server.tsx +12 -0
- package/src/app/settings/llm/index.tsx +23 -0
- package/src/app/settings/llm/layout.tsx +1 -0
- package/src/app/settings/llm/page.tsx +2 -14
- package/src/app/settings/page.tsx +14 -1
- package/src/app/welcome/(desktop)/features/Showcase.tsx +23 -0
- package/src/app/welcome/(desktop)/index.tsx +19 -0
- package/src/app/welcome/{DesktopLayout/Desktop.tsx → (desktop)/layout.desktop.tsx} +4 -4
- package/src/app/welcome/(desktop)/layout.responsive.tsx +14 -0
- package/src/app/welcome/(mobile)/features/Header.tsx +6 -0
- package/src/app/welcome/(mobile)/features/Showcase.tsx +16 -0
- package/src/app/welcome/(mobile)/index.tsx +10 -0
- package/src/app/welcome/(mobile)/layout.mobile.tsx +20 -0
- package/src/app/welcome/features/Banner/Hero.tsx +2 -3
- package/src/app/welcome/features/Banner/index.tsx +34 -31
- package/src/app/welcome/features/Banner/style.ts +10 -1
- package/src/app/welcome/page.tsx +9 -7
- package/src/components/ResponsiveIndex.tsx +17 -0
- package/src/const/version.ts +6 -0
- package/src/features/MobileTabBar/index.tsx +1 -1
- package/src/features/SideBar/BottomActions.tsx +98 -79
- package/src/layout/{AppLayout.tsx → AppLayout.desktop.tsx} +2 -2
- package/src/layout/{AppMobileLayout.tsx → AppLayout.mobile.tsx} +2 -2
- package/src/layout/GlobalLayout/StoreHydration.tsx +15 -1
- package/src/layout/ResponsiveLayout.client.tsx +18 -0
- package/src/{components/ResponsiveLayout.tsx → layout/ResponsiveLayout.server.tsx} +4 -3
- package/src/locales/default/common.ts +5 -0
- package/src/services/latestVersion.ts +11 -1
- package/src/store/global/initialState.ts +11 -9
- package/src/store/global/slices/common.ts +12 -0
- package/src/store/session/slices/session/initialState.ts +2 -2
- package/.dockerignore +0 -10
- package/Dockerfile +0 -46
- package/src/app/chat/(desktop)/features/ChatHeader/index.tsx +0 -14
- package/src/app/chat/(desktop)/features/ChatInput/index.tsx +0 -22
- package/src/app/chat/(desktop)/features/SessionHeader/index.tsx +0 -14
- package/src/app/chat/(desktop)/features/SessionList/index.tsx +0 -20
- package/src/app/chat/(desktop)/features/SideBar/index.tsx +0 -20
- package/src/app/chat/(desktop)/layout/index.tsx +0 -25
- package/src/app/chat/(mobile)/features/Topics.tsx +0 -12
- package/src/app/chat/(mobile)/layout.tsx +0 -15
- package/src/app/chat/components/ChatHeader/Mobile.tsx +0 -54
- package/src/app/chat/components/ChatInput/Mobile.tsx +0 -35
- package/src/app/chat/components/SessionList/Mobile.tsx +0 -16
- package/src/app/chat/layout.tsx +0 -15
- package/src/app/chat/settings/layout.tsx +0 -14
- package/src/app/market/(desktop)/AgentDetail/index.tsx +0 -16
- package/src/app/market/(desktop)/Header/index.tsx +0 -13
- package/src/app/market/(desktop)/layout/index.tsx +0 -17
- package/src/app/market/(mobile)/AgentDetail.tsx +0 -12
- package/src/app/market/layout.tsx +0 -13
- package/src/app/settings/features/Header/index.tsx +0 -14
- package/src/app/settings/layout.desktop/index.tsx +0 -32
- package/src/app/settings/layout.mobile.tsx +0 -16
- package/src/app/settings/layout.tsx +0 -15
- package/src/app/settings/mobile/page.tsx +0 -7
- package/src/app/welcome/DesktopLayout/index.tsx +0 -15
- package/src/app/welcome/MobileLayout.tsx +0 -23
- package/src/app/welcome/layout.tsx +0 -22
- /package/src/app/chat/{components → features}/ChatHeader/PluginTag/PluginStatus.tsx +0 -0
- /package/src/app/chat/{components → features}/ChatHeader/PluginTag/index.tsx +0 -0
- /package/src/app/chat/{components → features}/ChatHeader/ShareButton/Inner.tsx +0 -0
- /package/src/app/chat/{components → features}/ChatHeader/ShareButton/index.tsx +0 -0
- /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/ActionBar/ActionLeft.tsx +0 -0
- /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/ActionBar/ActionRight.tsx +0 -0
- /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/ActionBar/Token.tsx +0 -0
- /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/Footer/SaveTopic.tsx +0 -0
- /package/src/app/chat/{components/ChatInput → features/ChatInputContent}/Footer/index.tsx +0 -0
- /package/src/app/chat/features/{PageTitle.tsx → PageTitle/index.tsx} +0 -0
- /package/src/app/chat/{components/SessionList → features/SessionListContent}/CollapseGroup/index.tsx +0 -0
- /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/AddButton.tsx +0 -0
- /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/Item/Actions.tsx +0 -0
- /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/Item/index.tsx +0 -0
- /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/SkeletonList.tsx +0 -0
- /package/src/app/chat/{components/SessionList → features/SessionListContent}/List/index.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/SystemRole/Header.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/SystemRole/index.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/SystemRole/style.ts +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/DefaultContent.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/SkeletonList.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/TopicContent.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/TopicItem.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/Topic/index.tsx +0 -0
- /package/src/app/chat/{components/Inspector → features/TopicListContent}/TopicSearchBar/index.tsx +0 -0
- /package/src/app/market/(desktop)/{Header/Desktop.tsx → features/Header.tsx} +0 -0
- /package/src/app/market/(mobile)/{Header.tsx → features/Header.tsx} +0 -0
- /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/Comment.tsx +0 -0
- /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/Loading.tsx +0 -0
- /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/TokenTag.tsx +0 -0
- /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/index.tsx +0 -0
- /package/src/app/market/{components/AgentDetail → features/AgentDetailContent}/AgentInfo/style.ts +0 -0
- /package/src/app/welcome/{features/Footer/index.tsx → (desktop)/features/Footer.tsx} +0 -0
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
1
|
import { PropsWithChildren, memo } from 'react';
|
|
4
2
|
|
|
5
|
-
import
|
|
3
|
+
import AppLayoutMobile from '@/layout/AppLayout.mobile';
|
|
6
4
|
|
|
7
5
|
import Header from './Header';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export default MobileLayout;
|
|
7
|
+
export default memo(({ children }: PropsWithChildren) => (
|
|
8
|
+
<AppLayoutMobile navBar={<Header />}>{children}</AppLayoutMobile>
|
|
9
|
+
));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import isEqual from 'fast-deep-equal';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
|
|
7
|
+
import PageTitle from '@/components/PageTitle';
|
|
8
|
+
import AgentSetting from '@/features/AgentSetting';
|
|
9
|
+
import { useSessionStore } from '@/store/session';
|
|
10
|
+
import { agentSelectors } from '@/store/session/selectors';
|
|
11
|
+
import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
|
|
12
|
+
|
|
13
|
+
const EditPage = memo(() => {
|
|
14
|
+
const { t } = useTranslation('setting');
|
|
15
|
+
const config = useSessionStore(agentSelectors.currentAgentConfig, isEqual);
|
|
16
|
+
const meta = useSessionStore(agentSelectors.currentAgentMeta, isEqual);
|
|
17
|
+
const [updateAgentConfig, updateAgentMeta, title] = useSessionStore((s) => [
|
|
18
|
+
s.updateAgentConfig,
|
|
19
|
+
s.updateAgentMeta,
|
|
20
|
+
agentSelectors.currentAgentTitle(s),
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
const pageTitle = genSiteHeadTitle(t('header.sessionWithName', { name: title }));
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<PageTitle title={pageTitle} />
|
|
28
|
+
<AgentSetting
|
|
29
|
+
config={config}
|
|
30
|
+
meta={meta}
|
|
31
|
+
onConfigChange={updateAgentConfig}
|
|
32
|
+
onMetaChange={updateAgentMeta}
|
|
33
|
+
/>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export default EditPage;
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { isMobileDevice } from '@/utils/responsive';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import DesktopPage from './(desktop)';
|
|
4
|
+
import MobilePage from './(mobile)';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { useSessionStore } from '@/store/session';
|
|
10
|
-
import { agentSelectors } from '@/store/session/selectors';
|
|
11
|
-
import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
|
|
6
|
+
const Page = () => {
|
|
7
|
+
const mobile = isMobileDevice();
|
|
12
8
|
|
|
13
|
-
const
|
|
14
|
-
const { t } = useTranslation('setting');
|
|
15
|
-
const config = useSessionStore(agentSelectors.currentAgentConfig, isEqual);
|
|
16
|
-
const meta = useSessionStore(agentSelectors.currentAgentMeta, isEqual);
|
|
17
|
-
const [updateAgentConfig, updateAgentMeta, title] = useSessionStore((s) => [
|
|
18
|
-
s.updateAgentConfig,
|
|
19
|
-
s.updateAgentMeta,
|
|
20
|
-
agentSelectors.currentAgentTitle(s),
|
|
21
|
-
]);
|
|
9
|
+
const Page = mobile ? MobilePage : DesktopPage;
|
|
22
10
|
|
|
23
|
-
|
|
11
|
+
return <Page />;
|
|
12
|
+
};
|
|
24
13
|
|
|
25
|
-
|
|
26
|
-
<>
|
|
27
|
-
<PageTitle title={pageTitle} />
|
|
28
|
-
<AgentSetting
|
|
29
|
-
config={config}
|
|
30
|
-
meta={meta}
|
|
31
|
-
onConfigChange={updateAgentConfig}
|
|
32
|
-
onMetaChange={updateAgentMeta}
|
|
33
|
-
/>
|
|
34
|
-
</>
|
|
35
|
-
);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export default EditPage;
|
|
14
|
+
export default Page;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { DraggablePanel, DraggablePanelBody, DraggablePanelContainer } from '@lobehub/ui';
|
|
2
2
|
import { createStyles } from 'antd-style';
|
|
3
|
-
import {
|
|
3
|
+
import { memo, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import SafeSpacing from '@/components/SafeSpacing';
|
|
6
6
|
import { MARKET_SIDEBAR_WIDTH } from '@/const/layoutTokens';
|
|
7
7
|
import { agentMarketSelectors, useMarketStore } from '@/store/market';
|
|
8
8
|
|
|
9
|
+
import AgentDetailContent from '../../features/AgentDetailContent';
|
|
10
|
+
|
|
9
11
|
const useStyles = createStyles(({ css, token, stylish }) => ({
|
|
10
12
|
content: css`
|
|
11
13
|
display: flex;
|
|
@@ -20,7 +22,7 @@ const useStyles = createStyles(({ css, token, stylish }) => ({
|
|
|
20
22
|
noScrollbar: stylish.noScrollbar,
|
|
21
23
|
}));
|
|
22
24
|
|
|
23
|
-
const SideBar = memo
|
|
25
|
+
const SideBar = memo(() => {
|
|
24
26
|
const { styles } = useStyles();
|
|
25
27
|
const [tempId, setTempId] = useState<string>('');
|
|
26
28
|
const [showAgentSidebar, deactivateAgent, activateAgent] = useMarketStore((s) => [
|
|
@@ -60,7 +62,7 @@ const SideBar = memo<{ children?: ReactNode }>(({ children }) => {
|
|
|
60
62
|
className={styles.noScrollbar}
|
|
61
63
|
style={{ padding: 0, position: 'relative' }}
|
|
62
64
|
>
|
|
63
|
-
|
|
65
|
+
<AgentDetailContent />
|
|
64
66
|
</DraggablePanelBody>
|
|
65
67
|
</DraggablePanelContainer>
|
|
66
68
|
</DraggablePanel>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { AgentCardProps } from '@/app/market/features/AgentCard';
|
|
4
|
+
|
|
5
|
+
import Index from '../index';
|
|
6
|
+
import Layout from './layout.responsive';
|
|
7
|
+
|
|
8
|
+
export default memo<AgentCardProps>((props) => (
|
|
9
|
+
<Layout>
|
|
10
|
+
<Index {...props} />
|
|
11
|
+
</Layout>
|
|
12
|
+
));
|
|
@@ -5,12 +5,12 @@ import { Center, Flexbox } from 'react-layout-kit';
|
|
|
5
5
|
|
|
6
6
|
import SafeSpacing from '@/components/SafeSpacing';
|
|
7
7
|
import { MAX_WIDTH } from '@/const/layoutTokens';
|
|
8
|
+
import AppLayoutDesktop from '@/layout/AppLayout.desktop';
|
|
8
9
|
import { useSwitchSideBarOnInit } from '@/store/global';
|
|
9
10
|
import { SidebarTabKey } from '@/store/global/initialState';
|
|
10
11
|
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import Header from '../Header';
|
|
12
|
+
import SideBar from './features/AgentDetail';
|
|
13
|
+
import Header from './features/Header';
|
|
14
14
|
|
|
15
15
|
const useStyles = createStyles(({ css }) => ({
|
|
16
16
|
background: css`
|
|
@@ -31,7 +31,7 @@ const MarketLayout = memo<PropsWithChildren>(({ children }) => {
|
|
|
31
31
|
useSwitchSideBarOnInit(SidebarTabKey.Market);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<
|
|
34
|
+
<AppLayoutDesktop>
|
|
35
35
|
<Flexbox
|
|
36
36
|
flex={1}
|
|
37
37
|
height={'100vh'}
|
|
@@ -59,7 +59,7 @@ const MarketLayout = memo<PropsWithChildren>(({ children }) => {
|
|
|
59
59
|
<SideBar />
|
|
60
60
|
</Flexbox>
|
|
61
61
|
</Flexbox>
|
|
62
|
-
</
|
|
62
|
+
</AppLayoutDesktop>
|
|
63
63
|
);
|
|
64
64
|
});
|
|
65
65
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
import ResponsiveLayout from '@/layout/ResponsiveLayout.client';
|
|
6
|
+
|
|
7
|
+
import Mobile from '../(mobile)/layout.mobile';
|
|
8
|
+
import Desktop from './layout.desktop';
|
|
9
|
+
|
|
10
|
+
const Market = ({ children }: PropsWithChildren) => (
|
|
11
|
+
<ResponsiveLayout Desktop={Desktop} Mobile={Mobile}>
|
|
12
|
+
{children}
|
|
13
|
+
</ResponsiveLayout>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default Market;
|
package/src/app/market/{components/AgentDetail/Mobile.tsx → (mobile)/features/AgentDetail.tsx}
RENAMED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Modal } from '@lobehub/ui';
|
|
2
|
-
import {
|
|
2
|
+
import { memo } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
|
|
5
5
|
import { agentMarketSelectors, useMarketStore } from '@/store/market';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import AgentDetailContent from '../../features/AgentDetailContent';
|
|
8
|
+
|
|
9
|
+
const AgentDetail = memo(() => {
|
|
8
10
|
const [showAgentSidebar, deactivateAgent] = useMarketStore((s) => [
|
|
9
11
|
agentMarketSelectors.showSideBar(s),
|
|
10
12
|
s.deactivateAgent,
|
|
@@ -14,9 +16,9 @@ const Mobile = memo<PropsWithChildren>(({ children }) => {
|
|
|
14
16
|
|
|
15
17
|
return (
|
|
16
18
|
<Modal onCancel={deactivateAgent} open={showAgentSidebar} title={t('sidebar.title')}>
|
|
17
|
-
|
|
19
|
+
<AgentDetailContent />
|
|
18
20
|
</Modal>
|
|
19
21
|
);
|
|
20
22
|
});
|
|
21
23
|
|
|
22
|
-
export default
|
|
24
|
+
export default AgentDetail;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { AgentCardProps } from '@/app/market/features/AgentCard';
|
|
4
|
+
|
|
5
|
+
import Index from '../index';
|
|
6
|
+
import Layout from './layout.mobile';
|
|
7
|
+
|
|
8
|
+
export default memo<AgentCardProps>((props) => (
|
|
9
|
+
<Layout>
|
|
10
|
+
<Index {...props} />
|
|
11
|
+
</Layout>
|
|
12
|
+
));
|
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
import { PropsWithChildren } from 'react';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import AppLayoutMobile from '@/layout/AppLayout.mobile';
|
|
7
7
|
import { useSwitchSideBarOnInit } from '@/store/global';
|
|
8
8
|
import { SidebarTabKey } from '@/store/global/initialState';
|
|
9
9
|
|
|
10
|
-
import DetailModal from './AgentDetail';
|
|
11
|
-
import Header from './Header';
|
|
10
|
+
import DetailModal from './features/AgentDetail';
|
|
11
|
+
import Header from './features/Header';
|
|
12
12
|
|
|
13
13
|
const MarketLayout = ({ children }: PropsWithChildren) => {
|
|
14
14
|
useSwitchSideBarOnInit(SidebarTabKey.Market);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
17
|
+
<AppLayoutMobile navBar={<Header />} showTabBar>
|
|
18
18
|
<Flexbox flex={1} gap={16} style={{ padding: 16 }}>
|
|
19
19
|
{children}
|
|
20
20
|
</Flexbox>
|
|
21
21
|
<DetailModal />
|
|
22
|
-
</
|
|
22
|
+
</AppLayoutMobile>
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -3,8 +3,10 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
3
3
|
|
|
4
4
|
import AgentInfo from './AgentInfo';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const AgentDetailContent = memo(() => (
|
|
7
7
|
<Flexbox>
|
|
8
8
|
<AgentInfo />
|
|
9
9
|
</Flexbox>
|
|
10
10
|
));
|
|
11
|
+
|
|
12
|
+
export default AgentDetailContent;
|
|
@@ -11,12 +11,13 @@ const TagList = memo(() => {
|
|
|
11
11
|
const keywords = useMarketStore((s) => s.searchKeywords);
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<Flexbox gap={
|
|
14
|
+
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
|
|
15
15
|
{agentTagList.map((item) => (
|
|
16
16
|
<Button
|
|
17
17
|
key={item}
|
|
18
18
|
onClick={() => useMarketStore.setState({ searchKeywords: item })}
|
|
19
19
|
shape={'round'}
|
|
20
|
+
size={'small'}
|
|
20
21
|
type={keywords === item ? 'primary' : 'default'}
|
|
21
22
|
>
|
|
22
23
|
{startCase(item)}
|
package/src/app/market/page.tsx
CHANGED
|
@@ -4,8 +4,10 @@ import { LOBE_LOCALE_COOKIE } from '@/const/locale';
|
|
|
4
4
|
import { getAgentIndexJSON } from '@/const/url';
|
|
5
5
|
import { Locales } from '@/locales/resources';
|
|
6
6
|
import { LobeChatAgentsMarketIndex } from '@/types/market';
|
|
7
|
+
import { isMobileDevice } from '@/utils/responsive';
|
|
7
8
|
|
|
8
|
-
import
|
|
9
|
+
import DesktopPage from './(desktop)';
|
|
10
|
+
import MobilePage from './(mobile)';
|
|
9
11
|
|
|
10
12
|
const getAgentList = async (): Promise<LobeChatAgentsMarketIndex> => {
|
|
11
13
|
const cookieStore = cookies();
|
|
@@ -20,10 +22,11 @@ const getAgentList = async (): Promise<LobeChatAgentsMarketIndex> => {
|
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
export default async () => {
|
|
24
26
|
const data = await getAgentList();
|
|
27
|
+
const mobile = isMobileDevice();
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
};
|
|
29
|
+
const Page = mobile ? MobilePage : DesktopPage;
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
return <Page defaultAgents={data.agents} />;
|
|
32
|
+
};
|
|
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
|
|
5
5
|
import { useGlobalStore } from '@/store/global';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const Header = memo(() => {
|
|
8
8
|
const { t } = useTranslation('setting');
|
|
9
9
|
const tab = useGlobalStore((s) => s.settingsTab);
|
|
10
10
|
|
|
@@ -19,4 +19,4 @@ const Index = memo(() => {
|
|
|
19
19
|
);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
export default
|
|
22
|
+
export default Header;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import ResponsiveIndex from '@/components/ResponsiveIndex';
|
|
6
|
+
|
|
7
|
+
import Mobile from '../(mobile)';
|
|
8
|
+
import Common from '../common';
|
|
9
|
+
import Layout from './layout.responsive';
|
|
10
|
+
|
|
11
|
+
export default memo(() => (
|
|
12
|
+
<ResponsiveIndex Mobile={Mobile}>
|
|
13
|
+
<Layout>
|
|
14
|
+
<Common />
|
|
15
|
+
</Layout>
|
|
16
|
+
</ResponsiveIndex>
|
|
17
|
+
));
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { PropsWithChildren, memo } from 'react';
|
|
2
2
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
3
3
|
|
|
4
4
|
import SafeSpacing from '@/components/SafeSpacing';
|
|
5
|
-
import
|
|
5
|
+
import AppLayoutDesktop from '@/layout/AppLayout.desktop';
|
|
6
|
+
import { useSwitchSideBarOnInit } from '@/store/global';
|
|
7
|
+
import { SidebarTabKey } from '@/store/global/initialState';
|
|
6
8
|
|
|
7
|
-
import Header from '../features/Header';
|
|
8
9
|
import SideBar from '../features/SideBar';
|
|
10
|
+
import Header from './features/Header';
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
export default memo(({ children }: PropsWithChildren) => {
|
|
13
|
+
useSwitchSideBarOnInit(SidebarTabKey.Setting);
|
|
11
14
|
return (
|
|
12
|
-
<
|
|
15
|
+
<AppLayoutDesktop>
|
|
13
16
|
<SideBar />
|
|
14
17
|
<Flexbox flex={1} height={'100vh'} style={{ position: 'relative' }}>
|
|
15
18
|
<Header />
|
|
@@ -20,8 +23,6 @@ const SettingLayout = ({ children }: PropsWithChildren) => {
|
|
|
20
23
|
</Center>
|
|
21
24
|
</Flexbox>
|
|
22
25
|
</Flexbox>
|
|
23
|
-
</
|
|
26
|
+
</AppLayoutDesktop>
|
|
24
27
|
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default SettingLayout;
|
|
28
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren, memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import ResponsiveLayout from '@/layout/ResponsiveLayout.client';
|
|
6
|
+
|
|
7
|
+
import MobileLayout from '../(mobile)/layout.mobile';
|
|
8
|
+
import DesktopLayout from './layout.desktop';
|
|
9
|
+
|
|
10
|
+
export default memo(({ children }: PropsWithChildren) => (
|
|
11
|
+
<ResponsiveLayout Desktop={DesktopLayout} Mobile={MobileLayout}>
|
|
12
|
+
{children}
|
|
13
|
+
</ResponsiveLayout>
|
|
14
|
+
));
|
|
@@ -9,7 +9,7 @@ import { useExportConfig } from '@/hooks/useExportConfig';
|
|
|
9
9
|
import { useImportConfig } from '@/hooks/useImportConfig';
|
|
10
10
|
import { useGlobalStore } from '@/store/global';
|
|
11
11
|
|
|
12
|
-
import Item from '
|
|
12
|
+
import Item from '../../features/SideBar/Item';
|
|
13
13
|
|
|
14
14
|
const ExtraList = memo(() => {
|
|
15
15
|
const { t } = useTranslation('common');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren, memo } from 'react';
|
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
|
|
6
|
+
import AppLayoutMobile from '@/layout/AppLayout.mobile';
|
|
7
|
+
import { useSwitchSideBarOnInit } from '@/store/global';
|
|
8
|
+
import { SidebarTabKey } from '@/store/global/initialState';
|
|
9
|
+
|
|
10
|
+
import Header from './features/Header';
|
|
11
|
+
|
|
12
|
+
export default memo(({ children }: PropsWithChildren) => {
|
|
13
|
+
useSwitchSideBarOnInit(SidebarTabKey.Setting);
|
|
14
|
+
return (
|
|
15
|
+
<AppLayoutMobile navBar={<Header />}>
|
|
16
|
+
<Flexbox style={{ overflow: 'auto' }}>{children}</Flexbox>
|
|
17
|
+
</AppLayoutMobile>
|
|
18
|
+
);
|
|
19
|
+
});
|
|
@@ -5,17 +5,16 @@ import { createStyles } from 'antd-style';
|
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { Center } from 'react-layout-kit';
|
|
7
7
|
|
|
8
|
-
import pkg from '@/../package.json';
|
|
9
|
-
import Header from '@/app/market/(mobile)/Header';
|
|
10
8
|
import AgentCardBanner from '@/app/market/features/AgentCard/AgentCardBanner';
|
|
9
|
+
import { CURRENT_VERSION } from '@/const/version';
|
|
11
10
|
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
12
|
-
import AppMobileLayout from '@/layout/AppMobileLayout';
|
|
13
11
|
import { useGlobalStore, useSwitchSideBarOnInit } from '@/store/global';
|
|
14
12
|
import { SidebarTabKey } from '@/store/global/initialState';
|
|
15
13
|
import { AVATAR } from '@/store/session/slices/chat/actions/share';
|
|
16
14
|
|
|
17
|
-
import List from '
|
|
18
|
-
import ExtraList from '
|
|
15
|
+
import List from '../../features/SideBar/List';
|
|
16
|
+
import ExtraList from '../features/ExtraList';
|
|
17
|
+
import Layout from './layout.mobile';
|
|
19
18
|
|
|
20
19
|
const useStyles = createStyles(({ css, token }) => ({
|
|
21
20
|
divider: css`
|
|
@@ -29,11 +28,12 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
29
28
|
}));
|
|
30
29
|
|
|
31
30
|
const Setting = memo(() => {
|
|
31
|
+
useSwitchSideBarOnInit(SidebarTabKey.Setting);
|
|
32
32
|
const avatar = useGlobalStore((s) => s.settings.avatar);
|
|
33
33
|
const { styles } = useStyles();
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
return (
|
|
36
|
-
<
|
|
36
|
+
<Layout>
|
|
37
37
|
<AgentCardBanner
|
|
38
38
|
mask
|
|
39
39
|
meta={{ avatar: avatar || AVATAR }}
|
|
@@ -50,11 +50,11 @@ const Setting = memo(() => {
|
|
|
50
50
|
<ExtraList />
|
|
51
51
|
<Center style={{ paddingInline: 64 }}>
|
|
52
52
|
<Divider>
|
|
53
|
-
<span className={styles.footer}>LobeChat v{
|
|
53
|
+
<span className={styles.footer}>LobeChat v{CURRENT_VERSION}</span>
|
|
54
54
|
</Divider>
|
|
55
55
|
</Center>
|
|
56
56
|
</div>
|
|
57
|
-
</
|
|
57
|
+
</Layout>
|
|
58
58
|
);
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren, memo } from 'react';
|
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
|
|
6
|
+
import AppLayoutMobile from '@/layout/AppLayout.mobile';
|
|
7
|
+
|
|
8
|
+
import Header from '../features/Header/Home';
|
|
9
|
+
|
|
10
|
+
export default memo(({ children }: PropsWithChildren) => (
|
|
11
|
+
<AppLayoutMobile navBar={<Header />} showTabBar>
|
|
12
|
+
<Flexbox style={{ overflow: 'auto' }}>{children}</Flexbox>
|
|
13
|
+
</AppLayoutMobile>
|
|
14
|
+
));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import isEqual from 'fast-deep-equal';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import AgentSetting from '@/features/AgentSetting';
|
|
5
|
+
import { settingsSelectors, useGlobalStore } from '@/store/global';
|
|
6
|
+
import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
|
|
7
|
+
import { SettingsTabs } from '@/store/global/initialState';
|
|
8
|
+
|
|
9
|
+
const Agent = memo(() => {
|
|
10
|
+
useSwitchSideBarOnInit(SettingsTabs.Agent);
|
|
11
|
+
|
|
12
|
+
const config = useGlobalStore(settingsSelectors.defaultAgentConfig, isEqual);
|
|
13
|
+
const meta = useGlobalStore(settingsSelectors.defaultAgentMeta, isEqual);
|
|
14
|
+
const [updateAgent] = useGlobalStore((s) => [s.updateDefaultAgent]);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<AgentSetting
|
|
18
|
+
config={config}
|
|
19
|
+
meta={meta}
|
|
20
|
+
onConfigChange={(config) => {
|
|
21
|
+
updateAgent({ config });
|
|
22
|
+
}}
|
|
23
|
+
onMetaChange={(meta) => {
|
|
24
|
+
updateAgent({ meta });
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export default Agent;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
import PageTitle from '@/components/PageTitle';
|
|
7
|
+
import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
|
|
8
|
+
import { SettingsTabs } from '@/store/global/initialState';
|
|
9
|
+
import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
|
|
10
|
+
|
|
11
|
+
import Agent from './Agent';
|
|
12
|
+
|
|
13
|
+
export default memo(() => {
|
|
14
|
+
useSwitchSideBarOnInit(SettingsTabs.Agent);
|
|
15
|
+
const { t } = useTranslation('setting');
|
|
16
|
+
const pageTitle = genSiteHeadTitle(t('tab.agent'));
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<PageTitle title={pageTitle} />
|
|
20
|
+
<Agent />
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../layout.server';
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import Index from './index';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
|
|
6
|
-
import AgentSetting from '@/features/AgentSetting';
|
|
7
|
-
import { settingsSelectors, useGlobalStore } from '@/store/global';
|
|
8
|
-
import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
|
|
9
|
-
import { SettingsTabs } from '@/store/global/initialState';
|
|
10
|
-
|
|
11
|
-
const Agent = memo(() => {
|
|
12
|
-
useSwitchSideBarOnInit(SettingsTabs.Agent);
|
|
13
|
-
|
|
14
|
-
const config = useGlobalStore(settingsSelectors.defaultAgentConfig, isEqual);
|
|
15
|
-
const meta = useGlobalStore(settingsSelectors.defaultAgentMeta, isEqual);
|
|
16
|
-
const [updateAgent] = useGlobalStore((s) => [s.updateDefaultAgent]);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<AgentSetting
|
|
20
|
-
config={config}
|
|
21
|
-
meta={meta}
|
|
22
|
-
onConfigChange={(config) => {
|
|
23
|
-
updateAgent({ config });
|
|
24
|
-
}}
|
|
25
|
-
onMetaChange={(meta) => {
|
|
26
|
-
updateAgent({ meta });
|
|
27
|
-
}}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export default Agent;
|
|
3
|
+
export default () => <Index />;
|