@lobehub/chat 0.82.8 → 0.83.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/CHANGELOG.md +42 -0
- package/locales/en_US/error.json +2 -1
- package/locales/en_US/plugin.json +1 -0
- package/locales/en_US/setting.json +2 -1
- package/locales/ru_RU/error.json +2 -1
- package/locales/ru_RU/plugin.json +1 -0
- package/locales/ru_RU/setting.json +2 -1
- package/locales/zh_CN/error.json +1 -0
- package/locales/zh_CN/plugin.json +2 -1
- package/locales/zh_CN/setting.json +2 -1
- package/locales/zh_TW/error.json +2 -1
- package/locales/zh_TW/plugin.json +1 -0
- package/locales/zh_TW/setting.json +2 -1
- package/package.json +6 -5
- package/src/app/chat/{features/Header → (desktop)/features/ChatHeader}/Desktop.tsx +2 -2
- package/src/app/chat/{features/Header → (desktop)/features/ChatHeader}/index.tsx +1 -1
- package/src/app/chat/(desktop)/features/ChatInput/index.tsx +22 -0
- package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/Desktop.tsx +1 -1
- package/src/app/chat/{features/SessionList/Header → (desktop)/features/SessionHeader}/index.tsx +1 -1
- package/src/app/chat/{features → (desktop)/features}/SessionList/Desktop.tsx +1 -1
- package/src/app/chat/(desktop)/features/SessionList/index.tsx +20 -0
- package/src/app/chat/{features/Sidebar → (desktop)/features/SideBar}/Desktop.tsx +4 -4
- package/src/app/chat/(desktop)/features/SideBar/index.tsx +20 -0
- package/src/app/chat/(desktop)/index.tsx +24 -0
- package/src/app/chat/{layout.desktop.tsx → (desktop)/layout/Desktop.tsx} +4 -4
- package/src/app/chat/(desktop)/layout/index.tsx +25 -0
- package/src/app/chat/(mobile)/features/ChatHeader.tsx +1 -0
- package/src/app/chat/(mobile)/features/ChatInput.tsx +14 -0
- package/src/app/chat/(mobile)/features/SessionList.tsx +12 -0
- package/src/app/chat/(mobile)/features/Topics.tsx +12 -0
- package/src/app/chat/(mobile)/index.tsx +20 -0
- package/src/app/chat/(mobile)/layout.tsx +15 -0
- package/src/app/chat/(mobile)/mobile/page.tsx +21 -0
- package/src/app/chat/{features/Header → components/ChatHeader}/Mobile.tsx +2 -1
- package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/Preview.tsx +3 -3
- package/src/app/chat/{features/Conversation/Input → components/ChatInput}/index.tsx +23 -21
- package/src/app/chat/components/Inspector/index.tsx +17 -0
- package/src/app/chat/{features → components}/SessionList/List/Item/index.tsx +2 -2
- package/src/app/chat/{features → components}/SessionList/Mobile.tsx +1 -1
- package/src/app/chat/{features → components}/SessionList/index.tsx +3 -10
- package/src/app/chat/features/Conversation/index.tsx +8 -4
- package/src/app/chat/features/PageTitle.tsx +19 -0
- package/src/app/chat/layout.tsx +14 -0
- package/src/app/chat/page.tsx +9 -4
- package/src/app/chat/settings/(desktop)/Header/index.tsx +13 -0
- package/src/app/chat/settings/{layout.desktop.tsx → (desktop)/layout.desktop.tsx} +5 -4
- package/src/app/chat/settings/(mobile)/Header.tsx +12 -0
- package/src/app/chat/settings/{layout.mobile.tsx → (mobile)/layout.mobile.tsx} +3 -1
- package/src/app/chat/settings/{features → components}/Header/index.tsx +4 -13
- package/src/app/chat/settings/layout.tsx +14 -0
- package/src/app/chat/settings/page.tsx +36 -5
- package/src/app/home/index.tsx +15 -11
- package/src/app/layout.tsx +4 -1
- package/src/app/metadata.ts +4 -1
- package/src/app/settings/agent/Agent.tsx +3 -3
- package/src/app/settings/agent/index.tsx +1 -0
- package/src/app/settings/common/Common.tsx +109 -117
- package/src/app/settings/features/SideBar/List.tsx +11 -5
- package/src/app/settings/llm/LLM/index.tsx +2 -2
- package/src/app/welcome/page.tsx +2 -6
- package/src/components/PageTitle.tsx +11 -0
- package/src/config/client.ts +13 -0
- package/src/const/locale.ts +9 -0
- package/src/const/settings.ts +1 -1
- package/src/const/url.ts +1 -6
- package/src/helpers/export.ts +2 -2
- package/src/layout/AppMobileLayout.tsx +15 -24
- package/src/layout/GlobalLayout/Locale.tsx +44 -0
- package/src/layout/GlobalLayout/LocaleLoading.tsx +21 -0
- package/src/layout/GlobalLayout/StoreHydration.tsx +28 -0
- package/src/layout/GlobalLayout/index.tsx +29 -41
- package/src/locales/create.ts +43 -26
- package/src/locales/default/setting.ts +2 -1
- package/src/locales/options.ts +6 -5
- package/src/services/agentMarket.ts +6 -4
- package/src/services/pluginMarket.ts +2 -2
- package/src/store/global/hooks/useSwitchSettingsOnInit.ts +5 -2
- package/src/store/global/{selectors.test.ts → selectors/settings.test.ts} +11 -11
- package/src/store/global/selectors/settings.ts +44 -0
- package/src/store/global/selectors.ts +1 -36
- package/src/store/global/slices/common.ts +3 -4
- package/src/types/locale.ts +4 -0
- package/src/types/settings.ts +2 -2
- package/src/utils/env.ts +2 -0
- package/src/utils/responsive.ts +1 -0
- package/src/utils/switchLang.ts +5 -1
- package/src/app/chat/features/Sidebar/index.tsx +0 -29
- package/src/app/chat/index.tsx +0 -54
- package/src/app/chat/layout.mobile.tsx +0 -20
- package/src/app/chat/mobile/index.tsx +0 -38
- package/src/app/chat/mobile/page.tsx +0 -7
- package/src/app/chat/settings/index.tsx +0 -51
- package/src/layout/GlobalLayout/style.ts +0 -18
- /package/src/app/chat/{features/Conversation/Input → (desktop)/features/ChatInput}/Desktop.tsx +0 -0
- /package/src/app/chat/{features/SessionList/Header/Mobile.tsx → (mobile)/features/SessionHeader.tsx} +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/PluginTag/PluginStatus.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/PluginTag/index.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/Inner.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/index.tsx +0 -0
- /package/src/app/chat/{features/Header → components/ChatHeader}/ShareButton/style.ts +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/ActionLeft.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/ActionRight.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/ActionBar/Token.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Footer/SaveTopic.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Footer/index.tsx +0 -0
- /package/src/app/chat/{features/Conversation/Input → components/ChatInput}/Mobile.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Mobile.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/Header.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/index.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/SystemRole/style.ts +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/DefaultContent.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/SkeletonList.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/TopicContent.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/TopicItem.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/Topic/index.tsx +0 -0
- /package/src/app/chat/{features/Sidebar → components/Inspector}/TopicSearchBar/index.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/CollapseGroup/index.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/Inbox/index.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/AddButton.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/Item/Actions.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/SkeletonList.tsx +0 -0
- /package/src/app/chat/{features → components}/SessionList/List/index.tsx +0 -0
- /package/src/app/chat/settings/{features → (desktop)}/Header/Desktop.tsx +0 -0
- /package/src/app/chat/settings/{features → components}/Header/Mobile.tsx +0 -0
- /package/src/{components/AppTheme/index.tsx → layout/GlobalLayout/AppTheme.tsx} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Flexbox } from 'react-layout-kit';
|
|
2
|
+
|
|
3
|
+
import { Topic } from './Topic';
|
|
4
|
+
import TopicSearchBar from './TopicSearchBar';
|
|
5
|
+
|
|
6
|
+
export const InspectorContent = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Flexbox height={'100%'} style={{ overflow: 'hidden' }}>
|
|
9
|
+
<Flexbox padding={16}>
|
|
10
|
+
<TopicSearchBar />
|
|
11
|
+
</Flexbox>
|
|
12
|
+
<Flexbox gap={16} paddingInline={16} style={{ overflowY: 'auto', position: 'relative' }}>
|
|
13
|
+
<Topic />
|
|
14
|
+
</Flexbox>
|
|
15
|
+
</Flexbox>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -6,7 +6,7 @@ import { memo, useMemo, useRef, useState } from 'react';
|
|
|
6
6
|
import { Flexbox } from 'react-layout-kit';
|
|
7
7
|
import { shallow } from 'zustand/shallow';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { settingsSelectors, useGlobalStore } from '@/store/global';
|
|
10
10
|
import { useSessionStore } from '@/store/session';
|
|
11
11
|
import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
|
|
12
12
|
|
|
@@ -36,7 +36,7 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
|
|
|
36
36
|
const isHovering = useHover(ref);
|
|
37
37
|
const { mobile } = useResponsive();
|
|
38
38
|
const { styles } = useStyles();
|
|
39
|
-
const [defaultModel] = useGlobalStore((s) => [
|
|
39
|
+
const [defaultModel] = useGlobalStore((s) => [settingsSelectors.defaultAgentConfig(s).model]);
|
|
40
40
|
|
|
41
41
|
const [
|
|
42
42
|
active,
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { CollapseProps } from 'antd';
|
|
2
|
-
import { useResponsive } from 'antd-style';
|
|
3
2
|
import { memo, useMemo } from 'react';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
5
4
|
|
|
6
5
|
import CollapseGroup from './CollapseGroup';
|
|
7
|
-
import Desktop from './Desktop';
|
|
8
6
|
import Inbox from './Inbox';
|
|
9
7
|
import SessionList from './List';
|
|
10
|
-
import Mobile from './Mobile';
|
|
11
8
|
|
|
12
|
-
export const
|
|
13
|
-
const { mobile } = useResponsive();
|
|
9
|
+
export const SessionListContent = memo(() => {
|
|
14
10
|
const { t } = useTranslation('common');
|
|
15
|
-
|
|
16
|
-
const Render = mobile ? Mobile : Desktop;
|
|
17
|
-
|
|
18
11
|
const items: CollapseProps['items'] = useMemo(
|
|
19
12
|
() => [
|
|
20
13
|
{
|
|
@@ -27,9 +20,9 @@ export const Sessions = memo(() => {
|
|
|
27
20
|
);
|
|
28
21
|
|
|
29
22
|
return (
|
|
30
|
-
|
|
23
|
+
<>
|
|
31
24
|
<Inbox />
|
|
32
25
|
<CollapseGroup defaultActiveKey={['sessionList']} items={items} />
|
|
33
|
-
|
|
26
|
+
</>
|
|
34
27
|
);
|
|
35
28
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BackBottom } from '@lobehub/ui';
|
|
2
2
|
import { createStyles } from 'antd-style';
|
|
3
|
-
import { memo, useRef } from 'react';
|
|
3
|
+
import { ReactNode, memo, useRef } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Flexbox } from 'react-layout-kit';
|
|
6
6
|
|
|
@@ -8,7 +8,6 @@ import SafeSpacing from '@/components/SafeSpacing';
|
|
|
8
8
|
import { usePluginStore } from '@/store/plugin';
|
|
9
9
|
|
|
10
10
|
import ChatList from './ChatList';
|
|
11
|
-
import ChatInput from './Input';
|
|
12
11
|
import ChatScrollAnchor from './ScrollAnchor';
|
|
13
12
|
|
|
14
13
|
const useStyles = createStyles(
|
|
@@ -23,7 +22,12 @@ const useStyles = createStyles(
|
|
|
23
22
|
`,
|
|
24
23
|
);
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
interface ConversationProps {
|
|
26
|
+
chatInput: ReactNode;
|
|
27
|
+
mobile?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const Conversation = memo<ConversationProps>(({ mobile, chatInput }) => {
|
|
27
31
|
const ref = useRef(null);
|
|
28
32
|
const { t } = useTranslation('common');
|
|
29
33
|
const { styles } = useStyles();
|
|
@@ -41,7 +45,7 @@ const Conversation = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
|
41
45
|
</div>
|
|
42
46
|
<BackBottom target={ref} text={t('backToBottom')} />
|
|
43
47
|
</div>
|
|
44
|
-
|
|
48
|
+
{chatInput}
|
|
45
49
|
</Flexbox>
|
|
46
50
|
);
|
|
47
51
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import PageTitle from '@/components/PageTitle';
|
|
6
|
+
import { useSessionStore } from '@/store/session';
|
|
7
|
+
import { agentSelectors } from '@/store/session/selectors';
|
|
8
|
+
import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
|
|
9
|
+
|
|
10
|
+
const Title = memo(() => {
|
|
11
|
+
const [avatar, title] = useSessionStore((s) => [
|
|
12
|
+
agentSelectors.currentAgentAvatar(s),
|
|
13
|
+
agentSelectors.currentAgentTitle(s),
|
|
14
|
+
]);
|
|
15
|
+
const pageTitle = genSiteHeadTitle([avatar, title].filter(Boolean).join(' '));
|
|
16
|
+
|
|
17
|
+
return <PageTitle title={pageTitle} />;
|
|
18
|
+
});
|
|
19
|
+
export default Title;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import { isMobileDevice } from '@/utils/responsive';
|
|
4
|
+
|
|
5
|
+
import Desktop from './(desktop)/layout';
|
|
6
|
+
import Mobile from './(mobile)/layout';
|
|
7
|
+
|
|
8
|
+
const Layout = ({ children }: PropsWithChildren) => {
|
|
9
|
+
const mobile = isMobileDevice();
|
|
10
|
+
|
|
11
|
+
return mobile ? <Mobile>{children}</Mobile> : <Desktop>{children}</Desktop>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Layout;
|
package/src/app/chat/page.tsx
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isMobileDevice } from '@/utils/responsive';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import DesktopPage from './(desktop)';
|
|
4
|
+
import MobilePage from './(mobile)';
|
|
5
|
+
|
|
6
|
+
const Page = () => {
|
|
7
|
+
const mobile = isMobileDevice();
|
|
8
|
+
|
|
9
|
+
return mobile ? <MobilePage /> : <DesktopPage />;
|
|
5
10
|
};
|
|
6
11
|
|
|
7
|
-
export default
|
|
12
|
+
export default Page;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { PropsWithChildren, memo } from 'react';
|
|
2
4
|
import { Flexbox } from 'react-layout-kit';
|
|
3
5
|
|
|
4
6
|
import SafeSpacing from '@/components/SafeSpacing';
|
|
5
7
|
import { HEADER_HEIGHT } from '@/const/layoutTokens';
|
|
6
8
|
|
|
7
|
-
import
|
|
8
|
-
import Header from './features/Header';
|
|
9
|
+
import Header from './Header';
|
|
9
10
|
|
|
10
11
|
const DesktopLayout = memo<PropsWithChildren>(({ children }) => {
|
|
11
12
|
return (
|
|
12
|
-
|
|
13
|
+
<>
|
|
13
14
|
<Header />
|
|
14
15
|
<Flexbox align={'center'} flex={1} gap={16} padding={24} style={{ overflow: 'auto' }}>
|
|
15
16
|
<SafeSpacing height={HEADER_HEIGHT - 16} />
|
|
16
17
|
{children}
|
|
17
18
|
</Flexbox>
|
|
18
|
-
|
|
19
|
+
</>
|
|
19
20
|
);
|
|
20
21
|
});
|
|
21
22
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { HeaderContent } from '@/app/chat/settings/components/Header';
|
|
4
|
+
import Layout from '@/app/chat/settings/components/Header/Mobile';
|
|
5
|
+
|
|
6
|
+
const Header = memo(() => (
|
|
7
|
+
<Layout>
|
|
8
|
+
<HeaderContent />
|
|
9
|
+
</Layout>
|
|
10
|
+
));
|
|
11
|
+
|
|
12
|
+
export default Header;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { PropsWithChildren, memo } from 'react';
|
|
2
4
|
|
|
3
5
|
import AppMobileLayout from '@/layout/AppMobileLayout';
|
|
4
6
|
|
|
5
|
-
import Header from './
|
|
7
|
+
import Header from './Header';
|
|
6
8
|
|
|
7
9
|
const MobileLayout = memo<PropsWithChildren>(({ children }) => {
|
|
8
10
|
return <AppMobileLayout navBar={<Header />}>{children}</AppMobileLayout>;
|
|
@@ -9,16 +9,11 @@ import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
|
9
9
|
import { exportSingleAgent, exportSingleSession } from '@/helpers/export';
|
|
10
10
|
import { useSessionStore } from '@/store/session';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
import Mobile from './Mobile';
|
|
14
|
-
|
|
15
|
-
const Header = memo<{ mobile?: boolean }>(() => {
|
|
12
|
+
export const HeaderContent = memo<{ mobile?: boolean }>(() => {
|
|
16
13
|
const { t } = useTranslation('setting');
|
|
17
14
|
const id = useSessionStore((s) => s.activeId);
|
|
18
15
|
const { mobile } = useResponsive();
|
|
19
16
|
|
|
20
|
-
const Render = mobile ? Mobile : Desktop;
|
|
21
|
-
|
|
22
17
|
const items = useMemo<MenuProps['items']>(
|
|
23
18
|
() => [
|
|
24
19
|
{
|
|
@@ -46,12 +41,8 @@ const Header = memo<{ mobile?: boolean }>(() => {
|
|
|
46
41
|
const size = mobile ? MOBILE_HEADER_ICON_SIZE : { fontSize: 24 };
|
|
47
42
|
|
|
48
43
|
return (
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
</Dropdown>
|
|
53
|
-
</Render>
|
|
44
|
+
<Dropdown arrow={false} menu={{ items }} trigger={['click']}>
|
|
45
|
+
<ActionIcon icon={HardDriveDownload} size={size} title={t('export', { ns: 'common' })} />
|
|
46
|
+
</Dropdown>
|
|
54
47
|
);
|
|
55
48
|
});
|
|
56
|
-
|
|
57
|
-
export default Header;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import { isMobileDevice } from '@/utils/responsive';
|
|
4
|
+
|
|
5
|
+
import Desktop from './(desktop)/layout.desktop';
|
|
6
|
+
import Mobile from './(mobile)/layout.mobile';
|
|
7
|
+
|
|
8
|
+
const Layout = ({ children }: PropsWithChildren) => {
|
|
9
|
+
const mobile = isMobileDevice();
|
|
10
|
+
|
|
11
|
+
return mobile ? <Mobile>{children}</Mobile> : <Desktop>{children}</Desktop>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Layout;
|
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
3
|
+
import isEqual from 'fast-deep-equal';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
6
|
|
|
7
|
-
|
|
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;
|
package/src/app/home/index.tsx
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { Icon, Logo } from '@lobehub/ui';
|
|
4
|
-
import { t } from 'i18next';
|
|
5
4
|
import { Loader2 } from 'lucide-react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
7
7
|
|
|
8
|
-
const Loading = () =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
8
|
+
const Loading = () => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Flexbox height={'100vh'} width={'100%'}>
|
|
13
|
+
<Center flex={1} gap={12} width={'100%'}>
|
|
14
|
+
<Logo extra={'Chat'} size={48} type={'combine'} />
|
|
15
|
+
<Center gap={16} horizontal>
|
|
16
|
+
<Icon icon={Loader2} spin />
|
|
17
|
+
{t('appInitializing', { ns: 'common' })}
|
|
18
|
+
</Center>
|
|
15
19
|
</Center>
|
|
16
|
-
</
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
</Flexbox>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
19
23
|
|
|
20
24
|
export default Loading;
|
package/src/app/layout.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { cookies } from 'next/headers';
|
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import Analytics from '@/components/Analytics';
|
|
5
|
+
import { DEFAULT_LANG, LOBE_LOCALE_COOKIE } from '@/const/locale';
|
|
5
6
|
import {
|
|
6
7
|
LOBE_THEME_APPEARANCE,
|
|
7
8
|
LOBE_THEME_NEUTRAL_COLOR,
|
|
@@ -17,13 +18,15 @@ const RootLayout = ({ children }: PropsWithChildren) => {
|
|
|
17
18
|
const appearance = cookieStore.get(LOBE_THEME_APPEARANCE);
|
|
18
19
|
const neutralColor = cookieStore.get(LOBE_THEME_NEUTRAL_COLOR);
|
|
19
20
|
const primaryColor = cookieStore.get(LOBE_THEME_PRIMARY_COLOR);
|
|
21
|
+
const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
|
|
20
22
|
|
|
21
23
|
return (
|
|
22
|
-
<html lang=
|
|
24
|
+
<html lang={lang?.value || DEFAULT_LANG}>
|
|
23
25
|
<body>
|
|
24
26
|
<StyleRegistry>
|
|
25
27
|
<Layout
|
|
26
28
|
defaultAppearance={appearance?.value}
|
|
29
|
+
defaultLang={lang?.value}
|
|
27
30
|
defaultNeutralColor={neutralColor?.value as any}
|
|
28
31
|
defaultPrimaryColor={primaryColor?.value as any}
|
|
29
32
|
>
|
package/src/app/metadata.ts
CHANGED
|
@@ -46,7 +46,10 @@ const metadata: Metadata = {
|
|
|
46
46
|
{ color: '#f8f8f8', media: '(prefers-color-scheme: light)' },
|
|
47
47
|
{ color: '#000', media: '(prefers-color-scheme: dark)' },
|
|
48
48
|
],
|
|
49
|
-
title:
|
|
49
|
+
title: {
|
|
50
|
+
default: title,
|
|
51
|
+
template: '%s · LobeChat',
|
|
52
|
+
},
|
|
50
53
|
viewport: {
|
|
51
54
|
initialScale: 1,
|
|
52
55
|
maximumScale: 1,
|
|
@@ -2,11 +2,11 @@ import isEqual from 'fast-deep-equal';
|
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AgentSetting from '@/features/AgentSetting';
|
|
5
|
-
import {
|
|
5
|
+
import { settingsSelectors, useGlobalStore } from '@/store/global';
|
|
6
6
|
|
|
7
7
|
const Agent = memo(() => {
|
|
8
|
-
const config = useGlobalStore(
|
|
9
|
-
const meta = useGlobalStore(
|
|
8
|
+
const config = useGlobalStore(settingsSelectors.defaultAgentConfig, isEqual);
|
|
9
|
+
const meta = useGlobalStore(settingsSelectors.defaultAgentMeta, isEqual);
|
|
10
10
|
const [updateAgent] = useGlobalStore((s) => [s.updateDefaultAgent]);
|
|
11
11
|
|
|
12
12
|
return (
|